Sha256: ebc6bfacadfd7392379b77daeb4f10596fb944332bb9ee01127a1c3e8ebf7db5

Contents?: true

Size: 749 Bytes

Versions: 2

Compression:

Stored size: 749 Bytes

Contents

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

      begin
        require "rails"

        puts "=> Detected Rails, booting application..."

        require "./config/environment"

        Racecar.config.load_file(config_file, Rails.env)

        if Racecar.config.log_to_stdout
          # Write to STDOUT as well as to the log file.
          console = ActiveSupport::Logger.new($stdout)
          console.formatter = Rails.logger.formatter
          console.level = Rails.logger.level
          Rails.logger.extend(ActiveSupport::Logger.broadcast(console))
        end

        Racecar.logger = Rails.logger
      rescue LoadError
        # Not a Rails application.
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
racecar-0.2.1 lib/racecar/config_loader.rb
racecar-0.2.0 lib/racecar/config_loader.rb