Sha256: e7e25fa69765d3c2378151bcf1491eee684086f250bc58f4bef7e2dd740c0e7a
Contents?: true
Size: 1.9 KB
Versions: 7
Compression:
Stored size: 1.9 KB
Contents
require "rails/generators/base" require "rails/generators/active_record" module AppManager module Generators class InstallGenerator < Rails::Generators::Base include Rails::Generators::Migration source_root File.expand_path('../templates', __FILE__) def mount_engine route("mount AppManager::Engine, at: '/'") end def create_app_manager_initializer template("app_manager.rb", "config/initializers/app_manager.rb") end 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 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 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 private def rails_migration_version Rails.version.match(/\d\.\d/)[0] end class << self private :next_migration_number # for generating a timestamp when using `create_migration` def next_migration_number(dir) ActiveRecord::Generators::Base.next_migration_number(dir) end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems