Class: Omnom::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Omnom::Generators::InstallGenerator
- Includes:
- Rails::Generators::Migration
- Defined in:
- lib/generators/omnom/install/install_generator.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.next_migration_number(path) ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/generators/omnom/install/install_generator.rb', line 10 def self.next_migration_number(path) unless @prev_migration_nr @prev_migration_nr = Time.now.utc.strftime('%Y%m%d%H%M%S').to_i else @prev_migration_nr += 1 end @prev_migration_nr.to_s end |
Instance Method Details
#add_config_lines ⇒ Object
26 27 28 29 |
# File 'lib/generators/omnom/install/install_generator.rb', line 26 def add_config_lines inject_into_file 'config/application.rb', "\n config.from_file 'omnom.yml'\n\n", after: "Rails::Application\n" inject_into_file 'config/routes.rb', "\n mount Omnom::Engine => '/'\n\n", after: "Application.routes.draw do\n" end |
#install_config_files ⇒ Object
20 21 22 23 |
# File 'lib/generators/omnom/install/install_generator.rb', line 20 def install_config_files copy_file 'config/omnom.yml', 'config/omnom.yml' copy_file 'config/omnom.local.example.yml', 'config/omnom.local.example.yml' end |
#install_migrations ⇒ Object
32 33 34 35 |
# File 'lib/generators/omnom/install/install_generator.rb', line 32 def install_migrations migration_template 'db/migrate/create_omnom_posts.rb', 'db/migrate/create_omnom_posts.rb' migration_template 'db/migrate/create_omnom_posts_origins.rb', 'db/migrate/create_omnom_posts_origins.rb' end |