lib/forest/migrations.rb
# Puts warning when any engine migration is not present on the Rails app
# db/migrate dir
#
# First split:
#
#   ["20131128203548", "update_name_fields_on_spree_credit_cards.spree.rb"]
#
# Second split should give the engine_name of the migration
#
#   ["update_name_fields_on_spree_credit_cards", "spree.rb"]
#
# Shouldn't run on test mode because migrations inside engine don't have
# engine name on the file name
Puts warning when any engine migration is not present on the Rails app
db/migrate dir

First split.



Second split should give the engine_name of the migration



Shouldn't run on test mode because migrations inside engine don't have
engine name on the file name
Puts warning when any engine migration is not present on the Rails app db / migrate dir First split . Second split should give the engine_name of the migration Shouldn ' t run on test mode because migrations inside engine don ' t have engine name on the file name
def missing_migrations
      missing_migrations = []
      if File.directory?(app_dir)
        engine_in_app = app_migrations.map do |file_name|
          name, engine = file_name.split('.', 2)
          next unless match_engine?(engine)
          name
        end.compact
        missing_migrations = engine_migrations.sort - engine_in_app.sort
      end
      missing_migrations
    end
def missing_migrations missing_migrations = [ ] if File . directory? ( app_dir ) engine_in_app = app_migrations . map do | file_name | name , engine = file_name . split ( '.' , 2 ) next unless match_engine? ( engine ) name end . compact missing_migrations = engine_migrations . sort - engine_in_app . sort end missing_migrations end
Puts warning when any engine migration is not present on the Rails app
db/migrate dir
Puts warning when any engine migration is not present on the Rails app db / migrate dir