Sha256: eaa2958b27598c5ecc450054f4f6f2a6ebb8fa14697a3fb709bcdc1a260f58ee

Contents?: true

Size: 812 Bytes

Versions: 8

Compression:

Stored size: 812 Bytes

Contents

require "rails_config/rack/reloader"

module RailsConfig
  # provide helper to register within your Sinatra app
  #
  # set :root, File.dirname(__FILE__)
  # register RailsConfig
  #
  def self.registered(app)
    app.configure do |inner_app|

      env = inner_app.environment || ENV["RACK_ENV"]
      root = inner_app.root

      # use Padrino settings if applicable
      if defined?(Padrino)
        env = Padrino.env
        root = Padrino.root
      end

      RailsConfig.load_and_set_settings(
        File.join(root.to_s, "config", "settings.yml").to_s,
        File.join(root.to_s, "config", "settings", "#{env}.yml").to_s,
        File.join(root.to_s, "config", "environments", "#{env}.yml").to_s
      )

      inner_app.use(::RailsConfig::Rack::Reloader) if inner_app.development?
    end
  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
rails_config-0.3.2 lib/rails_config/integration/sinatra.rb
rails_config-0.3.1 lib/rails_config/integration/sinatra.rb
rails_config-0.3.0 lib/rails_config/integration/sinatra.rb
rails_config-0.2.7 lib/rails_config/integration/sinatra.rb
rails_config-0.2.6 lib/rails_config/integration/sinatra.rb
rails_config-0.2.5 lib/rails_config/integration/sinatra.rb
rails_config-0.2.4 lib/rails_config/integration/sinatra.rb
rails_config-0.2.3 lib/rails_config/integration/sinatra.rb