diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-10-25 09:35:51 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-10-25 09:35:51 +0000 |
commit | 738fc579f0dc95aad9ab0dedc65fbce7af0bb980 (patch) | |
tree | b3b5d7a8cdd3825323a6301ba3885ad8cc236fab /lib/generators/redmine_plugin_controller | |
parent | 0316fde06bb8892589ac83c387789db22ee29614 (diff) | |
download | redmine-738fc579f0dc95aad9ab0dedc65fbce7af0bb980.tar.gz redmine-738fc579f0dc95aad9ab0dedc65fbce7af0bb980.zip |
Renames template ruby files to erb.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@1951 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib/generators/redmine_plugin_controller')
-rw-r--r-- | lib/generators/redmine_plugin_controller/redmine_plugin_controller_generator.rb | 36 | ||||
-rw-r--r-- | lib/generators/redmine_plugin_controller/templates/controller.rb.erb (renamed from lib/generators/redmine_plugin_controller/templates/controller.rb) | 0 | ||||
-rw-r--r-- | lib/generators/redmine_plugin_controller/templates/functional_test.rb.erb (renamed from lib/generators/redmine_plugin_controller/templates/functional_test.rb) | 0 | ||||
-rw-r--r-- | lib/generators/redmine_plugin_controller/templates/helper.rb.erb (renamed from lib/generators/redmine_plugin_controller/templates/helper.rb) | 0 |
4 files changed, 36 insertions, 0 deletions
diff --git a/lib/generators/redmine_plugin_controller/redmine_plugin_controller_generator.rb b/lib/generators/redmine_plugin_controller/redmine_plugin_controller_generator.rb index 533d65ce8..efe28c5da 100644 --- a/lib/generators/redmine_plugin_controller/redmine_plugin_controller_generator.rb +++ b/lib/generators/redmine_plugin_controller/redmine_plugin_controller_generator.rb @@ -15,4 +15,40 @@ class RedminePluginControllerGenerator < ControllerGenerator def destination_root File.join(RAILS_ROOT, plugin_path) end + + def manifest + record do |m| + # Check for class naming collisions. + m.class_collisions class_path, "#{class_name}Controller", "#{class_name}ControllerTest", "#{class_name}Helper" + + # Controller, helper, views, and test directories. + m.directory File.join('app/controllers', class_path) + m.directory File.join('app/helpers', class_path) + m.directory File.join('app/views', class_path, file_name) + m.directory File.join('test/functional', class_path) + + # Controller class, functional test, and helper class. + m.template 'controller.rb.erb', + File.join('app/controllers', + class_path, + "#{file_name}_controller.rb") + + m.template 'functional_test.rb.erb', + File.join('test/functional', + class_path, + "#{file_name}_controller_test.rb") + + m.template 'helper.rb.erb', + File.join('app/helpers', + class_path, + "#{file_name}_helper.rb") + + # View template for each action. + actions.each do |action| + path = File.join('app/views', class_path, file_name, "#{action}.html.erb") + m.template 'view.html.erb', path, + :assigns => { :action => action, :path => path } + end + end + end end diff --git a/lib/generators/redmine_plugin_controller/templates/controller.rb b/lib/generators/redmine_plugin_controller/templates/controller.rb.erb index 615986d9e..615986d9e 100644 --- a/lib/generators/redmine_plugin_controller/templates/controller.rb +++ b/lib/generators/redmine_plugin_controller/templates/controller.rb.erb diff --git a/lib/generators/redmine_plugin_controller/templates/functional_test.rb b/lib/generators/redmine_plugin_controller/templates/functional_test.rb.erb index 876bd79e2..876bd79e2 100644 --- a/lib/generators/redmine_plugin_controller/templates/functional_test.rb +++ b/lib/generators/redmine_plugin_controller/templates/functional_test.rb.erb diff --git a/lib/generators/redmine_plugin_controller/templates/helper.rb b/lib/generators/redmine_plugin_controller/templates/helper.rb.erb index 3fe2ecdc7..3fe2ecdc7 100644 --- a/lib/generators/redmine_plugin_controller/templates/helper.rb +++ b/lib/generators/redmine_plugin_controller/templates/helper.rb.erb |