Sha256: 5bce789bd51f31316ae4cd8db32b230ff2f445d1668b620699eb60b1b67528ba
Contents?: true
Size: 1.18 KB
Versions: 13
Compression:
Stored size: 1.18 KB
Contents
#!/usr/bin/ruby # = Mockout # # This mock is used to generate test output for Tryouts itself. # It is otherwise uninteresting! # require 'rubygems' require 'drydock' require 'yaml' begin; require 'json'; rescue LoadError; end # json may not be installed module DrillCLI extend Drydock global :q, :quiet, "Don't print anything to STDOUT or STDERR" default :echo debug :on about "Echo all arguments" command :echo do |obj| puts obj.argv unless obj.global.quiet end about "Returns PASS or FAIL" option :p, :pass, "Always pass" command :test do |obj| rate = obj.option.pass ? 0 : 0.4 puts rand >= rate ? "PASS" : "FAIL" unless obj.global.quiet end about "Prints current date in UTC" command :date do |obj| puts Time.now.utc unless obj.global.quiet end about "Exits with a non-zero exit code" option :e, :ecode, Integer, "The exit code to fail with (default: 1)" command :error do |obj| ecode = obj.option.ecode.nil? ? 1 : obj.option.ecode unless obj.global.quiet STDERR.puts "STDERR output (#{ecode})" STDOUT.puts "STDOUT output (#{ecode})" end exit ecode end end Drydock.run!(ARGV, STDIN) if Drydock.run?
Version data entries
13 entries across 13 versions & 2 rubygems