configs 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/configs.rb +8 -2
- data/lib/configs/version.rb +1 -1
- data/test/configs_test.rb +10 -0
- data/test/defaults_test.rb +8 -0
- data/test/test_helper.rb +2 -6
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 75f17518587855b53c2e646b213d3c5f4539a10b
|
4
|
+
data.tar.gz: 1ae168eb3eb5a8d7596daa66e13b351cdc5837a3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5409690bac6a039938b32c1f7bc0fa23a69522d2178b22e1a1f61b662f66cb56dc46fbadcdf61fc21463e3cb7341d2f75bf7055fcecf34c09b6c315b8202e805
|
7
|
+
data.tar.gz: 308648a8a6eb6130d27563126b2372ff85b69c50576af921cebb36bbba4bc6a69ae49878e632a929636e5f98e696a33de77f907ae308c6e0eef3204d7632976d
|
data/lib/configs.rb
CHANGED
@@ -16,11 +16,17 @@ module Configs
|
|
16
16
|
|
17
17
|
# Where the wild .yml live.
|
18
18
|
# In a Rails app, this is Rails.root.join('config')
|
19
|
-
|
19
|
+
attr_writer :config_dir
|
20
|
+
def config_dir
|
21
|
+
@config_dir ||= Pathname.new('./configs')
|
22
|
+
end
|
20
23
|
|
21
24
|
# The name of our environment.
|
22
25
|
# In a Rails app, this is Rails.env
|
23
|
-
|
26
|
+
attr_writer :environment
|
27
|
+
def environment
|
28
|
+
@environment ||= 'default'
|
29
|
+
end
|
24
30
|
|
25
31
|
# will find (and memoize) the yml config file with this name
|
26
32
|
#
|
data/lib/configs/version.rb
CHANGED
data/test/configs_test.rb
CHANGED
@@ -2,6 +2,11 @@ require File.expand_path(File.dirname(__FILE__) + '/test_helper')
|
|
2
2
|
|
3
3
|
class ConfigsTest < Configs::TestCase
|
4
4
|
def setup
|
5
|
+
@_original_config_dir = Configs.config_dir
|
6
|
+
@_original_environment = Configs.environment
|
7
|
+
|
8
|
+
Configs.config_dir = Pathname.new(File.dirname(__FILE__) + '/config')
|
9
|
+
Configs.environment = 'test'
|
5
10
|
Configs.reload
|
6
11
|
end
|
7
12
|
|
@@ -56,6 +61,11 @@ class ConfigsTest < Configs::TestCase
|
|
56
61
|
assert_equal 3, Configs[:erb][:three]
|
57
62
|
end
|
58
63
|
|
64
|
+
def teardown
|
65
|
+
Configs.config_dir = @_original_config_dir
|
66
|
+
Configs.environment = @_original_environment
|
67
|
+
end
|
68
|
+
|
59
69
|
protected
|
60
70
|
|
61
71
|
def with_config(path, contents, &block)
|
data/test/test_helper.rb
CHANGED
@@ -2,15 +2,11 @@ require 'rubygems'
|
|
2
2
|
require 'bundler'
|
3
3
|
Bundler.require(:default, :test)
|
4
4
|
|
5
|
-
require '
|
6
|
-
|
7
|
-
class Configs::TestCase < Test::Unit::TestCase
|
8
|
-
def default_test; end # quiet Test::Unit
|
5
|
+
require 'minitest/autorun'
|
9
6
|
|
7
|
+
class Configs::TestCase < Minitest::Test
|
10
8
|
def self.should(name, &block) # very simple syntax
|
11
9
|
define_method("test_should_#{name.gsub(/[ -\/]/, '_').gsub(/[^a-z0-9_]/i, '_')}", &block)
|
12
10
|
end
|
13
11
|
end
|
14
12
|
|
15
|
-
Configs.config_dir = Pathname.new(File.dirname(__FILE__) + '/config')
|
16
|
-
Configs.environment = 'test'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: configs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.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: 2014-
|
11
|
+
date: 2014-10-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -60,6 +60,7 @@ files:
|
|
60
60
|
- lib/configs/version.rb
|
61
61
|
- test/config/erb.yml
|
62
62
|
- test/configs_test.rb
|
63
|
+
- test/defaults_test.rb
|
63
64
|
- test/test_helper.rb
|
64
65
|
homepage: http://github.com/kickstarter/configs
|
65
66
|
licenses:
|
@@ -81,11 +82,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
81
82
|
version: '0'
|
82
83
|
requirements: []
|
83
84
|
rubyforge_project:
|
84
|
-
rubygems_version: 2.2.
|
85
|
+
rubygems_version: 2.2.2
|
85
86
|
signing_key:
|
86
87
|
specification_version: 4
|
87
88
|
summary: Easy (easier?) management of config/*.yml files.
|
88
89
|
test_files:
|
89
90
|
- test/config/erb.yml
|
90
91
|
- test/configs_test.rb
|
92
|
+
- test/defaults_test.rb
|
91
93
|
- test/test_helper.rb
|