Class: AppManager::Generators::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Includes:
Rails::Generators::Migration
Defined in:
lib/generators/app_manager/install/install_generator.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.next_migration_number(dir) ⇒ Object

for generating a timestamp when using ‘create_migration`



69
70
71
# File 'lib/generators/app_manager/install/install_generator.rb', line 69

def next_migration_number(dir)
  ActiveRecord::Generators::Base.next_migration_number(dir)
end

Instance Method Details

#create_app_manager_initializerObject



14
15
16
# File 'lib/generators/app_manager/install/install_generator.rb', line 14

def create_app_manager_initializer
  template("app_manager.rb", "config/initializers/app_manager.rb")
end

#create_discount_table_migrationObject



42
43
44
45
46
47
48
# File 'lib/generators/app_manager/install/install_generator.rb', line 42

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_fieldObject



34
35
36
37
38
39
40
# File 'lib/generators/app_manager/install/install_generator.rb', line 34

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_safeObject



26
27
28
29
30
31
32
# File 'lib/generators/app_manager/install/install_generator.rb', line 26

def create_fail_safe
  if self.class.migration_exists?("db/app_manager", "failsafe_tables")
    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_migrationObject



50
51
52
53
54
55
56
# File 'lib/generators/app_manager/install/install_generator.rb', line 50

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_plan_trial_grandfathered_to_shops_migrationObject



18
19
20
21
22
23
24
# File 'lib/generators/app_manager/install/install_generator.rb', line 18

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_engineObject



10
11
12
# File 'lib/generators/app_manager/install/install_generator.rb', line 10

def mount_engine
  route("mount AppManager::Engine, at: '/'")
end