Class: Shrew::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Shrew::Generators::InstallGenerator
- Includes:
- Rails::Generators::Migration
- Defined in:
- lib/generators/shrew/install_generator.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.next_migration_number(path) ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/generators/shrew/install_generator.rb', line 21 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_routes ⇒ Object
17 18 19 |
# File 'lib/generators/shrew/install_generator.rb', line 17 def add_routes route "mount Shrew::Engine => '/shrew', as: 'shrew'" end |
#copy_initializer ⇒ Object
9 10 11 |
# File 'lib/generators/shrew/install_generator.rb', line 9 def copy_initializer template 'shrew.rb', 'config/initializers/shrew.rb' end |
#copy_migration ⇒ Object
13 14 15 |
# File 'lib/generators/shrew/install_generator.rb', line 13 def copy_migration migration_template 'page_view_migration.rb', 'db/migrate/add_shrew_page_view_table.rb' end |