Class: AppManager::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- AppManager::Generators::InstallGenerator
- Includes:
- Rails::Generators::Migration
- Defined in:
- lib/generators/app_manager/install/install_generator.rb
Class Method Summary collapse
-
.next_migration_number(dir) ⇒ Object
for generating a timestamp when using ‘create_migration`.
Instance Method Summary collapse
- #create_app_manager_initializer ⇒ Object
- #create_discount_table_migration ⇒ Object
- #create_external_charge_field ⇒ Object
- #create_fail_safe ⇒ Object
- #create_global_field_to_plans_migration ⇒ Object
- #create_note_and_details_to_plans_migration ⇒ Object
- #create_plan_trial_grandfathered_to_shops_migration ⇒ Object
- #mount_engine ⇒ Object
Class Method Details
.next_migration_number(dir) ⇒ Object
for generating a timestamp when using ‘create_migration`
80 81 82 |
# File 'lib/generators/app_manager/install/install_generator.rb', line 80 def next_migration_number(dir) ActiveRecord::Generators::Base.next_migration_number(dir) end |
Instance Method Details
#create_app_manager_initializer ⇒ Object
17 18 19 |
# File 'lib/generators/app_manager/install/install_generator.rb', line 17 def create_app_manager_initializer template("app_manager.rb", "config/initializers/app_manager.rb") end |
#create_discount_table_migration ⇒ Object
45 46 47 48 49 50 51 |
# File 'lib/generators/app_manager/install/install_generator.rb', line 45 def create_discount_table_migration if self.class.migration_exists?("db/app_manager", "add_discount_tables") say_status("skipped", "Migration add_discount_tables.rb already exists") else migration_template("add_discount_tables.erb", "db/app_manager/add_discount_tables.rb") end end |
#create_external_charge_field ⇒ Object
37 38 39 40 41 42 43 |
# File 'lib/generators/app_manager/install/install_generator.rb', line 37 def create_external_charge_field if self.class.migration_exists?("db/app_manager", "add_external_charge_field") say_status("skipped", "Migration add_external_charge_field.rb already exists") else migration_template("add_external_charge_field.erb", "db/app_manager/add_external_charge_field.rb") end end |
#create_fail_safe ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/generators/app_manager/install/install_generator.rb', line 29 def create_fail_safe if self.class.migration_exists?("db/app_manager", "add_fail_safe") say_status("skipped", "Migration add_fail_safe.rb already exists") else migration_template("failsafe_tables.erb", "db/app_manager/add_fail_safe.rb") end end |
#create_global_field_to_plans_migration ⇒ Object
53 54 55 56 57 58 59 |
# File 'lib/generators/app_manager/install/install_generator.rb', line 53 def create_global_field_to_plans_migration if self.class.migration_exists?("db/app_manager", "add_is_global_to_plans") say_status("skipped", "Migration add_is_global_to_plans.rb already exists") else migration_template("add_is_global_to_plans.erb", "db/app_manager/add_is_global_to_plans.rb") end end |
#create_note_and_details_to_plans_migration ⇒ Object
61 62 63 64 65 66 67 |
# File 'lib/generators/app_manager/install/install_generator.rb', line 61 def create_note_and_details_to_plans_migration if self.class.migration_exists?("db/app_manager", "add_note_and_details_to_plans") say_status("skipped", "Migration add_note_and_details_to_plans.rb already exists") else migration_template("add_note_and_details_to_plans.erb", "db/app_manager/add_note_and_details_to_plans.rb") end end |
#create_plan_trial_grandfathered_to_shops_migration ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/generators/app_manager/install/install_generator.rb', line 21 def create_plan_trial_grandfathered_to_shops_migration if self.class.migration_exists?("db/migrate", "add_plan_trial_grandfathered_to_shops") say_status("skipped", "Migration add_plan_trial_grandfathered_to_shops.rb already exists") else migration_template("add_plan_trial_grandfathered_to_shops.erb", "db/migrate/add_plan_trial_grandfathered_to_shops.rb") end end |
#mount_engine ⇒ Object
10 11 12 13 14 15 |
# File 'lib/generators/app_manager/install/install_generator.rb', line 10 def mount_engine routes_content = File.read(File.join(destination_root, "config/routes.rb")) rescue "" unless routes_content.include?("mount AppManager::Engine") route("mount AppManager::Engine, at: '/'") end end |