##// END OF EJS Templates
Renames template ruby files to erb....
Jean-Philippe Lang -
r1949:738fc579f0dc
parent child
Show More
@@ -15,4 +15,40 class RedminePluginControllerGenerator < ControllerGenerator
15 def destination_root
15 def destination_root
16 File.join(RAILS_ROOT, plugin_path)
16 File.join(RAILS_ROOT, plugin_path)
17 end
17 end
18
19 def manifest
20 record do |m|
21 # Check for class naming collisions.
22 m.class_collisions class_path, "#{class_name}Controller", "#{class_name}ControllerTest", "#{class_name}Helper"
23
24 # Controller, helper, views, and test directories.
25 m.directory File.join('app/controllers', class_path)
26 m.directory File.join('app/helpers', class_path)
27 m.directory File.join('app/views', class_path, file_name)
28 m.directory File.join('test/functional', class_path)
29
30 # Controller class, functional test, and helper class.
31 m.template 'controller.rb.erb',
32 File.join('app/controllers',
33 class_path,
34 "#{file_name}_controller.rb")
35
36 m.template 'functional_test.rb.erb',
37 File.join('test/functional',
38 class_path,
39 "#{file_name}_controller_test.rb")
40
41 m.template 'helper.rb.erb',
42 File.join('app/helpers',
43 class_path,
44 "#{file_name}_helper.rb")
45
46 # View template for each action.
47 actions.each do |action|
48 path = File.join('app/views', class_path, file_name, "#{action}.html.erb")
49 m.template 'view.html.erb', path,
50 :assigns => { :action => action, :path => path }
51 end
52 end
53 end
18 end
54 end
1 NO CONTENT: file renamed from lib/generators/redmine_plugin_controller/templates/controller.rb to lib/generators/redmine_plugin_controller/templates/controller.rb.erb
NO CONTENT: file renamed from lib/generators/redmine_plugin_controller/templates/controller.rb to lib/generators/redmine_plugin_controller/templates/controller.rb.erb
1 NO CONTENT: file renamed from lib/generators/redmine_plugin_controller/templates/functional_test.rb to lib/generators/redmine_plugin_controller/templates/functional_test.rb.erb
NO CONTENT: file renamed from lib/generators/redmine_plugin_controller/templates/functional_test.rb to lib/generators/redmine_plugin_controller/templates/functional_test.rb.erb
1 NO CONTENT: file renamed from lib/generators/redmine_plugin_controller/templates/helper.rb to lib/generators/redmine_plugin_controller/templates/helper.rb.erb
NO CONTENT: file renamed from lib/generators/redmine_plugin_controller/templates/helper.rb to lib/generators/redmine_plugin_controller/templates/helper.rb.erb
@@ -15,4 +15,30 class RedminePluginModelGenerator < ModelGenerator
15 def destination_root
15 def destination_root
16 File.join(RAILS_ROOT, plugin_path)
16 File.join(RAILS_ROOT, plugin_path)
17 end
17 end
18
19 def manifest
20 record do |m|
21 # Check for class naming collisions.
22 m.class_collisions class_path, class_name, "#{class_name}Test"
23
24 # Model, test, and fixture directories.
25 m.directory File.join('app/models', class_path)
26 m.directory File.join('test/unit', class_path)
27 m.directory File.join('test/fixtures', class_path)
28
29 # Model class, unit test, and fixtures.
30 m.template 'model.rb.erb', File.join('app/models', class_path, "#{file_name}.rb")
31 m.template 'unit_test.rb.erb', File.join('test/unit', class_path, "#{file_name}_test.rb")
32
33 unless options[:skip_fixture]
34 m.template 'fixtures.yml', File.join('test/fixtures', "#{table_name}.yml")
35 end
36
37 unless options[:skip_migration]
38 m.migration_template 'migration.rb.erb', 'db/migrate', :assigns => {
39 :migration_name => "Create#{class_name.pluralize.gsub(/::/, '')}"
40 }, :migration_file_name => "create_#{file_path.gsub(/\//, '_').pluralize}"
41 end
42 end
43 end
18 end
44 end
1 NO CONTENT: file renamed from lib/generators/redmine_plugin_model/templates/migration.rb to lib/generators/redmine_plugin_model/templates/migration.rb.erb
NO CONTENT: file renamed from lib/generators/redmine_plugin_model/templates/migration.rb to lib/generators/redmine_plugin_model/templates/migration.rb.erb
1 NO CONTENT: file renamed from lib/generators/redmine_plugin_model/templates/model.rb to lib/generators/redmine_plugin_model/templates/model.rb.erb
NO CONTENT: file renamed from lib/generators/redmine_plugin_model/templates/model.rb to lib/generators/redmine_plugin_model/templates/model.rb.erb
1 NO CONTENT: file renamed from lib/generators/redmine_plugin_model/templates/unit_test.rb to lib/generators/redmine_plugin_model/templates/unit_test.rb.erb
NO CONTENT: file renamed from lib/generators/redmine_plugin_model/templates/unit_test.rb to lib/generators/redmine_plugin_model/templates/unit_test.rb.erb
General Comments 0
You need to be logged in to leave comments. Login now