Sha256: 489dc0986823bd291db4a7d53c26554319fc5a2ee6f023e5f56e38276d2d5450

Contents?: true

Size: 872 Bytes

Versions: 5

Compression:

Stored size: 872 Bytes

Contents

module Merb::Generators
  
  class PartControllerGenerator < NamespacedGenerator

    def self.source_root
      File.join(super, 'component', 'part_controller')
    end
    
    desc <<-DESC
      This is a part controller generator
    DESC
    
    first_argument :name, :required => true
    
    invoke :helper do |generator|
      generator.new(destination_root, options, "#{full_class_name}Part")
    end
    
    template :controller do |template|
      template.source = 'app/parts/%file_name%_part.rb'
      template.destination = "app/parts" / base_path / "#{file_name}_part.rb"
    end
    
    template :index do |template|
      template.source = 'app/parts/views/%file_name%_part/index.html.erb'
      template.destination = "app/parts/views" / base_path / "#{file_name}_part/index.html.erb"
    end
    
  end
  
  add :part, PartControllerGenerator
  
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
merb-gen-0.9.10 lib/generators/part_controller.rb
merb-gen-0.9.9 lib/generators/part_controller.rb
merb-gen-0.9.6 lib/generators/part_controller.rb
merb-gen-0.9.7 lib/generators/part_controller.rb
merb-gen-0.9.8 lib/generators/part_controller.rb