Sha256: 48132396b6e47f13344f774bf9d4aed7003efb1e64649a0093b5ab9d59d0a266

Contents?: true

Size: 1.45 KB

Versions: 2

Compression:

Stored size: 1.45 KB

Contents

class TestUnitGenerator < RubiGen::Base

  attr_reader :gem_name, :module_name

  def initialize(runtime_args, runtime_options = {})
    super
    @destination_root = File.expand_path(destination_root)
    @gem_name = base_name
    @module_name  = @gem_name.camelcase
    extract_options
  end

  def manifest
    record do |m|
      # Ensure appropriate folder(s) exists
      m.directory 'test'
      m.directory 'tasks'

      m.template 'test/test.rb', "test/#{gem_name}_test.rb"
      m.template_copy_each %w( test_helper.rb ), 'test'
      m.file_copy_each     %w( test_unit.rake ), 'tasks'
    end
  end

  protected
    def banner
      <<-EOS
Creates a ...

USAGE: #{$0} #{spec.name} name
EOS
    end

    def add_options!(opts)
      # opts.separator ''
      # opts.separator 'Options:'
      # For each option below, place the default
      # at the top of the file next to "default_options"
      # opts.on("-a", "--author=\"Your Name\"", String,
      #         "Some comment about this option",
      #         "Default: none") { |o| options[:author] = o }
      # opts.on("-v", "--version", "Show the #{File.basename($0)} version number and quit.")
    end

    def extract_options
      # for each option, extract it into a local variable (and create an "attr_reader :author" at the top)
      # Templates can access these value via the attr_reader-generated methods, but not the
      # raw instance variable value.
      # @author = options[:author]
    end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
daemon-kit-0.1.7.12 daemon_generators/test_unit/test_unit_generator.rb
daemon-kit-0.1.7.11 daemon_generators/test_unit/test_unit_generator.rb