Class: PluginGenerator
- Inherits:
-
Rails::Generator::NamedBase
- Object
- Rails::Generator::Base
- Rails::Generator::NamedBase
- PluginGenerator
- Defined in:
- lib/rails_generator/generators/components/plugin/plugin_generator.rb
Instance Attribute Summary collapse
-
#plugin_path ⇒ Object
readonly
Returns the value of attribute plugin_path.
Attributes inherited from Rails::Generator::NamedBase
#class_name, #class_nesting, #class_nesting_depth, #class_path, #file_path, #name, #plural_name, #singular_name, #table_name
Attributes inherited from Rails::Generator::Base
#args, #destination_root, #source_root
Attributes included from Rails::Generator::Options
Instance Method Summary collapse
-
#initialize(runtime_args, runtime_options = {}) ⇒ PluginGenerator
constructor
A new instance of PluginGenerator.
- #manifest ⇒ Object
Methods inherited from Rails::Generator::Base
#destination_path, #source_path
Methods included from Rails::Generator::Options
Constructor Details
#initialize(runtime_args, runtime_options = {}) ⇒ PluginGenerator
Returns a new instance of PluginGenerator.
4 5 6 7 8 |
# File 'lib/rails_generator/generators/components/plugin/plugin_generator.rb', line 4 def initialize(runtime_args, = {}) @with_generator = runtime_args.delete("--with-generator") super @plugin_path = "vendor/plugins/#{file_name}" end |
Instance Attribute Details
#plugin_path ⇒ Object (readonly)
Returns the value of attribute plugin_path.
2 3 4 |
# File 'lib/rails_generator/generators/components/plugin/plugin_generator.rb', line 2 def plugin_path @plugin_path end |
Instance Method Details
#manifest ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/rails_generator/generators/components/plugin/plugin_generator.rb', line 10 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 |