Sha256: 92507d5460fc06ef8de58d8207b40620ab1dfe838424befa97fe49f7113fb950

Contents?: true

Size: 1.28 KB

Versions: 7

Compression:

Stored size: 1.28 KB

Contents

class PluginGenerator < Rails::Generator::NamedBase
  attr_reader :plugin_path

  def initialize(runtime_args, runtime_options = {})
    @with_generator = runtime_args.delete("--with-generator")
    super
    @plugin_path = "vendor/plugins/#{file_name}"
  end

  def manifest
    record do |m|
      m.directory "#{plugin_path}/lib"
      m.directory "#{plugin_path}/tasks"
      m.directory "#{plugin_path}/test"

      m.template 'README',        "#{plugin_path}/README"
      m.template 'Rakefile',      "#{plugin_path}/Rakefile"
      m.template 'init.rb',       "#{plugin_path}/init.rb"
      m.template 'install.rb',    "#{plugin_path}/install.rb"
      m.template 'plugin.rb',     "#{plugin_path}/lib/#{file_name}.rb"
      m.template 'tasks.rake',    "#{plugin_path}/tasks/#{file_name}_tasks.rake"
      m.template 'unit_test.rb',  "#{plugin_path}/test/#{file_name}_test.rb"
      
      if @with_generator
        m.directory "#{plugin_path}/generators"
        m.directory "#{plugin_path}/generators/#{file_name}"
        m.directory "#{plugin_path}/generators/#{file_name}/templates"

        m.template 'generator.rb', "#{plugin_path}/generators/#{file_name}/#{file_name}_generator.rb"
        m.template 'USAGE',        "#{plugin_path}/generators/#{file_name}/USAGE"
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rails-1.1.1 lib/rails_generator/generators/components/plugin/plugin_generator.rb
rails-1.1.0 lib/rails_generator/generators/components/plugin/plugin_generator.rb
rails-1.1.3 lib/rails_generator/generators/components/plugin/plugin_generator.rb
rails-1.1.2 lib/rails_generator/generators/components/plugin/plugin_generator.rb
rails-1.1.6 lib/rails_generator/generators/components/plugin/plugin_generator.rb
rails-1.1.5 lib/rails_generator/generators/components/plugin/plugin_generator.rb
rails-1.1.4 lib/rails_generator/generators/components/plugin/plugin_generator.rb