Sha256: 7b49a2490fdcc2e9b24761ee2291f7e9180dd49b5b108c1f45bb9a0bb639a290

Contents?: true

Size: 898 Bytes

Versions: 28

Compression:

Stored size: 898 Bytes

Contents

module Racecar
  module RailsConfigFileLoader
    def self.load!
      config_file = "config/racecar.yml"

      begin
        require "rails"
      rescue LoadError
        # Not a Rails application.
      end

      if defined?(Rails)
        $stderr.puts "=> Detected Rails, booting application..."

        require "./config/environment"

        if (Rails.root + config_file).readable?
          Racecar.config.load_file(config_file, Rails.env)
        end

        # In development, write Rails logs to STDOUT. This mirrors what e.g.
        # Unicorn does.
        if Rails.env.development? && defined?(ActiveSupport::Logger)
          console = ActiveSupport::Logger.new($stdout)
          console.formatter = Rails.logger.formatter
          console.level = Rails.logger.level
          Rails.logger.extend(ActiveSupport::Logger.broadcast(console))
        end
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
racecar-1.3.0 lib/racecar/rails_config_file_loader.rb
racecar-1.2.1 lib/racecar/rails_config_file_loader.rb
racecar-2.0.0 lib/racecar/rails_config_file_loader.rb
racecar-2.0.0.beta6 lib/racecar/rails_config_file_loader.rb
racecar-1.2.0 lib/racecar/rails_config_file_loader.rb
racecar-1.1.0 lib/racecar/rails_config_file_loader.rb
racecar-2.0.0.beta5 lib/racecar/rails_config_file_loader.rb
racecar-2.0.0.beta4 lib/racecar/rails_config_file_loader.rb
racecar-2.0.0.beta3 lib/racecar/rails_config_file_loader.rb
racecar-2.0.0.beta2 lib/racecar/rails_config_file_loader.rb
racecar-2.0.0.beta1 lib/racecar/rails_config_file_loader.rb
racecar-1.0.1 lib/racecar/rails_config_file_loader.rb
racecar-2.0.0.alpha3 lib/racecar/rails_config_file_loader.rb
racecar-2.0.0.alpha2 lib/racecar/rails_config_file_loader.rb
racecar-2.0.0.alpha1 lib/racecar/rails_config_file_loader.rb
racecar-1.0.0 lib/racecar/rails_config_file_loader.rb
racecar-0.5.0 lib/racecar/rails_config_file_loader.rb
racecar-0.5.0.beta2 lib/racecar/rails_config_file_loader.rb
racecar-0.5.0.beta1 lib/racecar/rails_config_file_loader.rb
racecar-0.4.2 lib/racecar/rails_config_file_loader.rb