Sha256: bee6b162d6ba422e60168b4c4b8da4f5779ee36003e549fefab928942ff44b22

Contents?: true

Size: 967 Bytes

Versions: 1

Compression:

Stored size: 967 Bytes

Contents

# This generator creates a new 'scenario'
class ScenarioGenerator < Rails::Generator::Base

  attr_accessor :name_of_scenario_to_create, :name_of_scenario_file_to_create

  # `./script/generate scenario foo` will result in:
  #
  #   runtime_args: ['foo']
  #   runtime_options: {:quiet=>false, :generator=>"scenario", :command=>:create, :collision=>:ask}
  #
  def initialize(runtime_args, runtime_options = {})
    # setup_rails_to_run_scenarios
    @name_of_scenario_to_create      = runtime_args.join(' ')
    @name_of_scenario_file_to_create = runtime_args.join('_').downcase
    super
  end

  # this should be done by ./script/generate blackbox
  def setup_rails_to_run_scenarios
    # bootstrap
  end

  def manifest
    record do |m|
      m.directory 'scenarios'
      m.template 'scenario.erb', "scenarios/#{ name_of_scenario_file_to_create }.rb"
    end
  end
 
protected
 
  def banner
    "Usage: #{$0} _scenario Name of Scenario to Create"
  end
 
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
remi-scenarios-0.1.1 rails_generators/scenario/scenario_generator.rb