rails_config 0.3.3 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.ruby-gemset +1 -0
- data/CHANGELOG.md +4 -0
- data/Gemfile +2 -0
- data/README.md +6 -1
- data/lib/rails_config/integration/rails.rb +22 -17
- data/lib/rails_config/version.rb +1 -1
- data/rails_config.gemspec +4 -3
- data/spec/fixtures/settings.yml +6 -1
- data/spec/rails_config_spec.rb +4 -0
- metadata +10 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bdfe7d4c355ef3a597de7a74ecce0b5b0884c3aa
|
4
|
+
data.tar.gz: 51f7b615597fe525b31cdfdd80bf9dd95b6bf5a1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb605e92f8f97565e9aade53bd8e871f72bb5cbca6e77e47e658ef0374aa5707096eb5306e9872d18d8d57f7e4cf733cbc076ed9d9a508999a88414acc9f8c22
|
7
|
+
data.tar.gz: b22b49167706e2d8ac227e75ac331a4e0cd872756abdb851e16c5c4b193fe15852df9771b10a97530ba1fe1f1131b85a57d3d0ee51d09d5321bafd92edc1ce5a
|
data/.gitignore
CHANGED
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rails_config
|
data/CHANGELOG.md
ADDED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -235,4 +235,9 @@ Settings.section.servers[1].name # => amazon.com
|
|
235
235
|
|
236
236
|
* [Jacques Crocker](http://github.com/railsjedi)
|
237
237
|
* [Fred Wu](http://github.com/fredwu)
|
238
|
-
*
|
238
|
+
* [Piotr Kuczynski](http://github.com/pkuczynski)
|
239
|
+
* Inherited from [AppConfig](http://github.com/cjbottaro/app_config) by [Christopher J. Bottaro](http://github.com/cjbottaro)
|
240
|
+
|
241
|
+
## License
|
242
|
+
|
243
|
+
RailsConfig is released under the [MIT License](http://www.opensource.org/licenses/MIT).
|
@@ -1,30 +1,35 @@
|
|
1
1
|
module RailsConfig
|
2
2
|
module Integration
|
3
|
-
module
|
4
|
-
if defined?(Rails::Railtie)
|
5
|
-
class Railtie < Rails::Railtie
|
3
|
+
module Rails
|
4
|
+
if defined?(::Rails::Railtie)
|
5
|
+
class Railtie < ::Rails::Railtie
|
6
6
|
|
7
|
-
#
|
8
|
-
|
9
|
-
|
10
|
-
|
7
|
+
# TODO: allo them to override init_callback via ENV or something?
|
8
|
+
if ::Rails::VERSION::MAJOR >= 4 and ::Rails::VERSION::MINOR >= 1
|
9
|
+
init_callback = :before_initialize
|
10
|
+
else
|
11
|
+
init_callback = :before_configuration
|
11
12
|
end
|
12
13
|
|
13
|
-
|
14
|
-
|
14
|
+
ActiveSupport.on_load init_callback, :yield => true do
|
15
|
+
# manually load the custom initializer before everything else
|
16
|
+
initializer = ::Rails.root.join("config", "initializers", "rails_config.rb")
|
17
|
+
require initializer if File.exist?(initializer)
|
18
|
+
|
19
|
+
# Parse the settings before any of the initializers
|
15
20
|
RailsConfig.load_and_set_settings(
|
16
|
-
Rails.root.join("config", "settings.yml").to_s,
|
17
|
-
Rails.root.join("config", "settings", "#{Rails.env}.yml").to_s,
|
18
|
-
Rails.root.join("config", "environments", "#{Rails.env}.yml").to_s,
|
21
|
+
::Rails.root.join("config", "settings.yml").to_s,
|
22
|
+
::Rails.root.join("config", "settings", "#{::Rails.env}.yml").to_s,
|
23
|
+
::Rails.root.join("config", "environments", "#{::Rails.env}.yml").to_s,
|
19
24
|
|
20
|
-
Rails.root.join("config", "settings.local.yml").to_s,
|
21
|
-
Rails.root.join("config", "settings", "#{Rails.env}.local.yml").to_s,
|
22
|
-
Rails.root.join("config", "environments", "#{Rails.env}.local.yml").to_s
|
25
|
+
::Rails.root.join("config", "settings.local.yml").to_s,
|
26
|
+
::Rails.root.join("config", "settings", "#{::Rails.env}.local.yml").to_s,
|
27
|
+
::Rails.root.join("config", "environments", "#{::Rails.env}.local.yml").to_s
|
23
28
|
)
|
24
29
|
end
|
25
30
|
|
26
31
|
# Rails Dev environment should reload the Settings on every request
|
27
|
-
if Rails.env.development?
|
32
|
+
if ::Rails.env.development?
|
28
33
|
initializer :rails_config_reload_on_development do
|
29
34
|
ActionController::Base.class_eval do
|
30
35
|
prepend_before_filter { ::RailsConfig.reload! }
|
@@ -35,4 +40,4 @@ module RailsConfig
|
|
35
40
|
end
|
36
41
|
end
|
37
42
|
end
|
38
|
-
end
|
43
|
+
end
|
data/lib/rails_config/version.rb
CHANGED
data/rails_config.gemspec
CHANGED
@@ -4,11 +4,12 @@ Gem::Specification.new do |s|
|
|
4
4
|
s.name = "rails_config"
|
5
5
|
s.version = RailsConfig::VERSION
|
6
6
|
s.date = Time.now.strftime '%F'
|
7
|
-
s.authors = ["Jacques Crocker", "Fred Wu"]
|
8
|
-
s.email = ["railsjedi@gmail.com", "ifredwu@gmail.com"]
|
9
|
-
s.summary = "Provides a Settings helper for
|
7
|
+
s.authors = ["Jacques Crocker", "Fred Wu", "Piotr Kuczynski"]
|
8
|
+
s.email = ["railsjedi@gmail.com", "ifredwu@gmail.com", "piotr.kuczynski@gmail.com"]
|
9
|
+
s.summary = "Provides a Settings helper for Rails that reads from config/settings.yml"
|
10
10
|
s.description = "Easy to use Settings helper that loads its data in from config/settings.yml. Handles adding multiple sources, and easy reloading."
|
11
11
|
s.homepage = "http://github.com/railsjedi/rails_config"
|
12
|
+
s.license = "MIT"
|
12
13
|
s.extra_rdoc_files = ["README.md"]
|
13
14
|
s.rdoc_options = ["--charset=UTF-8"]
|
14
15
|
s.require_paths = ["lib"]
|
data/spec/fixtures/settings.yml
CHANGED
data/spec/rails_config_spec.rb
CHANGED
@@ -6,6 +6,10 @@ describe RailsConfig do
|
|
6
6
|
config = RailsConfig.load_files(setting_path("settings.yml"))
|
7
7
|
config.size.should eq 1
|
8
8
|
config.server.should eq "google.com"
|
9
|
+
config['1'].should eq 'one'
|
10
|
+
config.photo_sizes.avatar.should eq [60, 60]
|
11
|
+
config.root['yahoo.com'].should eq 2
|
12
|
+
config.root['google.com'].should eq 3
|
9
13
|
end
|
10
14
|
|
11
15
|
it "should load 2 basic config files" do
|
metadata
CHANGED
@@ -1,15 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_config
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jacques Crocker
|
8
8
|
- Fred Wu
|
9
|
+
- Piotr Kuczynski
|
9
10
|
autorequire:
|
10
11
|
bindir: bin
|
11
12
|
cert_chain: []
|
12
|
-
date:
|
13
|
+
date: 2014-04-15 00:00:00.000000000 Z
|
13
14
|
dependencies:
|
14
15
|
- !ruby/object:Gem::Dependency
|
15
16
|
name: activesupport
|
@@ -86,6 +87,7 @@ description: Easy to use Settings helper that loads its data in from config/sett
|
|
86
87
|
email:
|
87
88
|
- railsjedi@gmail.com
|
88
89
|
- ifredwu@gmail.com
|
90
|
+
- piotr.kuczynski@gmail.com
|
89
91
|
executables: []
|
90
92
|
extensions: []
|
91
93
|
extra_rdoc_files:
|
@@ -93,6 +95,8 @@ extra_rdoc_files:
|
|
93
95
|
files:
|
94
96
|
- .bundle/config
|
95
97
|
- .gitignore
|
98
|
+
- .ruby-gemset
|
99
|
+
- CHANGELOG.md
|
96
100
|
- Gemfile
|
97
101
|
- LICENSE
|
98
102
|
- README.md
|
@@ -132,7 +136,8 @@ files:
|
|
132
136
|
- spec/sources/yaml_source_spec.rb
|
133
137
|
- spec/spec_helper.rb
|
134
138
|
homepage: http://github.com/railsjedi/rails_config
|
135
|
-
licenses:
|
139
|
+
licenses:
|
140
|
+
- MIT
|
136
141
|
metadata: {}
|
137
142
|
post_install_message:
|
138
143
|
rdoc_options:
|
@@ -151,10 +156,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
151
156
|
version: '0'
|
152
157
|
requirements: []
|
153
158
|
rubyforge_project:
|
154
|
-
rubygems_version: 2.
|
159
|
+
rubygems_version: 2.2.2
|
155
160
|
signing_key:
|
156
161
|
specification_version: 4
|
157
|
-
summary: Provides a Settings helper for
|
162
|
+
summary: Provides a Settings helper for Rails that reads from config/settings.yml
|
158
163
|
test_files:
|
159
164
|
- spec/fixtures/bool_override/config1.yml
|
160
165
|
- spec/fixtures/bool_override/config2.yml
|