conferrable 1.0.3 → 1.0.4

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
- SHA1:
3
- metadata.gz: 540aa0627fba5b489ce2f93d6da830021ed7c9c3
4
- data.tar.gz: 8e1e82140cb2e202fae3ee82fad21650c50049db
2
+ SHA256:
3
+ metadata.gz: f92d8f5127c4ae292cb7bf8b9e7bd9600df9e71028cd31244dc334855c808be7
4
+ data.tar.gz: cf2d99d1a036e1f50f06b115d1d56403e58542a906d8b171cd3dbff5017cb162
5
5
  SHA512:
6
- metadata.gz: aa9e2aff2d7a5304d4b422f79389e13f382f1b307987074f4b5f5fa481e4e24c3d1f68f5c82aa76566246a031b0d2b370f96c90cb56c233abd087a492e67e1df
7
- data.tar.gz: 6b1efa372cfcbdbc409a9ceafeb4cb23be9a7cdb2266e524283f2657dc94abf0127025bcbdb4e3a7b18e35bf5052fa8e4c1c0a4ce970c657e0d83250baf3a207
6
+ metadata.gz: 6d18813bcbae5c777a0869a37a1a52cc63776112f5fdd004a177be75cef07c18663dbf5d6f0722a610e70ea2a0161e817152a9fec2d3be1dd2643fcf997a0847
7
+ data.tar.gz: cc6214c934b5dc269efcfc6c70a0d532c50685b5600acabb15be4a42663f48784095dc264234794c238e89f6eb7d5d4e2f5ec013a301e6c272790931547be465
data/.gitignore CHANGED
@@ -1,2 +1,4 @@
1
1
  .DS_Store
2
2
  *.gem
3
+ /tmp
4
+ /coverage
@@ -1,4 +1,8 @@
1
- inherit_from: .rubocop_todo.yml
2
-
3
1
  Metrics/LineLength:
4
2
  Max: 100
3
+
4
+ Metrics/BlockLength:
5
+ ExcludedMethods: ['it', 'describe', 'context', 'let', 'specify']
6
+
7
+ AllCops:
8
+ TargetRubyVersion: 2.3
@@ -1 +1 @@
1
- 2.3.7
1
+ 2.6.0
@@ -1,8 +1,20 @@
1
+ env:
2
+ global:
3
+ - CC_TEST_REPORTER_ID=d2049a4da7f1063141bf29853e71045d856a341f8e4462ffc236c8a81b4c29a2
1
4
  language: ruby
2
5
  rvm:
3
- - 2.3.1
4
- - 2.3.7
6
+ # Build on the latest stable of all supported Rubies (https://www.ruby-lang.org/en/downloads/):
7
+ - 2.3.8
8
+ - 2.4.5
9
+ - 2.5.3
10
+ - 2.6.0
5
11
  cache: bundler
12
+ before_script:
13
+ - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
14
+ - chmod +x ./cc-test-reporter
15
+ - ./cc-test-reporter before-build
6
16
  script:
7
17
  - bundle exec rubocop
8
18
  - bundle exec rspec
19
+ after_script:
20
+ - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
@@ -0,0 +1,9 @@
1
+ # 1.0.4 (January 30th, 2019)
2
+
3
+ Maintenance Release
4
+
5
+ * Added bin/console script
6
+ * Added CHANGELOG
7
+ * Updated README with publication steps, additional testing steps
8
+ * Bumped minimum Ruby to 2.3.8
9
+ * Added Guard
@@ -1,19 +1,56 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- conferrable (1.0.3)
4
+ conferrable (1.0.4)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
+ ansi (1.5.0)
9
10
  ast (2.4.0)
11
+ coderay (1.1.2)
10
12
  diff-lcs (1.3)
