conifer 1.2.0 → 2.0.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
  SHA256:
3
- metadata.gz: 520bd98270d714e155b05def5414531da4568094fae4266bcea73327f29d8a2e
4
- data.tar.gz: ffdb5f410b458f83d22dc6fbf450c46b056cd09532bf42059ab8391db4e0340c
3
+ metadata.gz: 6d91f2c9c3d4253a4772d4a5a9cbca13f5a3313b4158e598929aa0797e6e9f0d
4
+ data.tar.gz: b21e1ae6db73299773d4cb7804fb83ef9c0febe3d68b7cf4cd6269de12b3ad9e
5
5
  SHA512:
6
- metadata.gz: 9d9b2b3f1c21db80010ea8ca424b44e859da81fefddf26be66a30aa91c96fe1f1ddcc65be465160dced4978e93932978545dafc3b4efd0a8313b9ee654e53eb0
7
- data.tar.gz: fc9c43b0a7f6d89881e50a5e9e10c79f3864c2c5ceee1ddc19ca6153f72be811416d695782914b0f1c5564a581f7d8893c58dc82e91386f6189bc94cb0998430
6
+ metadata.gz: 5863b2cdefb74a782c170d366c97bc1917cddafd24d95cda9423585b16b7db991a01fd3cc9f0dd649d727e934fca9abe1d652cdc3a0145a4e4d5180787e65df2
7
+ data.tar.gz: a76f8bc190504af328f4a20aac8377c64a3995aab245e1dfcb139cdc7e2f76ce55b09a7021362a44265633ce70bd2ec43bbbce7baffd44d70498703505c950eb
@@ -10,21 +10,22 @@ jobs:
10
10
  strategy:
11
11
  matrix:
12
12
  ruby:
13
- - 2.6.x
14
- - 2.7.x
13
+ - '2.6'
14
+ - '2.7'
15
+ - '3.0'
16
+ - '3.1'
15
17
 
16
18
  steps:
17
19
  - uses: actions/checkout@v2
20
+
18
21
  - name: Set up Ruby
19
- uses: actions/setup-ruby@v1
22
+ uses: ruby/setup-ruby@v1
20
23
  with:
21
24
  ruby-version: ${{ matrix.ruby }}
22
- - name: Configure Bundler
23
- run: |
24
- gem install bundler -v 1.17.3 --no-document
25
- bundle install --jobs 4 --retry 3
25
+ bundler-cache: true
26
+
26
27
  - name: Run tests with RSpec
27
- uses: paambaati/codeclimate-action@v2.5.3
28
+ uses: paambaati/codeclimate-action@v2.7.5
28
29
  env:
29
30
  CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
30
31
  with:
data/.rubocop.yml CHANGED
@@ -2,6 +2,7 @@ require:
2
2
  - rubocop-rspec
3
3
 
4
4
  AllCops:
5
+ NewCops: enable
5
6
  TargetRubyVersion: 2.6
6
7
 
