Mercurial > hg > soundsoftware-site
diff .svn/pristine/3e/3e339092f343524c6085cf1a81f2c664a0ae64ee.svn-base @ 1295:622f24f53b42 redmine-2.3
Update to Redmine SVN revision 11972 on 2.3-stable branch
author | Chris Cannam |
---|---|
date | Fri, 14 Jun 2013 09:02:21 +0100 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.svn/pristine/3e/3e339092f343524c6085cf1a81f2c664a0ae64ee.svn-base Fri Jun 14 09:02:21 2013 +0100 @@ -0,0 +1,27 @@ +class RedminePluginControllerGenerator < Rails::Generators::NamedBase + source_root File.expand_path("../templates", __FILE__) + argument :controller, :type => :string + argument :actions, :type => :array, :default => [], :banner => "ACTION ACTION ..." + + attr_reader :plugin_path, :plugin_name, :plugin_pretty_name + + def initialize(*args) + super + @plugin_name = file_name.underscore + @plugin_pretty_name = plugin_name.titleize + @plugin_path = "plugins/#{plugin_name}" + @controller_class = controller.camelize + end + + def copy_templates + template 'controller.rb.erb', "#{plugin_path}/app/controllers/#{controller}_controller.rb" + template 'helper.rb.erb', "#{plugin_path}/app/helpers/#{controller}_helper.rb" + template 'functional_test.rb.erb', "#{plugin_path}/test/functional/#{controller}_controller_test.rb" + # View template for each action. + actions.each do |action| + path = "#{plugin_path}/app/views/#{controller}/#{action}.html.erb" + @action_name = action + template 'view.html.erb', path + end + end +end