app_config_loader 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/CHANGELOG.md +6 -0
- data/README.md +2 -2
- data/lib/app_config_loader/loader.rb +3 -1
- data/lib/app_config_loader/version.rb +1 -1
- data/lib/app_config_loader.rb +3 -3
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7a9784e8b7cbbb457d574c16c03a76a8c647de00
|
4
|
+
data.tar.gz: 8f96083cbcb8493b9fb250fafb763e67552d2400
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a79629f517c0e2b2a895780d2043f6cb90dd22babd6482f53f22bf0000ac1777de269e955b72381779bc5abdae41d7232afd5618a5a9e80839bc8189aa1dbdd
|
7
|
+
data.tar.gz: 04944fbfe2ecc152ebeaec0a15834df3a0dc8b4f675f470c7faed8eee5c4d19308c38efdeb4cd95592a6f01ff9d8b853c097ccfb84bfd9726f0b7946613cf526
|
data/.gitignore
CHANGED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,6 @@
|
|
1
|
+
# CHANGELOG
|
2
|
+
|
3
|
+
## [v1.0.1](https://github.com/lscspirit/app_config_loader/tree/v1.0.1) (2017-01-12)
|
4
|
+
[Full list of commits](https://github.com/lscspirit/app_config_loader/compare/58ae3bea8d929ce97ac2985f4485d435bd6056c6...v1.0.1)
|
5
|
+
|
6
|
+
- allow the gem to work in non-Rails environment
|
data/README.md
CHANGED
@@ -36,10 +36,10 @@ APP_CONFIG = AppConfigLoader.load
|
|
36
36
|
From this point onward, you can access your app config values through `APP_CONFIG`.
|
37
37
|
|
38
38
|
```ruby
|
39
|
-
# when AppConfigLoader' env is not "production"
|
39
|
+
# when AppConfigLoader's env is not "production"
|
40
40
|
APP_CONFIG['some_service.host'] # => 'dev.someservice.com'
|
41
41
|
|
42
|
-
# when AppConfigLoader' env is set to "production"
|
42
|
+
# when AppConfigLoader's env is set to "production"
|
43
43
|
APP_CONFIG['some_service.host'] # => 'prod.someservice.com'
|
44
44
|
```
|
45
45
|
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'erb'
|
2
|
+
|
1
3
|
module AppConfigLoader
|
2
4
|
class Loader
|
3
5
|
def initialize(config)
|
@@ -45,7 +47,7 @@ module AppConfigLoader
|
|
45
47
|
private
|
46
48
|
|
47
49
|
def parse_yml(path)
|
48
|
-
@parser.parse ERB.new(File.read(path)).result
|
50
|
+
@parser.parse ::ERB.new(File.read(path)).result
|
49
51
|
end
|
50
52
|
|
51
53
|
# Expands the list of path entries into absolute paths for each matching files
|
data/lib/app_config_loader.rb
CHANGED
@@ -21,9 +21,9 @@ module AppConfigLoader
|
|
21
21
|
|
22
22
|
def self.default_config
|
23
23
|
cfg = AppConfigLoader::Config.new
|
24
|
-
cfg.env = Rails.env
|
25
|
-
cfg.config_paths <<
|
26
|
-
cfg.local_overrides = Rails.root.join('config', 'app_configs', 'local_overrides.yml')
|
24
|
+
cfg.env = defined?(Rails) ? Rails.env : 'development'
|
25
|
+
cfg.config_paths << (defined?(Rails) ? Rails.root.join('config', 'app_configs') : File.join(__dir__, 'app_configs'))
|
26
|
+
cfg.local_overrides = defined? (Rails) ? Rails.root.join('config', 'app_configs', 'local_overrides.yml') : File.join(__dir__, 'config', 'local_overrides.yml')
|
27
27
|
cfg
|
28
28
|
end
|
29
29
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: app_config_loader
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Derrick Yeung
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-01-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -76,6 +76,7 @@ extra_rdoc_files: []
|
|
76
76
|
files:
|
77
77
|
- .gitignore
|
78
78
|
- .travis.yml
|
79
|
+
- CHANGELOG.md
|
79
80
|
- Gemfile
|
80
81
|
- LICENSE.txt
|
81
82
|
- README.md
|