Sha256: d78370f10a82dabe3b901e3067305697dac32417deede928d6c36cdcf233ff97

Contents?: true

Size: 1.49 KB

Versions: 80

Compression:

Stored size: 1.49 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|
      # Check for class naming collisions.
      m.class_collisions class_path, class_name

      m.directory "#{plugin_path}/lib"
      m.directory "#{plugin_path}/tasks"
      m.directory "#{plugin_path}/test"

      m.template 'README',        "#{plugin_path}/README"
      m.template 'MIT-LICENSE',   "#{plugin_path}/MIT-LICENSE"
      m.template 'Rakefile',      "#{plugin_path}/Rakefile"
      m.template 'init.rb',       "#{plugin_path}/init.rb"
      m.template 'install.rb',    "#{plugin_path}/install.rb"
      m.template 'uninstall.rb',  "#{plugin_path}/uninstall.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

80 entries across 80 versions & 7 rubygems

Version Path
radiant-0.7.2 vendor/rails/railties/lib/rails_generator/generators/components/plugin/plugin_generator.rb
vibes-bj-1.2.2 spec/rails_root/vendor/rails/railties/lib/rails_generator/generators/components/plugin/plugin_generator.rb
vibes-bj-1.2.1 spec/rails_root/vendor/rails/railties/lib/rails_generator/generators/components/plugin/plugin_generator.rb
antfarm-0.3.0 rails/vendor/rails/railties/lib/rails_generator/generators/components/plugin/plugin_generator.rb
antfarm-0.4.0 rails/vendor/rails/railties/lib/rails_generator/generators/components/plugin/plugin_generator.rb
backlog-0.0.0 vendor/rails/railties/lib/rails_generator/generators/components/plugin/plugin_generator.rb
backlog-0.0.1 vendor/rails/railties/lib/rails_generator/generators/components/plugin/plugin_generator.rb
backlog-0.0.2 vendor/rails/railties/lib/rails_generator/generators/components/plugin/plugin_generator.rb
backlog-0.0.5 vendor/rails/railties/lib/rails_generator/generators/components/plugin/plugin_generator.rb
backlog-0.0.4 vendor/rails/railties/lib/rails_generator/generators/components/plugin/plugin_generator.rb
backlog-0.1.1 vendor/rails/railties/lib/rails_generator/generators/components/plugin/plugin_generator.rb
backlog-0.1.0 vendor/rails/railties/lib/rails_generator/generators/components/plugin/plugin_generator.rb
backlog-0.1.2 vendor/rails/railties/lib/rails_generator/generators/components/plugin/plugin_generator.rb
backlog-0.2.0 vendor/rails/railties/lib/rails_generator/generators/components/plugin/plugin_generator.rb
backlog-0.2.1 vendor/rails/railties/lib/rails_generator/generators/components/plugin/plugin_generator.rb
backlog-0.3.0 vendor/rails/railties/lib/rails_generator/generators/components/plugin/plugin_generator.rb
backlog-0.3.1 vendor/rails/railties/lib/rails_generator/generators/components/plugin/plugin_generator.rb
backlog-0.3.2 vendor/rails/railties/lib/rails_generator/generators/components/plugin/plugin_generator.rb
backlog-0.3.3 vendor/rails/railties/lib/rails_generator/generators/components/plugin/plugin_generator.rb
backlog-0.3.4 vendor/rails/railties/lib/rails_generator/generators/components/plugin/plugin_generator.rb