Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added the Rails 3 generator

  • Loading branch information...
commit 421eaa02f044caaeede55af1a9aea5f5aa9f59e6 1 parent f39eb22
Paul Engel authored
View
22 lib/generators/enrichments/enrichments_generator.rb
@@ -0,0 +1,22 @@
+class EnrichmentsGenerator < Rails::Generators::Base
+
+ desc "Creates entities used by Enrichments (e9s)"
+ class_option :user_model , :type => :string , :default => "User" , :aliases => "-u" , :desc => "The name of the Authlogic user model."
+ class_option :content_model , :type => :string , :default => "CmsContent" , :aliases => "-c" , :desc => "The name of the CMS content model."
+ class_option :translation_model, :type => :string , :default => "Translation", :aliases => "-t" , :desc => "The name of the I18n translation model."
+ class_option :migrate , :type => :boolean, :default => false , :aliases => "-m" , :desc => "Run 'rake db:migrate' after generating model and migration"
+
+ def generate_rich_cms_files
+ generate "rich:authlogic_user", options[:user_model]
+ generate "rich:cms_content", options[:content_model]
+ end
+
+ def generate_rich_i18n_files
+ generate "rich:translation", options[:translation_model]
+ end
+
+ def migrate
+ rake "db:migrate" if options[:migrate]
+ end
+
+end
View
20 rails_generators/enrichments/enrichments_generator.rb
@@ -20,26 +20,6 @@ def after_generate
system "rake db:migrate" if options[:migrate]
end
- def model_file_name
- @name.underscore
- end
-
- def model_class_name
- @name.classify
- end
-
- def table_name
- model_file_name.gsub("/", "_").pluralize
- end
-
- def migration_file_name
- "create_#{table_name}"
- end
-
- def migration_class_name
- migration_file_name.camelize
- end
-
protected
def add_options!(opt)
Please sign in to comment.
Something went wrong with that request. Please try again.