Sha256: e739ab164712bc6b65038babfd1a41bdea45012ee48abf71ba26d808352ebea0

Contents?: true

Size: 545 Bytes

Versions: 3

Compression:

Stored size: 545 Bytes

Contents

module GoodMigrations
  class PermitsAutoload
    def permit?(path)
      !app_path?(path) || permit_autoloading_based_on_migration_time?
    end

    private

    def permit_autoloading_based_on_migration_time?
      permit_before_date = GoodMigrations.config.permit_autoloading_before
      migration_details = GoodMigrations::MigrationDetails.currently_executing
      migration_details.considered_before?(permit_before_date)
    end

    def app_path?(path)
      path.starts_with? File.join(Rails.application.root, "app")
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
good_migrations-0.3.0 lib/good_migrations/permits_autoload.rb
good_migrations-0.2.1 lib/good_migrations/permits_autoload.rb
good_migrations-0.2.0 lib/good_migrations/permits_autoload.rb