Sha256: 704846f1662745fad83c49266f892797662d6dd14aff4e6cf22b6de9eee308d3

Contents?: true

Size: 865 Bytes

Versions: 3

Compression:

Stored size: 865 Bytes

Contents

module Merb::Generators
  
  class HelperGenerator < NamespacedGenerator

    def self.source_root
      File.join(super, 'component', 'helper')
    end
    
    desc <<-DESC
      Generates a new helper.
    DESC
    
    option :testing_framework, :desc => 'Testing framework to use (one of: rspec, test_unit)'
    
    first_argument :name, :required => true, :desc => "helper name"
    
    template :helper do |template|
      template.source = 'app/helpers/%file_name%_helper.rb'
      template.destination = "app/helpers" / base_path / "#{file_name}_helper.rb"
    end
    
    template :helper_spec, :testing_framework => :rspec do |template|
      template.source = 'spec/helpers/%file_name%_helper_spec.rb'
      template.destination = "spec/helpers" / base_path / "#{file_name}_helper_spec.rb"
    end
    
  end
  
  add :helper, HelperGenerator
  
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
merb-gen-0.9.6 lib/generators/helper.rb
merb-gen-0.9.7 lib/generators/helper.rb
merb-gen-0.9.8 lib/generators/helper.rb