11
- jaro_winkler (1.5.1)
12
- parallel (1.12.1)
13
- parser (2.5.1.2)
13
+ docile (1.3.1)
14
+ ffi (1.10.0)
15
+ formatador (0.2.5)
16
+ guard (2.15.0)
17
+ formatador (>= 0.2.4)
18
+ listen (>= 2.7, < 4.0)
19
+ lumberjack (>= 1.0.12, < 2.0)
20
+ nenv (~> 0.1)
21
+ notiffany (~> 0.0)
22
+ pry (>= 0.9.12)
23
+ shellany (~> 0.0)
24
+ thor (>= 0.18.1)
25
+ guard-compat (1.2.1)
26
+ guard-rspec (4.7.3)
27
+ guard (~> 2.1)
28
+ guard-compat (~> 1.1)
29
+ rspec (>= 2.99.0, < 4.0)
30
+ hirb (0.7.3)
31
+ jaro_winkler (1.5.2)
32
+ json (2.1.0)
33
+ listen (3.1.5)
34
+ rb-fsevent (~> 0.9, >= 0.9.4)
35
+ rb-inotify (~> 0.9, >= 0.9.7)
36
+ ruby_dep (~> 1.2)
37
+ lumberjack (1.0.13)
38
+ method_source (0.9.2)
39
+ nenv (0.3.0)
40
+ notiffany (0.1.1)
41
+ nenv (~> 0.1)
42
+ shellany (~> 0.0)
43
+ parallel (1.13.0)
44
+ parser (2.6.0.0)
14
45
  ast (~> 2.4.0)
15
46
  powerpack (0.1.2)
47
+ pry (0.12.2)
48
+ coderay (~> 1.1.0)
49
+ method_source (~> 0.9.0)
16
50
  rainbow (3.0.0)
51
+ rb-fsevent (0.10.3)
52
+ rb-inotify (0.10.0)
53
+ ffi (~> 1.0)
17
54
  rspec (3.8.0)
18
55
  rspec-core (~> 3.8.0)
19
56
  rspec-expectations (~> 3.8.0)
@@ -27,24 +64,39 @@ GEM
27
64
  diff-lcs (>= 1.2.0, < 2.0)
28
65
  rspec-support (~> 3.8.0)
29
66
  rspec-support (3.8.0)
30
- rubocop (0.59.2)
67
+ rubocop (0.63.1)
31
68
  jaro_winkler (~> 1.5.1)
32
69
  parallel (~> 1.10)
33
70
  parser (>= 2.5, != 2.5.1.1)
34
71
  powerpack (~> 0.1)
35
72
  rainbow (>= 2.2.2, < 4.0)
36
73
  ruby-progressbar (~> 1.7)
37
- unicode-display_width (~> 1.0, >= 1.0.1)
74
+ unicode-display_width (~> 1.4.0)
38
75
  ruby-progressbar (1.10.0)
39
- unicode-display_width (1.4.0)
76
+ ruby_dep (1.5.0)
77
+ shellany (0.0.1)
78
+ simplecov (0.16.1)
79
+ docile (~> 1.1)
80
+ json (>= 1.8, < 3)
81
+ simplecov-html (~> 0.10.0)
82
+ simplecov-console (0.4.2)
83
+ ansi
84
+ hirb
85
+ simplecov
86
+ simplecov-html (0.10.2)
87
+ thor (0.20.3)
88
+ unicode-display_width (1.4.1)
40
89
 
41
90
  PLATFORMS
42
91
  ruby
43
92
 
44
93
  DEPENDENCIES
45
94
  conferrable!
95
+ guard-rspec (~> 4.7)
46
96
  rspec
47
- rubocop (~> 0.59.2)
97
+ rubocop (~> 0.63.1)
98
+ simplecov (~> 0.16.1)
99
+ simplecov-console (~> 0.4.2)
48
100
 
49
101
  BUNDLED WITH
50
- 1.16.3
102
+ 1.17.2
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ guard :rspec, cmd: 'bundle exec rspec' do
4
+ require 'guard/rspec/dsl'
5
+ dsl = Guard::RSpec::Dsl.new(self)
6
+
7
+ # RSpec files
8
+ rspec = dsl.rspec
9
+ watch(rspec.spec_helper) { rspec.spec_dir }
10
+ watch(rspec.spec_support) { rspec.spec_dir }
11
+ watch(rspec.spec_files)
12
+
13
+ # Ruby files
14
+ ruby = dsl.ruby
15
+ dsl.watch_spec_files_for(ruby.lib_files)
16
+ end
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Conferrable
2
2
 
