Permalink
Browse files

Add generators.

  • Loading branch information...
josevalim committed May 26, 2010
1 parent 5e815e1 commit a95a9b8abdaeac2067241cfef2742619221b47f0
Showing with 34 additions and 1 deletion.
  1. +5 −0 CHANGELOG
  2. +17 −0 lib/generators/rails/mail_form_generator.rb
  3. +9 −0 lib/generators/rails/templates/model.rb
  4. +3 −1 mail_form.gemspec
View
@@ -1,3 +1,8 @@
+# Version 1.3
+
+* Removed deprecated methods in version 1.2.
+* Added persisted? header and a generator.
+
# Version 1.2
* No more class attributes, just define a headers method
@@ -0,0 +1,17 @@
+module Rails
+ module Generators
+ class MailFormGenerator < Rails::Generators::NamedBase
+ def self.source_root
+ @_mail_form_source_root ||= File.expand_path("../templates", __FILE__)
+ end
+
+ argument :attributes, :type => :array, :default => [], :banner => "field:type field:type"
+
+ check_class_collision
+
+ def create_model_file
+ template 'model.rb', File.join('app/models', class_path, "#{file_name}.rb")
+ end
+ end
+ end
+end
@@ -0,0 +1,9 @@
+class <%= class_name %> < MailForm::Base
+<% attributes.each do |attribute| -%>
+ attribute :<%= attribute.name %>
+<% end -%>
+
+ def headers
+ { :to => "PLEASE-CHANGE-ME@example.org" }
+ end
+end
View
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Jos\303\251 Valim", "Carlos Ant\303\264nio"]
- s.date = %q{2010-04-03}
+ s.date = %q{2010-05-26}
s.description = %q{Send e-mail straight from forms in Rails with I18n, validations, attachments and request information.}
s.email = %q{contact@plataformatec.com.br}
s.extra_rdoc_files = [
@@ -20,6 +20,8 @@ Gem::Specification.new do |s|
"MIT-LICENSE",
"README.rdoc",
"Rakefile",
+ "lib/generators/rails/mail_form_generator.rb",
+ "lib/generators/rails/templates/model.rb",
"lib/mail_form.rb",
"lib/mail_form/base.rb",
"lib/mail_form/delivery.rb",

0 comments on commit a95a9b8

Please sign in to comment.