Sha256: 49bf04d67033cb4a20b7a48b60af6e3031c4c2d42abfc08997a61781d8ea72c9
Contents?: true
Size: 1.55 KB
Versions: 15
Compression:
Stored size: 1.55 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 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
15 entries across 15 versions & 1 rubygems