Merged updates from trunk into stable branch
[feedcatcher.git] / vendor / rails / railties / lib / rails_generator / generators / components / controller / controller_generator.rb
1 class ControllerGenerator < Rails::Generator::NamedBase
2 def manifest
3 record do |m|
4 # Check for class naming collisions.
5 m.class_collisions "#{class_name}Controller", "#{class_name}ControllerTest", "#{class_name}Helper", "#{class_name}HelperTest"
6
7 # Controller, helper, views, and test directories.
8 m.directory File.join('app/controllers', class_path)
9 m.directory File.join('app/helpers', class_path)
10 m.directory File.join('app/views', class_path, file_name)
11 m.directory File.join('test/functional', class_path)
12 m.directory File.join('test/unit/helpers', class_path)
13
14 # Controller class, functional test, and helper class.
15 m.template 'controller.rb',
16 File.join('app/controllers',
17 class_path,
18 "#{file_name}_controller.rb")
19
20 m.template 'functional_test.rb',
21 File.join('test/functional',
22 class_path,
23 "#{file_name}_controller_test.rb")
24
25 m.template 'helper.rb',
26 File.join('app/helpers',
27 class_path,
28 "#{file_name}_helper.rb")
29
30 m.template 'helper_test.rb',
31 File.join('test/unit/helpers',
32 class_path,
33 "#{file_name}_helper_test.rb")
34
35 # View template for each action.
36 actions.each do |action|
37 path = File.join('app/views', class_path, file_name, "#{action}.html.erb")
38 m.template 'view.html.erb', path,
39 :assigns => { :action => action, :path => path }
40 end
41 end
42 end
43 end