rails_config 0.3.3 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4efd1a612a114b168e9ddeb109fac76186b65dbf
4
- data.tar.gz: 4f2f6db5b1137726cd050426d43b7f5ee1b8a831
3
+ metadata.gz: bdfe7d4c355ef3a597de7a74ecce0b5b0884c3aa
4
+ data.tar.gz: 51f7b615597fe525b31cdfdd80bf9dd95b6bf5a1
5
5
  SHA512:
6
- metadata.gz: 62ef2ac4f378dc31128fc018a369ddc44c714d54ad3937f73a184136828fe63b3bdbc765bc7abed6e1785e1a72f6ab901e3432a369b686265842c1a174119385
7
- data.tar.gz: bb2119a46660de9e8507044911ad05bd9d6c9394f988db2433d5f40c13b27c27d51214b79219d7721cc1e34af2b80ba02a6b2ea3ae4082fd5b351fdc8ea371ce
6
+ metadata.gz: fb605e92f8f97565e9aade53bd8e871f72bb5cbca6e77e47e658ef0374aa5707096eb5306e9872d18d8d57f7e4cf733cbc076ed9d9a508999a88414acc9f8c22
7
+ data.tar.gz: b22b49167706e2d8ac227e75ac331a4e0cd872756abdb851e16c5c4b193fe15852df9771b10a97530ba1fe1f1131b85a57d3d0ee51d09d5321bafd92edc1ce5a
data/.gitignore CHANGED
@@ -2,3 +2,4 @@
2
2
  pkg/*.gem
3
3
  .rvmrc
4
4
  Gemfile.lock
5
+ .idea
@@ -0,0 +1 @@
1
+ rails_config
@@ -0,0 +1,4 @@
1
+ # 0.3.4
2
+
3
+ * expose Settings in application.rb, so you don't have to duplicate configuration for each environment file ([#59](https://github.com/railsjedi/rails_config/issues/59))
4
+ * change the on_load init callback to support Rails 4.1.0.rc
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
1
  source 'http://rubygems.org'
2
2
 
3
3
  gemspec
4
+
5
+ gem 'rubocop', require: false
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
- * Inherited from [AppConfig](http://github.com/cjbottaro/app_config) by [Christopher J. Bottaro](http://github.com/cjbottaro)
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 Rails3
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
- # manually load the custom initializer before everything else
8
- initializer :load_custom_rails_config, :before => :load_environment_config, :group => :all do
9
- initializer = Rails.root.join("config", "initializers", "rails_config.rb")
10
- require initializer if File.exist?(initializer)
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
- # Parse the settings before any of the initializers
14
- initializer :load_rails_config_settings, :after => :load_custom_rails_config, :before => :load_environment_config, :group => :all do
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
@@ -1,3 +1,3 @@
1
1
  module RailsConfig
2
- VERSION = '0.3.3'
2
+ VERSION = '0.3.4'
3
3
  end
@@ -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 rails3 that reads from config/settings.yml"
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"]
@@ -1,3 +1,8 @@
1
1
  size: 1
2
2
  server: google.com
3
- 1: "one"
3
+ 1: "one"
4
+ photo_sizes:
5
+ avatar: [60, 60]
6
+ root:
7
+ yahoo.com: 2
8
+ 'google.com': 3
@@ -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.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: 2013-04-18 00:00:00.000000000 Z
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.0.0
159
+ rubygems_version: 2.2.2
155
160
  signing_key:
156
161
  specification_version: 4
157
- summary: Provides a Settings helper for rails3 that reads from config/settings.yml
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