Sha256: 54861ab785e2c7517661a1893bfe513e7a3a15f1030488d897bcd81e6a4754f5

Contents?: true

Size: 656 Bytes

Versions: 2

Compression:

Stored size: 656 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(RailsConfig.setting_files(File.join(root, 'config'), env))

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

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
drtom_rails_config-0.5.0.beta1 lib/rails_config/integration/sinatra.rb
rails_config-0.5.0.beta1 lib/rails_config/integration/sinatra.rb