configs 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +9 -0
- data/README.md +15 -0
- data/Rakefile +9 -0
- data/configs.gemspec +2 -1
- data/gemfiles/activesupport3.2 +4 -0
- data/gemfiles/activesupport4.0 +4 -0
- data/lib/configs/version.rb +1 -1
- data/lib/configs.rb +6 -1
- data/test/config/erb.yml +3 -0
- data/test/configs_test.rb +4 -0
- metadata +18 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6f67782134b85803a862a485b3a24b762f18d0bb
|
4
|
+
data.tar.gz: 4e9a1843580afa8d78daa470c15bc81a7b57a9a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 88945ea9fa61679b5724b091dbe02dc011fefb882b1a6a133ed50b8edf74fc34de0d685a07a77f2a0abff4688aef58ad44a54ec641912766854c1cdb138d5879
|
7
|
+
data.tar.gz: 0ad7e3c735437d05082eb902d39b9ea3b3b214c9885aa0bff2c9b3fc72998728b2a4a929b99c24bb907c7b41a7d946ce76aedaff1dc745efa5bef9c26dfc642e
|
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -9,6 +9,9 @@ Searches through a few locations to find the right environment config:
|
|
9
9
|
3. config/$name/default.yml
|
10
10
|
3. config/$name.yml (with 'default' key)
|
11
11
|
|
12
|
+
[![Build
|
13
|
+
Status](https://travis-ci.org/kickstarter/configs.png?branch=master)](https://travis-ci.org/kickstarter/configs)
|
14
|
+
|
12
15
|
## Installation
|
13
16
|
|
14
17
|
Add this line to your application's Gemfile:
|
@@ -38,6 +41,12 @@ Example:
|
|
38
41
|
Configs[:foo][:hello]
|
39
42
|
=> 'world'
|
40
43
|
|
44
|
+
You can include ERB in the YAML files:
|
45
|
+
|
46
|
+
# config/foo.yml
|
47
|
+
development:
|
48
|
+
database_password: <%= ENV['DATABASE_PASSWORD'] %>
|
49
|
+
|
41
50
|
## Contributing
|
42
51
|
|
43
52
|
1. Fork it
|
@@ -45,3 +54,9 @@ Example:
|
|
45
54
|
3. Commit your changes (`git commit -am 'Added some feature'`)
|
46
55
|
4. Push to the branch (`git push origin my-new-feature`)
|
47
56
|
5. Create new Pull Request
|
57
|
+
|
58
|
+
## License
|
59
|
+
|
60
|
+
Copyright 2014 Kickstarter, Inc
|
61
|
+
|
62
|
+
Released under an [MIT License](http://opensource.org/licenses/MIT)
|
data/Rakefile
CHANGED
data/configs.gemspec
CHANGED
@@ -14,7 +14,8 @@ Gem::Specification.new do |gem|
|
|
14
14
|
gem.name = "configs"
|
15
15
|
gem.require_paths = ["lib"]
|
16
16
|
gem.version = Configs::VERSION
|
17
|
+
gem.license = 'MIT'
|
17
18
|
|
18
19
|
gem.add_dependency 'activesupport', '>3.0'
|
19
|
-
gem.add_development_dependency "
|
20
|
+
gem.add_development_dependency "rake"
|
20
21
|
end
|
data/lib/configs/version.rb
CHANGED
data/lib/configs.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require "yaml"
|
2
|
+
require "erb"
|
2
3
|
require "configs/version"
|
3
4
|
require "configs/railtie" if defined? Rails
|
4
5
|
|
@@ -56,7 +57,11 @@ module Configs
|
|
56
57
|
|
57
58
|
def yml_file(name)
|
58
59
|
path = config_dir.join(name + '.yml')
|
59
|
-
|
60
|
+
contents = ERB.new(File.read(path)).result(binding)
|
61
|
+
YAML.load(contents).with_indifferent_access
|
62
|
+
rescue Errno::ENOENT
|
63
|
+
# If file is missing, return nil
|
64
|
+
nil
|
60
65
|
end
|
61
66
|
|
62
67
|
def yml_file_with_key(path, key)
|
data/test/config/erb.yml
ADDED
data/test/configs_test.rb
CHANGED
metadata
CHANGED
@@ -1,41 +1,41 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: configs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lance Ivy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-01-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '3.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '3.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
description: Easy (easier?) management of config/*.yml files. Defines a lookup priority
|
@@ -46,19 +46,24 @@ executables: []
|
|
46
46
|
extensions: []
|
47
47
|
extra_rdoc_files: []
|
48
48
|
files:
|
49
|
-
- .gitignore
|
49
|
+
- ".gitignore"
|
50
|
+
- ".travis.yml"
|
50
51
|
- Gemfile
|
51
52
|
- LICENSE
|
52
53
|
- README.md
|
53
54
|
- Rakefile
|
54
55
|
- configs.gemspec
|
56
|
+
- gemfiles/activesupport3.2
|
57
|
+
- gemfiles/activesupport4.0
|
55
58
|
- lib/configs.rb
|
56
59
|
- lib/configs/railtie.rb
|
57
60
|
- lib/configs/version.rb
|
61
|
+
- test/config/erb.yml
|
58
62
|
- test/configs_test.rb
|
59
63
|
- test/test_helper.rb
|
60
64
|
homepage: http://github.com/kickstarter/configs
|
61
|
-
licenses:
|
65
|
+
licenses:
|
66
|
+
- MIT
|
62
67
|
metadata: {}
|
63
68
|
post_install_message:
|
64
69
|
rdoc_options: []
|
@@ -66,20 +71,21 @@ require_paths:
|
|
66
71
|
- lib
|
67
72
|
required_ruby_version: !ruby/object:Gem::Requirement
|
68
73
|
requirements:
|
69
|
-
- -
|
74
|
+
- - ">="
|
70
75
|
- !ruby/object:Gem::Version
|
71
76
|
version: '0'
|
72
77
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
78
|
requirements:
|
74
|
-
- -
|
79
|
+
- - ">="
|
75
80
|
- !ruby/object:Gem::Version
|
76
81
|
version: '0'
|
77
82
|
requirements: []
|
78
83
|
rubyforge_project:
|
79
|
-
rubygems_version: 2.
|
84
|
+
rubygems_version: 2.2.0
|
80
85
|
signing_key:
|
81
86
|
specification_version: 4
|
82
87
|
summary: Easy (easier?) management of config/*.yml files.
|
83
88
|
test_files:
|
89
|
+
- test/config/erb.yml
|
84
90
|
- test/configs_test.rb
|
85
91
|
- test/test_helper.rb
|