Sha256: 30a5b0f8cf1184b1b28dccd0cb94d9037d679257efcf64ddb8b93ccb904194bd
Contents?: true
Size: 1.04 KB
Versions: 8
Compression:
Stored size: 1.04 KB
Contents
module Scrivito module Migrations class Installer def initialize(from) @to_load = from.blank? ? :all : from.split(',').map(&:strip) end def install Scrivito::Migrations::Migration.copy(destination, find_engines_with_migrations) end private def destination Scrivito::Migrations::Migrator.migrations_path end def find_engines_with_migrations Rails.application.railties.inject({}) do |railties, railtie| next railties unless @to_load == :all || @to_load.include?(railtie.railtie_name) if path = railtie_migration_path_for(railtie) railties[railtie.railtie_name] = path end railties end end def railtie_migration_path_for(railtie) if railtie.respond_to?(:paths) path = railtie.paths.path + relative_migration_path if File.exist?(path) path end end end def relative_migration_path 'cms/migrate' end end end end
Version data entries
8 entries across 8 versions & 1 rubygems