comparison .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
comparison
equal deleted inserted replaced
1294:3e4c3460b6ca 1295:622f24f53b42
1 class RedminePluginControllerGenerator < Rails::Generators::NamedBase
2 source_root File.expand_path("../templates", __FILE__)
3 argument :controller, :type => :string
4 argument :actions, :type => :array, :default => [], :banner => "ACTION ACTION ..."
5
6 attr_reader :plugin_path, :plugin_name, :plugin_pretty_name
7
8 def initialize(*args)
9 super
10 @plugin_name = file_name.underscore
11 @plugin_pretty_name = plugin_name.titleize
12 @plugin_path = "plugins/#{plugin_name}"
13 @controller_class = controller.camelize
14 end
15
16 def copy_templates
17 template 'controller.rb.erb', "#{plugin_path}/app/controllers/#{controller}_controller.rb"
18 template 'helper.rb.erb', "#{plugin_path}/app/helpers/#{controller}_helper.rb"
19 template 'functional_test.rb.erb', "#{plugin_path}/test/functional/#{controller}_controller_test.rb"
20 # View template for each action.
21 actions.each do |action|
22 path = "#{plugin_path}/app/views/#{controller}/#{action}.html.erb"
23 @action_name = action
24 template 'view.html.erb', path
25 end
26 end
27 end