Sha256: c5c01d83c2b8608c9923d59403c0fcf9c5f4248d313ee4e29ca1cb37da10da3f

Contents?: true

Size: 1.06 KB

Versions: 8

Compression:

Stored size: 1.06 KB

Contents

require 'tork/config'
require 'active_support/inflector'

Tork::Config.reabsorb_file_greps.push(
  %r<^config/.+\.(rb|yml)$>,
  %r<^db/schema\.rb$>,
  %r<^Gemfile\.lock$>
)

Tork::Config.test_file_globbers.update(
  %r<^(app|lib|test|spec)/.*?([^/]+?)(_factory)?\.rb$> => lambda do |matches|
    single = matches[2]
    plural = ActiveSupport::Inflector.pluralize(single)
    "{test,spec}/**/{#{single},#{plural}_*}_{test,spec}.rb"
  end
)

Tork::Config.after_fork_hooks << proc do
  if defined? ActiveRecord::Base and
    ActiveRecord::Base.connection_pool.spec.config[:database] != ':memory:'
  then
    ActiveRecord::Base.connection.reconnect!
  end
end

begin
  require 'rails/railtie'
  class Tork::Railtie < Rails::Railtie
    config.before_initialize do |app|
      if app.config.cache_classes
        warn "tork/config/rails: Setting #{app.class}.config.cache_classes = false"
        app.config.cache_classes = false
      end
    end
  end
rescue LoadError
  warn "tork/config/rails: Railtie not available; please manually set:\n\t"\
       "config.cache_classes = false"
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
tork-18.2.4 lib/tork/config/rails.rb
tork-18.2.3 lib/tork/config/rails.rb
tork-18.2.2 lib/tork/config/rails.rb
tork-18.2.1 lib/tork/config/rails.rb
tork-18.2.0 lib/tork/config/rails.rb
tork-18.1.0 lib/tork/config/rails.rb
tork-18.0.1 lib/tork/config/rails.rb
tork-18.0.0 lib/tork/config/rails.rb