7
8
  Layout/LineLength:
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.6.5
1
+ 3.0.0
data/.tool-versions ADDED
@@ -0,0 +1 @@
1
+ ruby 3.1.2
data/Gemfile.lock CHANGED
@@ -1,66 +1,72 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- conifer (1.2.0)
4
+ conifer (2.0.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- ast (2.4.0)
10
- climate_control (0.2.0)
11
- diff-lcs (1.3)
12
- docile (1.3.2)
13
- jaro_winkler (1.5.4)
14
- json (2.3.0)
15
- parallel (1.19.1)
16
- parser (2.7.0.3)
17
- ast (~> 2.4.0)
9
+ ast (2.4.2)
10
+ climate_control (1.0.0)
11
+ diff-lcs (1.4.4)
12
+ docile (1.3.5)
13
+ parallel (1.21.0)
14
+ parser (3.0.3.2)
15
+ ast (~> 2.4.1)
18
16
  rainbow (3.0.0)
19
- rake (13.0.1)
20
- rexml (3.2.4)
21
- rspec (3.8.0)
22
- rspec-core (~> 3.8.0)
23
- rspec-expectations (~> 3.8.0)
24
- rspec-mocks (~> 3.8.0)
25
- rspec-core (3.8.2)
26
- rspec-support (~> 3.8.0)
27
- rspec-expectations (3.8.4)
17
+ rake (13.0.3)
18
+ regexp_parser (2.2.0)
19
+ rexml (3.2.5)
20
+ rspec (3.10.0)
21
+ rspec-core (~> 3.10.0)
22
+ rspec-expectations (~> 3.10.0)
23
+ rspec-mocks (~> 3.10.0)
24
+ rspec-core (3.10.1)
25
+ rspec-support (~> 3.10.0)
26
+ rspec-expectations (3.10.1)
28
27
  diff-lcs (>= 1.2.0, < 2.0)
29
- rspec-support (~> 3.8.0)
30
- rspec-mocks (3.8.1)
28
+ rspec-support (~> 3.10.0)
29
+ rspec-mocks (3.10.2)
31
30
  diff-lcs (>= 1.2.0, < 2.0)
32
- rspec-support (~> 3.8.0)
33
- rspec-support (3.8.2)
34
- rubocop (0.80.0)
35
- jaro_winkler (~> 1.5.1)
31
+ rspec-support (~> 3.10.0)
32
+ rspec-support (3.10.2)
33
+ rubocop (1.24.0)
36
34
  parallel (~> 1.10)
37
- parser (>= 2.7.0.1)
35
+ parser (>= 3.0.0.0)
38
36
  rainbow (>= 2.2.2, < 4.0)
37
+ regexp_parser (>= 1.8, < 3.0)
39
38
  rexml
39
+ rubocop-ast (>= 1.15.0, < 2.0)
40
40
  ruby-progressbar (~> 1.7)
41
- unicode-display_width (>= 1.4.0, < 1.7)
42
- rubocop-rspec (1.38.1)
43
- rubocop (>= 0.68.1)
44
- ruby-progressbar (1.10.1)
45
- simplecov (0.16.1)
41
+ unicode-display_width (>= 1.4.0, < 3.0)
42
+ rubocop-ast (1.15.0)
43
+ parser (>= 3.0.1.1)
44
+ rubocop-rspec (2.3.0)
45
+ rubocop (~> 1.0)
46
+ rubocop-ast (>= 1.1.0)
47
+ ruby-progressbar (1.11.0)
48
+ simplecov (0.21.2)
46
49
  docile (~> 1.1)
47
- json (>= 1.8, < 3)
48
- simplecov-html (~> 0.10.0)
49
- simplecov-html (0.10.2)
50
- unicode-display_width (1.6.1)
50
+ simplecov-html (~> 0.11)
51
+ simplecov_json_formatter (~> 0.1)
52
+ simplecov-html (0.12.3)
53
+ simplecov_json_formatter (0.1.2)
54
+ unicode-display_width (2.1.0)
51
55
 
52
56
  PLATFORMS
53
- ruby
57
+ x86_64-darwin-19
58
+ x86_64-darwin-20
59
+ x86_64-darwin-21
60
+ x86_64-linux
54
61
 
55
62
  DEPENDENCIES
56
- bundler (~> 1.17)
57
- climate_control (~> 0.2)
63
+ climate_control
58
64
  conifer!
59
- rake (~> 13.0)
60
- rspec (~> 3.0)
61
- rubocop (~> 0.80)
62
- rubocop-rspec (~> 1.38)
63
- simplecov (= 0.16.1)
65
+ rake
66
+ rspec
67
+ rubocop
68
+ rubocop-rspec
69
+ simplecov
64
70
 
65
71
  BUNDLED WITH
66
- 1.17.3
72
+ 2.3.3
data/conifer.gemspec CHANGED
@@ -15,6 +15,8 @@ Gem::Specification.new do |spec|
15
15
  spec.homepage = 'https://github.com/hasghari/conifer'
16
16
  spec.license = 'MIT'
17
17
 
18
+ spec.required_ruby_version = '>= 2.6'
19
+
18
20
  # Specify which files should be added to the gem when it is released.
19
21
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
20
22
  spec.files = Dir.chdir(File.expand_path(__dir__)) do
@@ -24,11 +26,10 @@ Gem::Specification.new do |spec|
24
26
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
25
27
  spec.require_paths = ['lib']
26
28
 
27
- spec.add_development_dependency 'bundler', '~> 1.17'
28
- spec.add_development_dependency 'climate_control', '~> 0.2'
29
- spec.add_development_dependency 'rake', '~> 13.0'
30
- spec.add_development_dependency 'rspec', '~> 3.0'
31
- spec.add_development_dependency 'rubocop', '~> 0.80'
32
- spec.add_development_dependency 'rubocop-rspec', '~> 1.38'
33
- spec.add_development_dependency 'simplecov', '0.16.1'
29
+ spec.add_development_dependency 'climate_control'
30
+ spec.add_development_dependency 'rake'
31
+ spec.add_development_dependency 'rspec'
32
+ spec.add_development_dependency 'rubocop'
33
+ spec.add_development_dependency 'rubocop-rspec'
34
+ spec.add_development_dependency 'simplecov'
34
35
  end
data/lib/conifer/file.rb CHANGED
@@ -8,14 +8,14 @@ module Conifer
8
8
  NotFoundError = Class.new(StandardError)
9
9
  UnsupportedFormatError = Class.new(StandardError)
10
10
 
11
- attr_reader :name, :dir, :prefix, :format, :allowed_classes
11
+ attr_reader :name, :dir, :prefix, :format, :options
12
12
 
13
- def initialize(name, dir:, prefix: nil, format: :yml, allowed_classes: [])
13
+ def initialize(name, dir:, prefix: nil, format: :yml, **options)
14
14
  @name = name
15
15
  @dir = dir
16
16
  @prefix = prefix
17
17
  @format = format
18
- @allowed_classes = allowed_classes
18
+ @options = options
19
19
  end
20
20
 
21
21
  def [](key)
@@ -26,9 +26,9 @@ module Conifer
26
26
  def parsed
27
27
  @parsed ||= case format
28
28
  when :yml, :yaml
29
- YAML.safe_load(ERB.new(::File.read(path)).result, allowed_classes)
29
+ YAML.safe_load(ERB.new(::File.read(path)).result, **options)
30
30
  when :json
31
- JSON.parse(ERB.new(::File.read(path)).result)
31
+ JSON.parse(ERB.new(::File.read(path)).result, **options)
32
32
  else
33
33
  raise UnsupportedFormatError, "Format '#{format}' is not supported"
34
34
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Conifer
4
- VERSION = '1.2.0'
4
+ VERSION = '2.0.0'
5
5
  end
data/lib/conifer.rb CHANGED
@@ -11,15 +11,15 @@ module Conifer
11
11
  # rubocop:disable Metrics/ParameterLists
12
12
  module ClassMethods
13
13
  def conifer(name, prefix: nil, dir: nil, format: :yml, method: ::File.basename(name.to_s, ".#{format}"),
14
- singleton: false, allowed_classes: [])
14
+ singleton: false, **options)
15
15
  dir ||= ::File.expand_path(::File.dirname(caller_locations.first.path))
