Class: AchievableGenerator
- Inherits:
-
Rails::Generators::NamedBase
- Object
- Rails::Generators::NamedBase
- AchievableGenerator
- Includes:
- Rails::Generators::Migration
- Defined in:
- lib/generators/achievable_generator.rb
Class Method Summary collapse
Instance Method Summary collapse
- #add_application_config ⇒ Object
- #copy_achievable_models ⇒ Object
- #manifest ⇒ Object
- #set_up_achiever ⇒ Object
Class Method Details
.next_migration_number(path) ⇒ Object
29 30 31 |
# File 'lib/generators/achievable_generator.rb', line 29 def self.next_migration_number(path) Time.now.utc.strftime("%Y%m%d%H%M%S") end |
Instance Method Details
#add_application_config ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/generators/achievable_generator.rb', line 12 def add_application_config inject_into_class "config/application.rb", "Application", <<-CONTENT # Set achievable resque config.achievable.resque_enable = false CONTENT end |
#copy_achievable_models ⇒ Object
24 25 26 27 |
# File 'lib/generators/achievable_generator.rb', line 24 def copy_achievable_models template "achievement.rb", "app/models/achievement.rb" template "achieving.rb", "app/models/achieving.rb" end |
#manifest ⇒ Object
20 21 22 |
# File 'lib/generators/achievable_generator.rb', line 20 def manifest migration_template 'migration.rb', 'db/migrate/achievable_migration' end |
#set_up_achiever ⇒ Object
6 7 8 9 10 |
# File 'lib/generators/achievable_generator.rb', line 6 def set_up_achiever inject_into_class "app/models/#{file_name}.rb", class_name, <<-CONTENT include Achievable::Achiever CONTENT end |