Sha256: b5a10f06e3533e1dbd5b6907bfb0947c8f13afaf0614d07f0b4ffec26232cfe8

Contents?: true

Size: 1.04 KB

Versions: 26

Compression:

Stored size: 1.04 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 :f, :format, String, "One of: json, yaml, string (default)"
  
  
  default :info
  debug :on
  
  data = {
    "Date" => "2009-02-16",
    "Owners" => ["greg", "rupaul", "telly", "prince kinko"],
    "Players" => ["d-bam", "alberta", "birds", "condor man"]
  }
  
  option :e, :echo, "Echo the arguments"
  command :info do |obj|
    format = obj.global.format.nil? ? nil : "to_#{obj.global.format}"
    format = nil if obj.global.format == 'string'
    if obj.option.echo
      puts obj.argv
    else
      if format.nil?
        data.keys.sort.each do |n|
          val = data[n]
          val = val.join(', ') if val.is_a?(Array)
          puts "%9s %44s" % ["#{n}:", val]
        end
      else
        puts data.send(format)
      end
    end
  end
  
end

Version data entries

26 entries across 26 versions & 2 rubygems

Version Path
delano-tryouts-0.4.0 bin/mockout
delano-tryouts-0.4.1 bin/mockout
delano-tryouts-0.5.0 bin/mockout
delano-tryouts-0.5.1 bin/mockout
delano-tryouts-0.6.0 bin/mockout
delano-tryouts-0.6.1 bin/mockout
delano-tryouts-0.6.2 bin/mockout
delano-tryouts-0.6.3 bin/mockout
delano-tryouts-0.7.0 bin/mockout
delano-tryouts-0.7.1 bin/mockout
delano-tryouts-0.7.2 bin/mockout
delano-tryouts-0.7.3 bin/mockout
delano-tryouts-0.7.4 bin/mockout
tryouts-0.6.0 bin/mockout
tryouts-0.6.1 bin/mockout
tryouts-0.6.2 bin/mockout
tryouts-0.6.3 bin/mockout
tryouts-0.7.0 bin/mockout
tryouts-0.7.1 bin/mockout
tryouts-0.7.2 bin/mockout