16
16
 
17
17
  body = proc do
18
18
  return instance_variable_get("@conifer_#{method}") if instance_variable_defined?("@conifer_#{method}")
19
19
 
20
20
  instance_variable_set "@conifer_#{method}",
21
- Conifer::File.new(name, prefix: prefix, dir: dir, allowed_classes: allowed_classes)
22
- .tap(&:validate!)
21
+ Conifer::File.new(name, prefix: prefix, format: format,
22
+ dir: dir, **options).tap(&:validate!)
23
23
  end
24
24
 
25
25
  singleton ? define_singleton_method(method, &body) : define_method(method, &body)
metadata CHANGED
@@ -1,113 +1,99 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: conifer
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hamed Asghari
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-03-09 00:00:00.000000000 Z
11
+ date: 2022-06-25 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: bundler
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '1.17'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '1.17'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: climate_control
29
15
  requirement: !ruby/object:Gem::Requirement
30
16
  requirements:
31
- - - "~>"
17
+ - - ">="
32
18
  - !ruby/object:Gem::Version
33
- version: '0.2'
19
+ version: '0'
34
20
  type: :development
35
21
  prerelease: false
36
22
  version_requirements: !ruby/object:Gem::Requirement
37
23
  requirements:
38
- - - "~>"
24
+ - - ">="
39
25
  - !ruby/object:Gem::Version
40
- version: '0.2'
26
+ version: '0'
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: rake
43
29
  requirement: !ruby/object:Gem::Requirement
44
30
  requirements:
45
- - - "~>"
31
+ - - ">="
46
32
  - !ruby/object:Gem::Version
