config_module 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.codeclimate.yml +15 -13
- data/.ruby-version +1 -1
- data/.travis.yml +14 -12
- data/Gemfile +4 -1
- data/README.markdown +7 -5
- data/lib/config_module/config_helper.rb +2 -2
- data/lib/config_module/config_option.rb +1 -1
- data/lib/config_module/version.rb +1 -1
- data/{spec → uspec}/config/example.yml +0 -0
- data/{spec → uspec}/config/false_nil.yml +0 -0
- data/{spec → uspec}/config_helper_spec.rb +0 -1
- data/{spec → uspec}/config_module_spec.rb +0 -0
- data/{spec → uspec}/config_option_spec.rb +4 -1
- data/{spec → uspec}/example_config.rb +0 -0
- data/{spec → uspec}/exceptions_spec.rb +0 -0
- data/{spec → uspec}/method_missing_spec.rb +0 -0
- data/{spec → uspec}/namespace_spec.rb +21 -0
- data/{spec → uspec}/run_all_specs.rb +3 -1
- data/{spec → uspec}/spec_helper.rb +5 -7
- metadata +15 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ad1e44032bb7a0030ccd3966f6b4bb502489212f
|
4
|
+
data.tar.gz: 4ebabc3fccfc9fe8ecaa7429b8018aecf9e72e32
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0a3c4126289d2beb05d12677ea2e7920f83a3a4efbbe432714ab42b1fb947d3739d260f0060da1e43c5e788dbaea98c85f5824bde24bf286637f06bee09b1f30
|
7
|
+
data.tar.gz: 3483c7da45fb8fd86d78dc94a1b9e53995dc41eb6881cd56c0949e734bd20ac1df5fd960006b9419c4e6a4ae186eae29b240c127d9c8fa1a826ad904282f580c
|
data/.codeclimate.yml
CHANGED
@@ -1,14 +1,16 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
1
|
+
---
|
2
|
+
engines:
|
3
|
+
duplication:
|
4
|
+
enabled: true
|
5
|
+
config:
|
6
|
+
languages:
|
7
|
+
- ruby
|
8
|
+
rubocop:
|
9
|
+
enabled: true
|
10
|
+
reek:
|
11
|
+
enabled: true
|
12
|
+
ratings:
|
13
|
+
paths:
|
14
|
+
- "**.rb"
|
13
15
|
exclude_paths:
|
14
|
-
|
16
|
+
- "uspec/**/*"
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby-2.
|
1
|
+
ruby-2.3.3
|
data/.travis.yml
CHANGED
@@ -1,26 +1,28 @@
|
|
1
1
|
language: ruby
|
2
2
|
rvm:
|
3
|
-
- 2.
|
4
|
-
- 2.
|
5
|
-
- 1
|
6
|
-
-
|
3
|
+
- 2.3.3
|
4
|
+
- 2.2
|
5
|
+
- 2.1
|
6
|
+
- 2.0
|
7
7
|
|
8
8
|
- ruby-head
|
9
|
-
- jruby-
|
10
|
-
|
11
|
-
script: bundle exec ruby spec/run_all_specs.rb
|
12
|
-
before_install:
|
13
|
-
- gem update bundler
|
14
|
-
before_script:
|
15
|
-
- bundle exec gem list
|
9
|
+
- jruby-9.1.6.0
|
10
|
+
- jruby-21mode
|
16
11
|
|
17
12
|
matrix:
|
18
13
|
allow_failures:
|
19
14
|
- rvm: ruby-head
|
20
|
-
- rvm: jruby-
|
15
|
+
- rvm: jruby-9.1.6.0
|
16
|
+
- rvm: jruby-21mode
|
21
17
|
|
22
18
|
sudo: false
|
23
19
|
|
20
|
+
before_install:
|
21
|
+
- gem update bundler
|
22
|
+
before_script:
|
23
|
+
- bundle exec gem list
|
24
|
+
script: bundle exec ruby uspec/run_all_specs.rb
|
25
|
+
|
24
26
|
addons:
|
25
27
|
code_climate:
|
26
28
|
repo_token:
|
data/Gemfile
CHANGED
data/README.markdown
CHANGED
@@ -5,10 +5,12 @@ Load important configuration files into their own modules!
|
|
5
5
|
|
6
6
|
Reference documentation for the [Latest Released](http://rubydoc.info/gems/config_module/file/README.markdown) and [Edge Version](https://github.com/acook/config_module#readme) is available.
|
7
7
|
|
8
|
-
[![Gem Version](https://
|
9
|
-
[![
|
10
|
-
[![
|
11
|
-
[![
|
8
|
+
[![Gem Version](https://img.shields.io/gem/v/config_module.svg)](https://rubygems.org/gems/config_module)
|
9
|
+
[![Gem Downloads](https://img.shields.io/gem/dt/config_module.svg?maxAge=2592000)](https://rubygems.org/gems/config_module)
|
10
|
+
[![Build Status](https://travis-ci.org/acook/config_module.svg?branch=master)](https://travis-ci.org/acook/config_module)
|
11
|
+
[![Code Climate](https://codeclimate.com/github/acook/config_module/badges/gpa.svg)](https://codeclimate.com/github/acook/config_module)
|
12
|
+
[![Test Coverage](https://codeclimate.com/github/acook/config_module/badges/coverage.svg)](https://codeclimate.com/github/acook/config_module/coverage)
|
13
|
+
[![Dependency Status](https://gemnasium.com/badges/github.com/acook/config_module.svg)](https://gemnasium.com/github.com/acook/config_module)
|
12
14
|
|
13
15
|
Installation
|
14
16
|
------------
|
@@ -211,5 +213,5 @@ Who made this anyway?
|
|
211
213
|
|
212
214
|
I'm glad you asked!
|
213
215
|
|
214
|
-
Anthony M. Cook
|
216
|
+
Anthony M. Cook 2016
|
215
217
|
|
@@ -32,8 +32,8 @@ module ConfigModule
|
|
32
32
|
|
33
33
|
def load_namespaces_from tree
|
34
34
|
namespaces.inject(ConfigOption.wrap tree) do |subtree, ns|
|
35
|
-
if subtree.respond_to? ns
|
36
|
-
|
35
|
+
if ConfigOption === subtree && ns.respond_to?(:to_sym) && subtree.has_key?(ns)
|
36
|
+
ConfigOption.wrap subtree[ns]
|
37
37
|
else
|
38
38
|
raise(
|
39
39
|
InvalidNamespaceError.new(ns, subtree, caller),
|
File without changes
|
File without changes
|
File without changes
|
@@ -19,6 +19,10 @@ spec 'identifies the presence of keys' do
|
|
19
19
|
opt.has_key? :a
|
20
20
|
end
|
21
21
|
|
22
|
+
spec 'identifies the presence of keys as strings' do
|
23
|
+
opt.has_key? 'a'
|
24
|
+
end
|
25
|
+
|
22
26
|
spec 'identifies the lack of keys' do
|
23
27
|
opt.has_key?('nonexistant') == false
|
24
28
|
end
|
@@ -34,4 +38,3 @@ spec 'to_ary' do
|
|
34
38
|
error.class == ConfigModule::ConfigOption::NotFoundError
|
35
39
|
end
|
36
40
|
end
|
37
|
-
|
File without changes
|
File without changes
|
File without changes
|
@@ -22,6 +22,14 @@ spec 'specifying a namespace forces #config to return that subtree the first tim
|
|
22
22
|
symbolized_keys_from_full_config == table.keys
|
23
23
|
end
|
24
24
|
|
25
|
+
spec 'nested namespaces are handled properly' do
|
26
|
+
helper = ConfigModule::ConfigHelper.new
|
27
|
+
helper.config_file = './config/example.yml'
|
28
|
+
helper.namespaces = ['production', 'dictionary']
|
29
|
+
helper.config.has_key?('configuration') &&
|
30
|
+
helper.config[:configuration] == helper.raw_config['production']['dictionary']['configuration']
|
31
|
+
end
|
32
|
+
|
25
33
|
spec 'misconfigured namespaces provide useful errors' do
|
26
34
|
helper = ConfigModule::ConfigHelper.new
|
27
35
|
helper.config_file = './config/example.yml'
|
@@ -35,6 +43,19 @@ spec 'misconfigured namespaces provide useful errors' do
|
|
35
43
|
end
|
36
44
|
end
|
37
45
|
|
46
|
+
spec 'out of bounds namespaces are checked properly' do
|
47
|
+
helper = ConfigModule::ConfigHelper.new
|
48
|
+
helper.config_file = './config/example.yml'
|
49
|
+
helper.namespaces = ['production', 'foo', 'bar']
|
50
|
+
|
51
|
+
begin
|
52
|
+
helper.config
|
53
|
+
rescue ConfigModule::InvalidNamespaceError => error
|
54
|
+
error.is_a?(ConfigModule::InvalidNamespaceError) &&
|
55
|
+
error.message.include?('bar') || error.message
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
38
59
|
spec 'invalid namespaces which are ruby objects display properly' do
|
39
60
|
helper = ConfigModule::ConfigHelper.new
|
40
61
|
helper.config_file = './config/example.yml'
|
@@ -1,13 +1,11 @@
|
|
1
1
|
require 'bundler/setup'
|
2
|
-
if ENV['CI'] == 'true' then
|
3
|
-
require 'codeclimate-test-reporter'
|
4
|
-
CodeClimate::TestReporter.start
|
5
|
-
CodeClimate::TestReporter.configure do |config|
|
6
|
-
config.git_dir = `git rev-parse --show-toplevel`.strip
|
7
|
-
end
|
8
|
-
end
|
9
2
|
require 'uspec'
|
3
|
+
Bundler.require :default, :test
|
10
4
|
|
5
|
+
if ENV['CI'] == 'true' then
|
6
|
+
require 'simplecov'
|
7
|
+
SimpleCov.start
|
8
|
+
end
|
11
9
|
|
12
10
|
Dir.chdir File.dirname(__FILE__)
|
13
11
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: config_module
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anthony M. Cook
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-12-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: uspec
|
@@ -46,17 +46,17 @@ files:
|
|
46
46
|
- lib/config_module/config_option.rb
|
47
47
|
- lib/config_module/exceptions.rb
|
48
48
|
- lib/config_module/version.rb
|
49
|
-
-
|
50
|
-
-
|
51
|
-
-
|
52
|
-
-
|
53
|
-
-
|
54
|
-
-
|
55
|
-
-
|
56
|
-
-
|
57
|
-
-
|
58
|
-
-
|
59
|
-
-
|
49
|
+
- uspec/config/example.yml
|
50
|
+
- uspec/config/false_nil.yml
|
51
|
+
- uspec/config_helper_spec.rb
|
52
|
+
- uspec/config_module_spec.rb
|
53
|
+
- uspec/config_option_spec.rb
|
54
|
+
- uspec/example_config.rb
|
55
|
+
- uspec/exceptions_spec.rb
|
56
|
+
- uspec/method_missing_spec.rb
|
57
|
+
- uspec/namespace_spec.rb
|
58
|
+
- uspec/run_all_specs.rb
|
59
|
+
- uspec/spec_helper.rb
|
60
60
|
homepage: http://github.com/acook/config_module
|
61
61
|
licenses:
|
62
62
|
- MIT
|
@@ -78,20 +78,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
78
78
|
version: '0'
|
79
79
|
requirements: []
|
80
80
|
rubyforge_project:
|
81
|
-
rubygems_version: 2.
|
81
|
+
rubygems_version: 2.6.8
|
82
82
|
signing_key:
|
83
83
|
specification_version: 4
|
84
84
|
summary: Load important configuration files into their own modules!
|
85
|
-
test_files:
|
86
|
-
- spec/config/example.yml
|
87
|
-
- spec/config/false_nil.yml
|
88
|
-
- spec/config_helper_spec.rb
|
89
|
-
- spec/config_module_spec.rb
|
90
|
-
- spec/config_option_spec.rb
|
91
|
-
- spec/example_config.rb
|
92
|
-
- spec/exceptions_spec.rb
|
93
|
-
- spec/method_missing_spec.rb
|
94
|
-
- spec/namespace_spec.rb
|
95
|
-
- spec/run_all_specs.rb
|
96
|
-
- spec/spec_helper.rb
|
85
|
+
test_files: []
|
97
86
|
has_rdoc:
|