Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed conflicts in: lib/rails_config/railtie.rb
- Loading branch information
Showing
9 changed files
with
122 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
module RailsConfig | ||
module Integration | ||
module Rails3 | ||
if defined?(Rails::Railtie) | ||
class Railtie < Rails::Railtie | ||
|
||
# manually load the custom initializer before everything else | ||
initializer :load_custom_rails_config, :before => :bootstrap_hook do | ||
initializer = Rails.root.join("config", "initializers", "rails_config") | ||
require initializer if File.exist?(initializer) | ||
end | ||
|
||
# Parse the settings before any of the initializers | ||
ActiveSupport.on_load :before_configuration, :yield => true do | ||
RailsConfig.load_and_set_settings( | ||
Rails.root.join("config", "settings.yml").to_s, | ||
Rails.root.join("config", "settings.local.yml").to_s | ||
) | ||
end | ||
|
||
# Rails Dev environment should reload the Settings on every request | ||
if Rails.env.development? | ||
initializer :rails_config_reload_on_development do | ||
ActionController::Base.class_eval do | ||
prepend_before_filter { ::RailsConfig.const_name.constantize.reload! } | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
module RailsConfig | ||
module Rack | ||
# Rack middleware the reloads RailsConfig on every request (only use in dev mode) | ||
class Reloader | ||
def initialize(app) | ||
@app = app | ||
end | ||
|
||
def call(env) | ||
RailsConfig.reload! | ||
@app.call(env) | ||
end | ||
end | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module RailsConfig | ||
VERSION = "0.2.1" | ||
VERSION = "0.2.3" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters