Sha256: 64048cc8f399448d42da22fa406a5b799354a64f057c3a4046df7979bace392b

Contents?: true

Size: 1.3 KB

Versions: 6

Compression:

Stored size: 1.3 KB

Contents

# Note: these are Ing::Files fixtures
# used in actions specs adapted from Thor

class MyCounter

  def self.specify_options(expect)
    expect.opt :third, "The third argument", :type => :numeric, :default => 3,
                        :short => "t"
    expect.opt :fourth, "The fourth argument", :type => :numeric  
    expect.banner "This generator runs three tasks: one, two and three."
  end
  
  include Ing::Files
  
  def source_root 
    File.expand_path(File.dirname(__FILE__))
  end
  
  attr_accessor :destination_root, :options, :first, :second, :shell
  
  def shell
    @shell ||= Ing.shell_class.new
  end
  
  def initialize(options)
    self.options = options
  end
  
  def call(*args)
    self.first, self.second = args.shift, args.shift
    one; two; three
  end
  
  def one
    first
  end

  def two
    second
  end

  def three
    options[:third]
  end
  
  def world(&block)
    result = capture(&block)
    concat(result.strip + " world!")
  end
    
end


class WhinyGenerator
  include Ing::Files

  def source_root
    File.expand_path(File.dirname(__FILE__))
  end

  attr_accessor :destination_root, :options, :shell
  
  def shell
    @shell ||= Ing.shell_class.new
  end

  def initialize(options)
    self.options = options
  end
  
  def call(*args)
  end
  
  def wrong_arity(required)
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ing-0.2.7 test/fixtures/group.ing.rb
ing-0.2.2 test/fixtures/group.ing.rb
ing-0.2.1 test/fixtures/group.ing.rb
ing-0.1.5 test/fixtures/group.ing.rb
ing-0.1.2 test/fixtures/group.ing.rb
ing-0.1.1 test/fixtures/group.ing.rb