Sha256: ee14d0237372ccf3adfd7a2c6fc7c9110eae8eca6751b18dab1fe01a6c5c6b89

Contents?: true

Size: 1.08 KB

Versions: 42

Compression:

Stored size: 1.08 KB

Contents

require 'rails/generators/rails/generator/generator_generator'

module Rails
  module Generators
    class PluginGenerator < NamedBase
      class_option :tasks, :desc => "When supplied creates tasks base files."

      check_class_collision

      def create_root_files
        directory '.', plugin_dir, :recursive => false
      end

      def create_lib_files
        directory 'lib', plugin_dir('lib'), :recursive => false
      end

      def create_tasks_files
        return unless options[:tasks]
        directory 'lib/tasks', plugin_dir('lib/tasks')
      end

      hook_for :generator do |generator|
        inside plugin_dir, :verbose => true do
          invoke generator, [ name ], :namespace => false
        end
      end

      hook_for :test_framework do |test_framework|
        inside plugin_dir, :verbose => true do
          invoke test_framework
        end
      end

      protected

        def plugin_dir(join=nil)
          if join
            File.join(plugin_dir, join)
          else
            "vendor/plugins/#{file_name}"
          end
        end

    end
  end
end

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
railties-3.0.20 lib/rails/generators/rails/plugin/plugin_generator.rb
railties-3.0.19 lib/rails/generators/rails/plugin/plugin_generator.rb
railties-3.0.18 lib/rails/generators/rails/plugin/plugin_generator.rb
railties-3.0.17 lib/rails/generators/rails/plugin/plugin_generator.rb
railties-3.0.16 lib/rails/generators/rails/plugin/plugin_generator.rb
railties-3.0.15 lib/rails/generators/rails/plugin/plugin_generator.rb
railties-3.0.14 lib/rails/generators/rails/plugin/plugin_generator.rb
railties-3.0.13 lib/rails/generators/rails/plugin/plugin_generator.rb
railties-3.0.13.rc1 lib/rails/generators/rails/plugin/plugin_generator.rb
railties-3.0.12 lib/rails/generators/rails/plugin/plugin_generator.rb
railties-3.0.12.rc1 lib/rails/generators/rails/plugin/plugin_generator.rb
railties-3.0.11 lib/rails/generators/rails/plugin/plugin_generator.rb
railties-3.0.10 lib/rails/generators/rails/plugin/plugin_generator.rb
railties-3.0.10.rc1 lib/rails/generators/rails/plugin/plugin_generator.rb
railties-3.0.9 lib/rails/generators/rails/plugin/plugin_generator.rb
railties-3.0.9.rc5 lib/rails/generators/rails/plugin/plugin_generator.rb
railties-3.0.9.rc4 lib/rails/generators/rails/plugin/plugin_generator.rb
railties-3.0.9.rc3 lib/rails/generators/rails/plugin/plugin_generator.rb
railties-3.0.9.rc1 lib/rails/generators/rails/plugin/plugin_generator.rb
railties-3.0.8 lib/rails/generators/rails/plugin/plugin_generator.rb