47
- version: '13.0'
33
+ version: '0'
48
34
  type: :development
49
35
  prerelease: false
50
36
  version_requirements: !ruby/object:Gem::Requirement
51
37
  requirements:
52
- - - "~>"
38
+ - - ">="
53
39
  - !ruby/object:Gem::Version
54
- version: '13.0'
40
+ version: '0'
55
41
  - !ruby/object:Gem::Dependency
56
42
  name: rspec
57
43
  requirement: !ruby/object:Gem::Requirement
58
44
  requirements:
59
- - - "~>"
45
+ - - ">="
60
46
  - !ruby/object:Gem::Version
61
- version: '3.0'
47
+ version: '0'
62
48
  type: :development
63
49
  prerelease: false
64
50
  version_requirements: !ruby/object:Gem::Requirement
65
51
  requirements:
66
- - - "~>"
52
+ - - ">="
67
53
  - !ruby/object:Gem::Version
68
- version: '3.0'
54
+ version: '0'
69
55
  - !ruby/object:Gem::Dependency
70
56
  name: rubocop
71
57
  requirement: !ruby/object:Gem::Requirement
72
58
  requirements:
73
- - - "~>"
59
+ - - ">="
74
60
  - !ruby/object:Gem::Version
75
- version: '0.80'
61
+ version: '0'
76
62
  type: :development
77
63
  prerelease: false
78
64
  version_requirements: !ruby/object:Gem::Requirement
79
65
  requirements:
80
- - - "~>"
66
+ - - ">="
81
67
  - !ruby/object:Gem::Version
82
- version: '0.80'
68
+ version: '0'
83
69
  - !ruby/object:Gem::Dependency
84
70
  name: rubocop-rspec
85
71
  requirement: !ruby/object:Gem::Requirement
86
72
  requirements:
87
- - - "~>"
73
+ - - ">="
88
74
  - !ruby/object:Gem::Version
89
- version: '1.38'
75
+ version: '0'
90
76
  type: :development
91
77
  prerelease: false
92
78
  version_requirements: !ruby/object:Gem::Requirement
93
79
  requirements:
94
- - - "~>"
80
+ - - ">="
95
81
  - !ruby/object:Gem::Version
96
- version: '1.38'
82
+ version: '0'
97
83
  - !ruby/object:Gem::Dependency
98
84
  name: simplecov
99
85
  requirement: !ruby/object:Gem::Requirement
100
86
  requirements:
101
- - - '='
87
+ - - ">="
102
88
  - !ruby/object:Gem::Version
103
- version: 0.16.1
89
+ version: '0'
104
90
  type: :development
105
91
  prerelease: false
106
92
  version_requirements: !ruby/object:Gem::Requirement
107
93
  requirements:
108
- - - '='
94
+ - - ">="
109
95
  - !ruby/object:Gem::Version
110
- version: 0.16.1
96
+ version: '0'
111
97
  description: Conifer allows you to easily manage YAML configuration files and import
112
98
  them into your objects.
113
99
  email:
@@ -123,6 +109,7 @@ files:
123
109
  - ".rubocop.yml"
124
110
  - ".ruby-gemset"
125
111
  - ".ruby-version"
112
+ - ".tool-versions"
126
113
  - CODE_OF_CONDUCT.md
127
114
  - Gemfile
128
115
  - Gemfile.lock
@@ -139,7 +126,7 @@ homepage: https://github.com/hasghari/conifer
139
126
  licenses:
140
127
  - MIT
141
128
  metadata: {}
142
- post_install_message:
129
+ post_install_message:
143
130
  rdoc_options: []
144
131
  require_paths:
145
132
  - lib
@@ -147,15 +134,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
147
134
  requirements:
148
135
  - - ">="
149
136
  - !ruby/object:Gem::Version
150
- version: '0'
137
+ version: '2.6'
151
138
  required_rubygems_version: !ruby/object:Gem::Requirement
152
139
  requirements:
153
140
  - - ">="
154
141
  - !ruby/object:Gem::Version
155
142
  version: '0'
156
143
  requirements: []
157
- rubygems_version: 3.0.6
158
- signing_key:
144
+ rubygems_version: 3.3.7
145
+ signing_key:
159
146
  specification_version: 4
160
147
  summary: Conifer allows you to easily manage YAML configuration files and import them
161
148
  into your objects.