Froze rails gems
[depot.git] / vendor / rails / railties / lib / rails_generator / generators / components / mailer / mailer_generator.rb
1 class MailerGenerator < Rails::Generator::NamedBase
2 def manifest
3 record do |m|
4 # Check for class naming collisions.
5 m.class_collisions class_name, "#{class_name}Test"
6
7 # Mailer, view, test, and fixture directories.
8 m.directory File.join('app/models', class_path)
9 m.directory File.join('app/views', file_path)
10 m.directory File.join('test/unit', class_path)
11 m.directory File.join('test/fixtures', file_path)
12
13 # Mailer class and unit test.
14 m.template "mailer.rb", File.join('app/models', class_path, "#{file_name}.rb")
15 m.template "unit_test.rb", File.join('test/unit', class_path, "#{file_name}_test.rb")
16
17 # View template and fixture for each action.
18 actions.each do |action|
19 relative_path = File.join(file_path, action)
20 view_path = File.join('app/views', "#{relative_path}.erb")
21 fixture_path = File.join('test/fixtures', relative_path)
22
23 m.template "view.erb", view_path,
24 :assigns => { :action => action, :path => view_path }
25 m.template "fixture.erb", fixture_path,
26 :assigns => { :action => action, :path => view_path }
27 end
28 end
29 end
30 end