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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ed7e142f390987296b9b65ab5f99c425e5755263
4
- data.tar.gz: c4a0225b21f18c78835fd679e08d3f25144063a9
3
+ metadata.gz: ad1e44032bb7a0030ccd3966f6b4bb502489212f
4
+ data.tar.gz: 4ebabc3fccfc9fe8ecaa7429b8018aecf9e72e32
5
5
  SHA512:
6
- metadata.gz: 9b4cdfea0939b4e857f9c86a7feb71a00d6a7f07b61fddeffcfc5c626f171c890915c7f50fcc889ba68016f0627c3febc47949846c0137a50b9b64fd72db4169
7
- data.tar.gz: e6ffacfc3f4af409faa4e36847a8069e72047fe2c4e1f1e173bed747da0459a77ddf3cc677c58e8cdf571406d4dd0707d57e938b03ee795a2b01985cbe8990ed
6
+ metadata.gz: 0a3c4126289d2beb05d12677ea2e7920f83a3a4efbbe432714ab42b1fb947d3739d260f0060da1e43c5e788dbaea98c85f5824bde24bf286637f06bee09b1f30
7
+ data.tar.gz: 3483c7da45fb8fd86d78dc94a1b9e53995dc41eb6881cd56c0949e734bd20ac1df5fd960006b9419c4e6a4ae186eae29b240c127d9c8fa1a826ad904282f580c
@@ -1,14 +1,16 @@
1
- #engines:
2
- # rubocop:
3
- # enabled: true
4
- #
5
- #ratings:
6
- # paths:
7
- # - lib/**
8
- # - "**.rb"
9
-
10
- languages:
11
- Ruby: true
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
- - spec/**/*
16
+ - "uspec/**/*"
@@ -1 +1 @@
1
- ruby-2.2.3
1
+ ruby-2.3.3
@@ -1,26 +1,28 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.2.3
4
- - 2.0.0
5
- - 1.9.3
6
- - 1.9.2
3
+ - 2.3.3
4
+ - 2.2
5
+ - 2.1
6
+ - 2.0
7
7
 
8
8
  - ruby-head
9
- - jruby-19mode
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-19mode
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
@@ -4,7 +4,10 @@ source 'https://rubygems.org'
4
4
  gemspec
5
5
 
6
6
  if ENV['CI'] == 'true' then
7
- gem 'codeclimate-test-reporter', group: 'test'
7
+ group :test do
8
+ gem 'simplecov'
9
+ gem 'codeclimate-test-reporter', '~> 1.0.0'
10
+ end
8
11
  else
9
12
  group :development do
10
13
  gem 'travis'
@@ -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://badge.fury.io/rb/config_module.png)](http://badge.fury.io/rb/config_module)
9
- [![Build Status](https://travis-ci.org/acook/config_module.png?branch=master)](https://travis-ci.org/acook/config_module)
10
- [![Code Climate](https://codeclimate.com/github/acook/config_module.png)](https://codeclimate.com/github/acook/config_module)
11
- [![Dependency Status](https://gemnasium.com/acook/config_module.png)](https://gemnasium.com/acook/config_module)
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 2013
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 then
36
- subtree.send ns
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),
@@ -20,7 +20,7 @@ module ConfigModule
20
20
  end
21
21
 
22
22
  def has_key? key
23
- @table.has_key? key
23
+ @table.has_key? key.to_sym
24
24
  end
25
25
 
26
26
  def method_missing name, *args, &block
@@ -1,3 +1,3 @@
1
1
  module ConfigModule
2
- VERSION = '1.2.0'
2
+ VERSION = '1.2.1'
3
3
  end
File without changes
File without changes
@@ -10,4 +10,3 @@ spec 'method_missing_handler traces back to the caller' do
10
10
  error.backtrace.to_s.include? "spec/config_helper_spec.rb:6:in"
11
11
  end
12
12
  end
13
-
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,5 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
1
3
  require_relative 'spec_helper'
2
4
 
3
5
  Dir['*_spec.rb'].each do |filename|
4
- require_relative filename
6
+ require File.absolute_path(filename)
5
7
  end
@@ -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.0
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: 2015-10-03 00:00:00.000000000 Z
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
- - spec/config/example.yml
50
- - spec/config/false_nil.yml
51
- - spec/config_helper_spec.rb
52
- - spec/config_module_spec.rb
53
- - spec/config_option_spec.rb
54
- - spec/example_config.rb
55
- - spec/exceptions_spec.rb
56
- - spec/method_missing_spec.rb
57
- - spec/namespace_spec.rb
58
- - spec/run_all_specs.rb
59
- - spec/spec_helper.rb
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.4.8
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: