Sha256: 4496a10b710cbd43cecc5b272c60088b5b319665a4cd855d1f0c72fc09ffe3db

Contents?: true

Size: 929 Bytes

Versions: 20

Compression:

Stored size: 929 Bytes

Contents

# frozen_string_literal: true

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

20 entries across 20 versions & 1 rubygems

Version Path
racecar-2.10.0.beta1 lib/racecar/rails_config_file_loader.rb
racecar-2.9.0 lib/racecar/rails_config_file_loader.rb
racecar-2.9.0.beta1 lib/racecar/rails_config_file_loader.rb
racecar-2.8.2 lib/racecar/rails_config_file_loader.rb
racecar-2.8.2.beta lib/racecar/rails_config_file_loader.rb
racecar-2.8.1 lib/racecar/rails_config_file_loader.rb
racecar-2.8.0.rc.1 lib/racecar/rails_config_file_loader.rb
racecar-2.8.0.beta.2 lib/racecar/rails_config_file_loader.rb
racecar-2.8.0.beta.1 lib/racecar/rails_config_file_loader.rb
racecar-2.7.0 lib/racecar/rails_config_file_loader.rb
racecar-2.7.0.beta1 lib/racecar/rails_config_file_loader.rb
racecar-2.6.0 lib/racecar/rails_config_file_loader.rb
racecar-2.5.0 lib/racecar/rails_config_file_loader.rb
racecar-2.4.0 lib/racecar/rails_config_file_loader.rb
racecar-2.3.1 lib/racecar/rails_config_file_loader.rb
racecar-2.3.0 lib/racecar/rails_config_file_loader.rb
racecar-2.3.0.alpha1 lib/racecar/rails_config_file_loader.rb
racecar-2.2.0 lib/racecar/rails_config_file_loader.rb
racecar-2.1.1 lib/racecar/rails_config_file_loader.rb
racecar-2.1.0 lib/racecar/rails_config_file_loader.rb