Froze rails gems
[depot.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"
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
13 # Controller class, functional test, and helper class.
14 m.template 'controller.rb',
15 File.join('app/controllers',
16 class_path,
17 "#{file_name}_controller.rb")
18
19 m.template 'functional_test.rb',
20 File.join('test/functional',
21 class_path,
22 "#{file_name}_controller_test.rb")
23
24 m.template 'helper.rb',
25 File.join('app/helpers',
26 class_path,
27 "#{file_name}_helper.rb")
28
29 # View template for each action.
30 actions.each do |action|
31 path = File.join('app/views', class_path, file_name, "#{action}.html.erb")
32 m.template 'view.html.erb', path,
33 :assigns => { :action => action, :path => path }
34 end
35 end
36 end
37 end