Class: ActiveConnect::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- ActiveConnect::InstallGenerator
- Includes:
- Rails::Generators::Migration
- Defined in:
- lib/generators/active_connect/install_generator.rb
Class Method Summary collapse
-
.next_migration_number(dirname) ⇒ Object
Implement the required interface for Rails::Generators::Migration.
Instance Method Summary collapse
Class Method Details
.next_migration_number(dirname) ⇒ Object
Implement the required interface for Rails::Generators::Migration.
11 12 13 14 15 16 17 18 |
# File 'lib/generators/active_connect/install_generator.rb', line 11 def self.next_migration_number(dirname) if @migration_number @migration_number += 1 else @migration_number = Time.now.utc.strftime("%Y%m%d%H%M%S").to_i end @migration_number.to_s end |
Instance Method Details
#add_require_to_application ⇒ Object
28 29 30 |
# File 'lib/generators/active_connect/install_generator.rb', line 28 def add_require_to_application inject_into_file Rails.root.join("config/application.rb"), "\nrequire 'active_connect'", after: "Bundler.require(*Rails.groups)" end |
#copy_migrations ⇒ Object
24 25 26 |
# File 'lib/generators/active_connect/install_generator.rb', line 24 def copy_migrations migration_template "create_active_connect_active_connect_data.rb", Rails.root.join("db/migrate/create_active_connect_active_connect_data.rb") end |
#copy_scrape_yml ⇒ Object
20 21 22 |
# File 'lib/generators/active_connect/install_generator.rb', line 20 def copy_scrape_yml template "connect.yml", Rails.root.join("config/connect.yml") end |