config_module 1.1.1 → 1.2.0

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: e3e25ba89be735453a4e316b05519c3730690b10
4
- data.tar.gz: 0233e576c411345a988e23d42b0239dc033b0634
3
+ metadata.gz: ed7e142f390987296b9b65ab5f99c425e5755263
4
+ data.tar.gz: c4a0225b21f18c78835fd679e08d3f25144063a9
5
5
  SHA512:
6
- metadata.gz: 5ed89f0d59b74e3ef74bd1a08a9c730a5fc7ced78f9a5f3246fc5ca1add8a02a059c01cde60ac14c95858bae46cab1bdd1a7fa5418cdf349a5e4ca341527b934
7
- data.tar.gz: 0bdb93b5a956fcb10a77f41c9e9f11bad69f92ab9479c05f9792e58442723dbbff1ebb66840b708819f3181b1d6f85869f41a6bff8da7452127cc94623549f28
6
+ metadata.gz: 9b4cdfea0939b4e857f9c86a7feb71a00d6a7f07b61fddeffcfc5c626f171c890915c7f50fcc889ba68016f0627c3febc47949846c0137a50b9b64fd72db4169
7
+ data.tar.gz: e6ffacfc3f4af409faa4e36847a8069e72047fe2c4e1f1e173bed747da0459a77ddf3cc677c58e8cdf571406d4dd0707d57e938b03ee795a2b01985cbe8990ed
data/.codeclimate.yml ADDED
@@ -0,0 +1,14 @@
1
+ #engines:
2
+ # rubocop:
3
+ # enabled: true
4
+ #
5
+ #ratings:
6
+ # paths:
7
+ # - lib/**
8
+ # - "**.rb"
9
+
10
+ languages:
11
+ Ruby: true
12
+
13
+ exclude_paths:
14
+ - spec/**/*
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ config_module
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ ruby-2.2.3
data/.travis.yml CHANGED
@@ -1,12 +1,27 @@
1
1
  language: ruby
2
2
  rvm:
3
+ - 2.2.3
3
4
  - 2.0.0
4
5
  - 1.9.3
5
6
  - 1.9.2
7
+
6
8
  - ruby-head
7
- - rbx-19mode
9
+ - jruby-19mode
10
+
8
11
  script: bundle exec ruby spec/run_all_specs.rb
9
12
  before_install:
10
13
  - gem update bundler
11
14
  before_script:
12
15
  - bundle exec gem list
16
+
17
+ matrix:
18
+ allow_failures:
19
+ - rvm: ruby-head
20
+ - rvm: jruby-19mode
21
+
22
+ sudo: false
23
+
24
+ addons:
25
+ code_climate:
26
+ repo_token:
27
+ secure: "WonrzRifssblPi89TfgQvfRlWGfh8TqYtS0Vs6vSk8GfHwUIV1doaW9utQ0cvQrYNWS6xQzRdwk1QOwzvDhL0PnHSPd3bdSXJ4EW5RVWZNk4rsO4b9S1ksSL8ilSndIuJ41cfUvJPMpTvtc+cZnBehGb8rrf9sfV1hP8zq2Nn+o="
data/Gemfile CHANGED
@@ -2,3 +2,19 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in config_module.gemspec
4
4
  gemspec
