Class: Spleen::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Spleen::Generators::InstallGenerator
- Includes:
- Rails::Generators::Migration
- Defined in:
- lib/generators/spleen/install_generator.rb
Class Method Summary collapse
-
.next_migration_number(dirname) ⇒ Object
Taken from ActiveRecord’s migration generator.
Instance Method Summary collapse
Class Method Details
.next_migration_number(dirname) ⇒ Object
Taken from ActiveRecord’s migration generator
30 31 32 33 34 35 36 |
# File 'lib/generators/spleen/install_generator.rb', line 30 def self.next_migration_number(dirname) #:nodoc: if ActiveRecord::Base. Time.now.utc.strftime("%Y%m%d%H%M%S") else "%.3d" % (current_migration_number(dirname) + 1) end end |
Instance Method Details
#copy_locale ⇒ Object
13 14 15 |
# File 'lib/generators/spleen/install_generator.rb', line 13 def copy_locale copy_file "locales.en.yml", "config/locales/ratings.en.yml" end |
#copy_model ⇒ Object
17 18 19 |
# File 'lib/generators/spleen/install_generator.rb', line 17 def copy_model template "model.rb", "app/models/rating.rb" end |
#copy_rating_migration ⇒ Object
21 22 23 |
# File 'lib/generators/spleen/install_generator.rb', line 21 def migration_template "migration.rb", "db/migrate/create_ratings" end |
#show_readme ⇒ Object
25 26 27 |
# File 'lib/generators/spleen/install_generator.rb', line 25 def show_readme readme "README" if behavior == :invoke end |