Sha256: 14152d8509ed8b9e025eee4ad67bb637fcc72ec5952ac7458726a919037b5dba

Contents?: true

Size: 759 Bytes

Versions: 1

Compression:

Stored size: 759 Bytes

Contents

module GhostSchema
  class MigrationStore
    class << self
      attr_accessor :original_migrations_paths
      attr_accessor :before_migrating_migrations
      attr_accessor :after_migrating_migrations

      def copy_files
        copy_target_files.each do |file|
          FileUtils.copy(file, GhostSchema.migrations_path)
        end
      end

      private

      def copy_target_files
        patterns = /#{diff_versions.join('|')}/

        original_migrations_paths.flat_map do |migrations_path|
          pattern = File.join(migrations_path, '*')
          Dir.glob(pattern).select {|x| patterns.match?(x) }
        end
      end

      def diff_versions
        after_migrating_migrations - before_migrating_migrations
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ghost_schema-0.1.0 lib/ghost_schema/migration_store.rb