5
+
6
+ if ENV['CI'] == 'true' then
7
+ gem 'codeclimate-test-reporter', group: 'test'
8
+ else
9
+ group :development do
10
+ gem 'travis'
11
+
12
+ gem 'pry'
13
+ gem 'pry-doc'
14
+ gem 'pry-theme'
15
+ gem 'pry-rescue'
16
+ gem 'pry-byebug'
17
+ gem 'pry-coolline'
18
+ gem 'pry-stack_explorer'
19
+ end
20
+ end
data/README.markdown CHANGED
@@ -5,6 +5,7 @@ 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)
8
9
  [![Build Status](https://travis-ci.org/acook/config_module.png?branch=master)](https://travis-ci.org/acook/config_module)
9
10
  [![Code Climate](https://codeclimate.com/github/acook/config_module.png)](https://codeclimate.com/github/acook/config_module)
10
11
  [![Dependency Status](https://gemnasium.com/acook/config_module.png)](https://gemnasium.com/acook/config_module)
@@ -4,21 +4,19 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require 'config_module/version'
5
5
 
6
6
  Gem::Specification.new do |gem|
7
- gem.name = "config_module"
7
+ gem.name = 'config_module'
8
8
  gem.version = ConfigModule::VERSION
9
- gem.authors = ["Anthony Cook"]
10
- gem.email = ["anthonymichaelcook@gmail.com"]
9
+ gem.authors = ['Anthony M. Cook']
10
+ gem.email = ['github@anthonymcook.com']
11
11
  gem.description = %q{Wrap a configuration file in a module for easy use throughout your application. Inspired by Rails.}
12
12
  gem.summary = %q{Load important configuration files into their own modules!}
13
- gem.homepage = "http://github.com/acook/config_module"
13
+ gem.homepage = 'http://github.com/acook/config_module'
14
14
  gem.licenses = %w{MIT LGPL-3}
15
15
 
16
16
  gem.files = `git ls-files`.split($/)
17
17
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
18
18
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
19
- gem.require_paths = ["lib"]
19
+ gem.require_paths = ['lib']
20
20
 
21
21
  gem.add_development_dependency 'uspec'
22
- gem.add_development_dependency 'pry'
23
- gem.add_development_dependency 'pry-theme'
24
22
  end
@@ -41,6 +41,11 @@ module ConfigModule
41
41
  )
42
42
  end
43
43
  end
44
+ rescue TypeError => error
45
+ raise(
46
+ InvalidNamespaceError.new(namespaces.first, self, caller),
47
+ "Namespace must be a string or symbol, instead it was: #{namespaces.first.class}", caller(6)
48
+ )
44
49
  end
45
50
 
46
51
  def namespaces
@@ -4,7 +4,11 @@ module ConfigModule
4
4
  @name, @object, @details = name, object, details
5
5
  @custom_message = "invalid #{identifier} `#{name}' for #{object_info}"
6
6
  end
7
- attr :name, :object, :custom_message, :details
7
+ attr :name, :object, :details
8
+
9
+ def custom_message
10
+ @custom_message + "\n#{super_message}"
11
+ end
8
12
 
9
13
  alias_method :super_message, :message
10
14
  alias_method :message, :custom_message
@@ -1,3 +1,3 @@
1
1
  module ConfigModule
2
- VERSION = '1.1.1'
2
+ VERSION = '1.2.0'
3
3
  end
@@ -0,0 +1,6 @@
1
+ require_relative 'spec_helper'
2
+
3
+ spec 'display appropriate error when the object is a class' do
4
+ error = ConfigModule::InvalidNamespaceError.new :foo, Array
5
+ error.message.include? 'Array'
6
+ end
@@ -30,7 +30,20 @@ spec 'misconfigured namespaces provide useful errors' do
30
30
  begin
31
31
  helper.config
32
32
  rescue ConfigModule::InvalidNamespaceError => error
33
- error.super_message == 'No subkey with name: "nonexistant"' &&
34
- error.message == "invalid namespace `nonexistant' for instance of `ConfigModule::ConfigOption < OpenStruct'"
33
+ error.is_a?(ConfigModule::InvalidNamespaceError) &&
34
+ error.message.include?('nonexistant') || error.message
35
+ end
36
+ end
37
+
38
+ spec 'invalid namespaces which are ruby objects display properly' do
39
+ helper = ConfigModule::ConfigHelper.new
40
+ helper.config_file = './config/example.yml'
41
+ helper.namespaces = [Array,Hash]
42
+
43
+ begin
44
+ helper.config
45
+ rescue ConfigModule::InvalidNamespaceError => error
46
+ error.is_a?(ConfigModule::InvalidNamespaceError) &&
47
+ error.message.include?('Array') || error.message
35
48
  end
36
49
  end
data/spec/spec_helper.rb CHANGED
@@ -1,6 +1,14 @@
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
2
9
  require 'uspec'
3
10
 
11
+
4
12
  Dir.chdir File.dirname(__FILE__)
5
13
 
6
14
  require_relative '../lib/config_module'
metadata CHANGED
@@ -1,68 +1,42 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: config_module
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
- - Anthony Cook
7
+ - Anthony M. Cook
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-06-04 00:00:00.000000000 Z
11
+ date: 2015-10-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: uspec
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
25
- - !ruby/object:Gem::Version
26
- version: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: pry
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - '>='
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - '>='
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: pry-theme
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - '>='
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - '>='
24
+ - - ">="
53
25
  - !ruby/object:Gem::Version
54
26
  version: '0'
55
27
  description: Wrap a configuration file in a module for easy use throughout your application.
56
28
  Inspired by Rails.
57
29
  email:
58
- - anthonymichaelcook@gmail.com
30
+ - github@anthonymcook.com
59
31
  executables: []
60
32
  extensions: []
61
33
  extra_rdoc_files: []
62
34
  files:
63
- - .gitignore
64
- - .rvmrc
65
- - .travis.yml
35
+ - ".codeclimate.yml"
36
+ - ".gitignore"
37
+ - ".ruby-gemset"
38
+ - ".ruby-version"
39
+ - ".travis.yml"
66
40
  - Gemfile
67
41
  - README.markdown
68
42
  - Rakefile
@@ -78,6 +52,7 @@ files:
78
52
  - spec/config_module_spec.rb
79
53
  - spec/config_option_spec.rb
80
54
  - spec/example_config.rb
55
+ - spec/exceptions_spec.rb
81
56
  - spec/method_missing_spec.rb
82
57
  - spec/namespace_spec.rb
83
58
  - spec/run_all_specs.rb
@@ -93,17 +68,17 @@ require_paths:
93
68
  - lib
94
69
  required_ruby_version: !ruby/object:Gem::Requirement
95
70
  requirements:
96
- - - '>='
71
+ - - ">="
97
72
  - !ruby/object:Gem::Version
98
73
  version: '0'
99
74
  required_rubygems_version: !ruby/object:Gem::Requirement
100
75
  requirements:
101
- - - '>='
76
+ - - ">="
102
77
  - !ruby/object:Gem::Version
103
78
  version: '0'
104
79
  requirements: []
105
80
  rubyforge_project:
106
- rubygems_version: 2.0.0
81
+ rubygems_version: 2.4.8
107
82
  signing_key:
108
83
  specification_version: 4
109
84
  summary: Load important configuration files into their own modules!
@@ -114,7 +89,9 @@ test_files:
114
89
  - spec/config_module_spec.rb
115
90
  - spec/config_option_spec.rb
116
91
  - spec/example_config.rb
92
+ - spec/exceptions_spec.rb
117
93
  - spec/method_missing_spec.rb
118
94
  - spec/namespace_spec.rb
119
95
  - spec/run_all_specs.rb
120
96
  - spec/spec_helper.rb
97
+ has_rdoc:
data/.rvmrc DELETED
@@ -1 +0,0 @@
1
- rvm --create ruby-2.0.0-p0@config_module