Class: Redmine::Generators::PluginGenerator
- Inherits:
-
Rails::Generators::NamedBase
- Object
- Rails::Generators::NamedBase
- Redmine::Generators::PluginGenerator
- Defined in:
- lib/redmine/generators/plugin_generator.rb
Instance Method Summary collapse
- #app_folders ⇒ Object
- #config ⇒ Object
- #create_root ⇒ Object
- #gemfile ⇒ Object
- #init_rb ⇒ Object
-
#initialize(args = [], options = {}, config = {}) ⇒ PluginGenerator
constructor
A new instance of PluginGenerator.
- #locales ⇒ Object
- #plugin_lib ⇒ Object
- #routes ⇒ Object
- #translations ⇒ Object
Constructor Details
#initialize(args = [], options = {}, config = {}) ⇒ PluginGenerator
Returns a new instance of PluginGenerator.
51 52 53 54 55 56 57 58 |
# File 'lib/redmine/generators/plugin_generator.rb', line 51 def initialize(args = [], = {}, config = {}) args[0] = ideal_plugin_name(args[0]) if config[:behavior] == :invoke super args, , config if ideal_plugin_path.exist? && behavior == :invoke raise "Plugin #{name} already exists." end self.destination_root = ideal_plugin_path end |
Instance Method Details
#app_folders ⇒ Object
39 40 41 42 43 44 45 |
# File 'lib/redmine/generators/plugin_generator.rb', line 39 def app_folders empty_directory "app" empty_directory_with_gitkeep "app/models" empty_directory_with_gitkeep "app/controllers" empty_directory_with_gitkeep "app/helpers" empty_directory_with_gitkeep "app/views" end |
#config ⇒ Object
16 17 18 |
# File 'lib/redmine/generators/plugin_generator.rb', line 16 def config empty_directory "config" end |
#create_root ⇒ Object
8 9 10 |
# File 'lib/redmine/generators/plugin_generator.rb', line 8 def create_root empty_directory '.' end |
#gemfile ⇒ Object
47 48 49 |
# File 'lib/redmine/generators/plugin_generator.rb', line 47 def gemfile template "Gemfile" end |
#init_rb ⇒ Object
12 13 14 |
# File 'lib/redmine/generators/plugin_generator.rb', line 12 def init_rb template "init.rb" end |
#locales ⇒ Object
24 25 26 |
# File 'lib/redmine/generators/plugin_generator.rb', line 24 def locales empty_directory "config/locales" end |
#plugin_lib ⇒ Object
32 33 34 35 36 37 |
# File 'lib/redmine/generators/plugin_generator.rb', line 32 def plugin_lib empty_directory "lib" empty_directory "lib/#{name}" template "plugin.rb", "lib/#{name}.rb" template "version.rb", "lib/#{name}/version.rb" end |
#routes ⇒ Object
20 21 22 |
# File 'lib/redmine/generators/plugin_generator.rb', line 20 def routes template "routes.rb", "config/routes.rb" end |
#translations ⇒ Object
28 29 30 |
# File 'lib/redmine/generators/plugin_generator.rb', line 28 def translations template "en.yml", "config/locales/en.yml" end |