configs 1.0.0 → 1.1.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 03ad3dd99c10c113f0d632e6ee132f3f0e0ef2bd
4
- data.tar.gz: a5a94f92eb7c08db2674e6fdfb221b5c59000580
3
+ metadata.gz: 6f67782134b85803a862a485b3a24b762f18d0bb
4
+ data.tar.gz: 4e9a1843580afa8d78daa470c15bc81a7b57a9a7
5
5
  SHA512:
6
- metadata.gz: d4eda53c5625bc9d4250591033fb692efc8226a2dea903fcc55283790fee5ac0103134d86eeae7724ccd6aaa58791def16c1124f291d0ebafefbb1413babc60a
7
- data.tar.gz: f499c82d16e598d6a4abcfbd4d8eef64394a6bd77f74427c816849717dc4fd1f4be81ce55c40737eb17b13b8307e4416752b320df1502504749a8bee25b0b491
6
+ metadata.gz: 88945ea9fa61679b5724b091dbe02dc011fefb882b1a6a133ed50b8edf74fc34de0d685a07a77f2a0abff4688aef58ad44a54ec641912766854c1cdb138d5879
7
+ data.tar.gz: 0ad7e3c735437d05082eb902d39b9ea3b3b214c9885aa0bff2c9b3fc72998728b2a4a929b99c24bb907c7b41a7d946ce76aedaff1dc745efa5bef9c26dfc642e
data/.travis.yml ADDED
@@ -0,0 +1,9 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 2.0.0
5
+ - 2.1.0
6
+
7
+ gemfile:
8
+ - gemfiles/activesupport3.2
9
+ - gemfiles/activesupport4.0
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
@@ -1,2 +1,11 @@
1
1
  #!/usr/bin/env rake
2
2
  require "bundler/gem_tasks"
3
+
4
+ require 'rake/testtask'
5
+ Rake::TestTask.new do |t|
6
+ t.libs << "test"
7
+ t.test_files = FileList['test/*test.rb']
8
+ t.verbose = true
9
+ end
10
+
11
+ task :default => :test
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 "test-unit"
20
+ gem.add_development_dependency "rake"
20
21
  end
@@ -0,0 +1,4 @@
1
+ source "https://rubygems.org"
2
+ gemspec path: '../'
3
+
4
+ gem 'activesupport', '~> 3.2.0'
@@ -0,0 +1,4 @@
1
+ source "https://rubygems.org"
2
+ gemspec path: '../'
3
+
4
+ gem 'activesupport', '~> 4.0.0'
@@ -1,3 +1,3 @@
1
1
  module Configs
2
- VERSION = "1.0.0"
2
+ VERSION = "1.1.0"
3
3
  end
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
- YAML.load_file(path).with_indifferent_access if File.exists? path
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)
@@ -0,0 +1,3 @@
1
+ default:
2
+ # Test ERB interpolation
3
+ three: <%= 1 + 2 %>
data/test/configs_test.rb CHANGED
@@ -52,6 +52,10 @@ class ConfigsTest < Configs::TestCase
52
52
  end
53
53
  end
54
54
 
55
+ should "interpolate ERB" do
56
+ assert_equal 3, Configs[:erb][:three]
57
+ end
58
+
55
59
  protected
56
60
 
57
61
  def with_config(path, contents, &block)
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.0.0
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: 2013-07-17 00:00:00.000000000 Z
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: test-unit
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.0.0
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