Class: Tnw::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Tnw::Generators::InstallGenerator
- Defined in:
- lib/generators/tnw/install/install_generator.rb
Instance Method Summary collapse
Instance Method Details
#copy_migrations ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/generators/tnw/install/install_generator.rb', line 19 def copy_migrations migration_sources.each_with_index do |source, index| migration_name = File.basename(source).sub(/\A\d+_/, "") next if migration_installed?(migration_name) = (Time.now.utc + index.seconds).strftime("%Y%m%d%H%M%S") copy_file source, "db/migrate/#{}_#{migration_name}" end end |
#create_initializer ⇒ Object
8 9 10 |
# File 'lib/generators/tnw/install/install_generator.rb', line 8 def create_initializer template "tnw.rb", "config/initializers/tnw.rb" end |
#mount_engine ⇒ Object
12 13 14 15 16 17 |
# File 'lib/generators/tnw/install/install_generator.rb', line 12 def mount_engine routes_path = destination_root_path.join("config/routes.rb") return if routes_path.exist? && routes_path.read.include?("mount Tnw::Engine") route 'mount Tnw::Engine => "/tnw"' end |