3
- [![Build Status](https://travis-ci.org/bluemarblepayroll/conferrable.svg?branch=master)](https://travis-ci.org/bluemarblepayroll/conferrable)
3
+ [![Gem Version](https://badge.fury.io/rb/conferrable.svg)](https://badge.fury.io/rb/conferrable) [![Build Status](https://travis-ci.org/bluemarblepayroll/conferrable.svg?branch=master)](https://travis-ci.org/bluemarblepayroll/conferrable) [![Maintainability](https://api.codeclimate.com/v1/badges/4149dfc2579b9345c4be/maintainability)](https://codeclimate.com/github/bluemarblepayroll/conferrable/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/4149dfc2579b9345c4be/test_coverage)](https://codeclimate.com/github/bluemarblepayroll/conferrable/test_coverage) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
4
4
 
5
5
  We have seen our applications gain more and more static configuration files over time. A common library we use on a daily basis is these configuration file loaders. Conferrable standardizes how we interact with these static YAML configuration files. It offers a simple and extendable API for dealing with the following scenarios:
6
6
 
@@ -87,9 +87,37 @@ Basic steps to take to get this repository compiling:
87
87
  To execute the test suite run:
88
88
 
89
89
  ````
90
- rspec
90
+ bundle exec rspec spec --format documentation
91
91
  ````
92
92
 
93
+ Alternatively, you can have Guard watch for changes:
94
+
95
+ ````
96
+ bundle exec guard
97
+ ````
98
+
99
+ Also, do not forget to run Rubocop:
100
+
101
+ ````
102
+ bundle exec rubocop
103
+ ````
104
+
105
+ ### Publishing
106
+
107
+ Note: ensure you have proper authorization before trying to publish new versions.
108
+
109
+ After code changes have successfully gone through the Pull Request review process then the following steps should be followed for publishing new versions:
110
+
111
+ 1. Merge Pull Request into master
112
+ 2. Update ```lib/conferrable/version.rb``` using [semantic versioning](https://semver.org/)
113
+ 3. Install dependencies: ```bundle```
114
+ 4. Update ```CHANGELOG.md``` with release notes
115
+ 5. Commit & push master to remote and ensure CI builds master successfully
116
+ 6. Build the project locally: `gem build conferrable`
117
+ 7. Publish package to RubyGems: `gem push conferrable-X.gem` where X is the version to push
118
+ 8. Tag master with new version: `git tag <version>`
119
+ 9. Push tags remotely: `git push origin --tags`
120
+
93
121
  ## License
94
122
 
95
123
  This project is MIT Licensed.
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'bundler/setup'
5
+ require 'conferrable'
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require 'irb'
15
+ IRB.start
@@ -21,8 +21,11 @@ Gem::Specification.new do |s|
21
21
  s.homepage = 'https://github.com/bluemarblepayroll/conferrable'
22
22
  s.license = 'MIT'
23
23
 
24
- s.required_ruby_version = '>= 2.3.1'
24
+ s.required_ruby_version = '>= 2.3.8'
25
25
 
26
+ s.add_development_dependency('guard-rspec', '~>4.7')
26
27
  s.add_development_dependency('rspec')
27
- s.add_development_dependency('rubocop', '~> 0.59.2')
28
+ s.add_development_dependency('rubocop', '~>0.63.1')
29
+ s.add_development_dependency('simplecov', '~>0.16.1')
30
+ s.add_development_dependency('simplecov-console', '~>0.4.2')
28
31
  end
@@ -17,8 +17,8 @@ require_relative 'entry'
17
17
 
18
18
  # This is the main module that contains the class-level methods that define the main API.
19
19
  module Conferrable
20
- GET_PREFIX_MATCHER_REGEX = /^get_(.+)$/
21
- GET_PREFIX_REGEX = /^get_/
20
+ GET_PREFIX_MATCHER_REGEX = /^get_(.+)$/.freeze
21
+ GET_PREFIX_REGEX = /^get_/.freeze
22
22
 
23
23
  class << self
24
24
  def clear!
@@ -15,20 +15,30 @@ module Conferrable
15
15
  Array(filenames).flatten.map do |filename|
16
16
  next unless filename && filename.to_s.length.positive?
17
17
 
18
- if File.exist?(filename) && File.directory?(filename)
19
- dir_name = File.join(filename, '**', '*.yml.erb')
20
- Dir.glob(dir_name).reject { |f| File.directory?(f) }
21
- elsif File.exist?(filename)
22
- filename
23
- else
24
- raise ArgumentError, "Cannot find file: #{filename} => #{File.expand_path(filename)}"
25
- end
18
+ list(filename)
26
19
  end.flatten
27
20
  end
28
21
 
29
22
  def read(filename)
30
23
  YAML.safe_load(ERB.new(IO.read(filename)).result)
31
24
  end
25
+
26
+ private
27
+
28
+ def list(filename)
29
+ if File.exist?(filename) && File.directory?(filename)
30
+ glob_files_only(filename)
31
+ elsif File.exist?(filename)
32
+ filename
33
+ else
34
+ raise ArgumentError, "Cannot find file: #{filename} => #{File.expand_path(filename)}"
35
+ end
36
+ end
37
+
38
+ def glob_files_only(filename)
39
+ dir_name = File.join(filename, '**', '*.yml.erb')
40
+ Dir.glob(dir_name).reject { |f| File.directory?(f) }
41
+ end
32
42
  end
33
43
  end
34
44
  end
@@ -8,5 +8,5 @@
8
8
  #
9
9
 
10
10
  module Conferrable
11
- VERSION = '1.0.3'
11
+ VERSION = '1.0.4'
12
12
  end
@@ -7,7 +7,7 @@
7
7
  # LICENSE file in the root directory of this source tree.
8
8
  #
9
9
 
10
- require './lib/conferrable'
10
+ require './spec/spec_helper'
11
11
 
12
12
  describe Conferrable do
13
13
  let(:default_file_path) { './config/file1.yml.erb' }
@@ -7,7 +7,7 @@
7
7
  # LICENSE file in the root directory of this source tree.
8
8
  #
9
9
 
10
- require './lib/conferrable'
10
+ require './spec/spec_helper'
11
11
 
12
12
  describe Conferrable::Configuration do
13
13
  it 'should accept no initialization arguments' do
@@ -7,7 +7,7 @@
7
7
  # LICENSE file in the root directory of this source tree.
8
8
  #
9
9
 
10
- require './lib/conferrable'
10
+ require './spec/spec_helper'
11
11
 
12
12
  describe Conferrable::Entry do
13
13
  let(:default_file_path) { './config/file1.yml.erb' }
@@ -7,7 +7,7 @@
7
7
  # LICENSE file in the root directory of this source tree.
8
8
  #
9
9
 
10
- require './lib/conferrable'
10
+ require './spec/spec_helper'
11
11
 
12
12
  describe Conferrable::FileBasedConfiguration do
13
13
  let(:file1_path) { File.expand_path('spec/files/file1.yml.erb') }
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ #
4
+ # Copyright (c) 2018-present, Blue Marble Payroll, LLC
5
+ #
6
+ # This source code is licensed under the MIT license found in the
7
+ # LICENSE file in the root directory of this source tree.
8
+ #
9
+
10
+ require 'simplecov'
11
+ require 'simplecov-console'
12
+
13
+ require './lib/conferrable'
14
+
15
+ SimpleCov.formatter = SimpleCov::Formatter::Console
16
+ SimpleCov.start
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: conferrable
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Ruggio
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-09-28 00:00:00.000000000 Z
11
+ date: 2019-02-04 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: guard-rspec
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '4.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '4.7'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: rspec
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -30,34 +44,65 @@ dependencies:
30
44
  requirements:
31
45
  - - "~>"
32
46
  - !ruby/object:Gem::Version
33
- version: 0.59.2
47
+ version: 0.63.1
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 0.63.1
55
+ - !ruby/object:Gem::Dependency
56
+ name: simplecov
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 0.16.1
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 0.16.1
69
+ - !ruby/object:Gem::Dependency
70
+ name: simplecov-console
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 0.4.2
34
76
  type: :development
35
77
  prerelease: false
36
78
  version_requirements: !ruby/object:Gem::Requirement
37
79
  requirements:
38
80
  - - "~>"
39
81
  - !ruby/object:Gem::Version
40
- version: 0.59.2
82
+ version: 0.4.2
41
83
  description: |2
42
84
  We have seen our applications gain more and more static configuration files over time.
43
85
  A common library we use on a daily basis is these configuration file loaders.
44
86
  Conferrable standardizes how we interact with these static YAML configuration files.
45
87
  email:
46
88
  - mruggio@bluemarblepayroll.com
47
- executables: []
89
+ executables:
90
+ - console
48
91
  extensions: []
49
92
  extra_rdoc_files: []
50
93
  files:
51
94
  - ".editorconfig"
52
95
  - ".gitignore"
53
96
  - ".rubocop.yml"
54
- - ".rubocop_todo.yml"
55
97
  - ".ruby-version"
56
98
  - ".travis.yml"
99
+ - CHANGELOG.md
57
100
  - Gemfile
58
101
  - Gemfile.lock
102
+ - Guardfile
59
103
  - LICENSE
60
104
  - README.md
105
+ - bin/console
61
106
  - conferrable.gemspec
62
107
  - lib/conferrable.rb
63
108
  - lib/conferrable/conferrable.rb
@@ -70,6 +115,7 @@ files:
70
115
  - spec/configuration_spec.rb
71
116
  - spec/entry_spec.rb
72
117
  - spec/file_based_configuration_spec.rb
118
+ - spec/spec_helper.rb
73
119
  homepage: https://github.com/bluemarblepayroll/conferrable
74
120
  licenses:
75
121
  - MIT
@@ -82,15 +128,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
82
128
  requirements:
83
129
  - - ">="
84
130
  - !ruby/object:Gem::Version
85
- version: 2.3.1
131
+ version: 2.3.8
86
132
  required_rubygems_version: !ruby/object:Gem::Requirement
87
133
  requirements:
88
134
  - - ">="
89
135
  - !ruby/object:Gem::Version
90
136
  version: '0'
91
137
  requirements: []
92
- rubyforge_project:
93
- rubygems_version: 2.5.2.3
138
+ rubygems_version: 3.0.1
94
139
  signing_key:
95
140
  specification_version: 4
96
141
  summary: Simple YAML file-based configuration management
@@ -99,3 +144,4 @@ test_files:
99
144
  - spec/configuration_spec.rb
100
145
  - spec/entry_spec.rb
101
146
  - spec/file_based_configuration_spec.rb
147
+ - spec/spec_helper.rb
@@ -1,22 +0,0 @@
1
- # This configuration was generated by
2
- # `rubocop --auto-gen-config`
3
- # on 2018-09-28 08:27:14 -0500 using RuboCop version 0.59.2.
4
- # The point is for the user to remove these configuration records
5
- # one by one as the offenses are removed from the code base.
6
- # Note that changes in the inspected code, or installation of new
7
- # versions of RuboCop, may require this file to be generated again.
8
-
9
- # Offense count: 1
10
- Metrics/AbcSize:
11
- Max: 17
12
-
13
- # Offense count: 2
14
- # Configuration parameters: CountComments, ExcludedMethods.
15
- # ExcludedMethods: refine
16
- Metrics/BlockLength:
17
- Max: 45
18
-
19
- # Offense count: 1
20
- # Configuration parameters: CountComments, ExcludedMethods.
21
- Metrics/MethodLength:
22
- Max: 11