Sha256: 3271653d505ecc97fffad0d94fbc740ef1fbdeedc0484dbeb050bba3e930b25a

Contents?: true

Size: 1.44 KB

Versions: 2

Compression:

Stored size: 1.44 KB

Contents

module Merb::Generators
  
  class CucumberGenerator < Generator
    
    desc <<-DESC
      Generates setup code for cucumber feature framework
    DESC
    
    def self.source_root
      File.join(File.dirname(__FILE__), 'cucumber', 'templates')
    end

    option :orm, :desc => 'Object-Relation Mapper to use (one of: none, activerecord, datamapper, sequel)'
    option :session_type, :default => :webrat, :desc => 'Session type to use (one of: simple, webrat)'
    
    template(:env) { |t| t.source = t.destination = "features/support/env.rb" }
    template(:rake) { |t| t.source = t.destination = "lib/tasks/cucumber.rake" }
    template(:autotest) { |t| t.source = t.destination = "autotest/cucumber_merb_rspec.rb" }
    template(:result_steps) { |t| t.source = t.destination = "features/steps/result_steps.rb" }
    
    template(:example_feature, :session_type => :webrat) { |t|  t.source = t.destination = "features/authentication/login.feature" }
    template(:example_feature_steps, :session_type => :webrat) do |t| 
      t.source = t.destination = "features/authentication/steps/login_steps.rb"
    end
    template(:webrat_steps, :session_type => :webrat) do |t| 
      t.source = t.destination = "features/steps/webrat_steps.rb"
    end
    template(:cucumber_yml) { |t| t.source = t.destination = "config/cucumber.yml" }
    
    def chmod(action)
      File.chmod(0755, action.destination)
    end
    
  end 
  
  add :cucumber, CucumberGenerator
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
merb_cucumber-0.6.1 lib/generators/cucumber.rb
dr-merb_cucumber-0.6 lib/generators/cucumber.rb