From 9fffdc5cdb80b1824473a6d7ae1fedf9e74aa748 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Mon, 18 Jan 2010 13:44:32 +0100 Subject: Generators load path now will be Ruby load path. If you want to use rspec:install generator, you need generators/rspec/install_generator in your load path. --- .../lib/generators/erb/mailer/mailer_generator.rb | 20 ++++++++++++++++++++ .../lib/generators/erb/mailer/templates/view.erb | 3 +++ 2 files changed, 23 insertions(+) create mode 100644 railties/lib/generators/erb/mailer/mailer_generator.rb create mode 100644 railties/lib/generators/erb/mailer/templates/view.erb (limited to 'railties/lib/generators/erb/mailer') diff --git a/railties/lib/generators/erb/mailer/mailer_generator.rb b/railties/lib/generators/erb/mailer/mailer_generator.rb new file mode 100644 index 0000000000..4ec2f4c9f4 --- /dev/null +++ b/railties/lib/generators/erb/mailer/mailer_generator.rb @@ -0,0 +1,20 @@ +require 'generators/erb' + +module Erb + module Generators + class MailerGenerator < Base + argument :actions, :type => :array, :default => [], :banner => "method method" + + def create_view_folder + empty_directory File.join("app/views", file_path) + end + + def create_view_files + actions.each do |action| + @action, @path = action, File.join(file_path, action) + template "view.erb", File.join("app/views", "#{@path}.erb") + end + end + end + end +end diff --git a/railties/lib/generators/erb/mailer/templates/view.erb b/railties/lib/generators/erb/mailer/templates/view.erb new file mode 100644 index 0000000000..fcce7bd805 --- /dev/null +++ b/railties/lib/generators/erb/mailer/templates/view.erb @@ -0,0 +1,3 @@ +<%= class_name %>#<%= @action %> + +Find me in app/views/<%= @path %> -- cgit v1.2.3