fittings 0.2.3 → 1.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: bb552f67b4eefc231c0224a7e5ed90ce9fcc4e3847239120d01fab7f9bf1b8c5
4
- data.tar.gz: 4752bf8ddeb6f27ce2a72c54eec183683b1591075b06ea8221a0fd8ea76131f8
3
+ metadata.gz: b679fb549952c6427c53415d90f4e0c2d4acd07483062ff3b7b78fa0c4fec455
4
+ data.tar.gz: 1718401ee1f52d5da4a52add3fdb1a002ffeb68b469e318604dd3971040dd667
5
5
  SHA512:
6
- metadata.gz: dca71a88cd6861c792307c0e903c17a97247f8c2d0b49cb5a04d423174e3c9d8817bfb56be52f3ab7b50c3ee724046fd26ea0e7d691e3616556a1dce53380163
7
- data.tar.gz: 0bfac3cb8d6db784f6b9ebd685b0944aea36170f9fb30da664e8abf4c90154df766943fbc981e7f730a9082c83922cb2aa1d261af36c0073d93e8f0df685cbee
6
+ metadata.gz: 94f30339ca45d20fa0ce9cf9c5aa7bef61c5af8e1e679f057be084f0bb1f36771461f4601366efacbbfca7fe414c9d670dc83af8c9d15d8440312021e461b39b
7
+ data.tar.gz: 34d94ac4bdd9d6b462423620b0e321b3cfc4ed18380611c99355e81c78c2ffc2b2b68a1a7c50cc24854411d3ea504b80c0faa5cdf3bfa7636e9bedb84dc8e414
data/.circleci/config.yml CHANGED
@@ -5,7 +5,7 @@ version: 2
5
5
  jobs:
6
6
  generate-and-push-docs:
7
7
  docker:
8
- - image: cimg/ruby:3.0.3
8
+ - image: cimg/ruby:3.1.2
9
9
  auth:
10
10
  username: "$DOCKERHUB_USERNAME"
11
11
  password: "$DOCKERHUB_PASSWORD"
@@ -26,7 +26,7 @@ jobs:
26
26
  docs:push; fi
27
27
  release:
28
28
  docker:
29
- - image: cimg/ruby:3.0.3
29
+ - image: cimg/ruby:3.1.2
30
30
  auth:
31
31
  username: "$DOCKERHUB_USERNAME"
32
32
  password: "$DOCKERHUB_PASSWORD"
@@ -41,9 +41,9 @@ jobs:
41
41
  - run:
42
42
  name: Build/release gem to artifactory
43
43
  command: bundle exec rake push_artifactory
44
- ruby-3.0.3:
44
+ ruby-3.1.2:
45
45
  docker:
46
- - image: cimg/ruby:3.0.3
46
+ - image: cimg/ruby:3.1.2
47
47
  auth:
48
48
  username: "$DOCKERHUB_USERNAME"
49
49
  password: "$DOCKERHUB_PASSWORD"
@@ -69,9 +69,9 @@ jobs:
69
69
  when: on_fail
70
70
  - store_test_results:
71
71
  path: "/tmp/test-results"
72
- ruby-2.7.5:
72
+ ruby-3.0.4:
73
73
  docker:
74
- - image: cimg/ruby:2.7.5
74
+ - image: cimg/ruby:3.0.4
75
75
  auth:
76
76
  username: "$DOCKERHUB_USERNAME"
77
77
  password: "$DOCKERHUB_PASSWORD"
@@ -104,11 +104,11 @@ workflows:
104
104
  - release:
105
105
  context: org-global
106
106
  requires:
107
- - ruby-3.0.3
108
- - ruby-2.7.5
107
+ - ruby-3.1.2
108
+ - ruby-3.0.4
109
109
  filters:
110
110
  tags:
111
- only: /^[0-9]+\.[0-9]+\.[0-9]+(\.?(RC|rc)[-\.]?\w*)?$/
111
+ only: /^[0-9]+\.[0-9]+\.[0-9]+((-|\.)?(RC|rc)[-\.]?\w*)?$/
112
112
  branches:
113
113
  ignore: /.*/
114
114
  - generate-and-push-docs:
@@ -117,15 +117,15 @@ workflows:
117
117
  - release
118
118
  filters:
119
119
  tags:
120
- only: /^[0-9]+\.[0-9]+\.[0-9]+(\.?(RC|rc)[-\.]?\w*)?$/
120
+ only: /^[0-9]+\.[0-9]+\.[0-9]+((-|\.)?(RC|rc)[-\.]?\w*)?$/
121
121
  branches:
122
122
  ignore: /.*/
123
- - ruby-3.0.3:
123
+ - ruby-3.1.2:
124
124
  context: org-global
125
125
  filters:
126
126
  tags:
127
127
  only: &1 /.*/
128
- - ruby-2.7.5:
128
+ - ruby-3.0.4:
129
129
  context: org-global
130
130
  filters:
131
131
  tags:
@@ -139,7 +139,7 @@ workflows:
139
139
  only:
140
140
  - main
141
141
  jobs:
142
- - ruby-3.0.3:
142
+ - ruby-3.1.2:
143
143
  context: org-global
144
- - ruby-2.7.5:
144
+ - ruby-3.0.4:
145
145
  context: org-global
data/CHANGELOG.md ADDED
@@ -0,0 +1,12 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [1.0.0]
9
+
10
+ ### Added
11
+
12
+ - Switched to using `Hashie::Mash` for YAML parsing. This provides behavior that is more consistent, while remaining similar. It did not cause any tests to fail, but may be a breaking change depending on how you are using the gem.
data/fittings.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "fittings"
3
- s.version = "0.2.3"
3
+ s.version = "1.0.0"
4
4
 
5
5
  s.authors = ["Edwin Cruz", "Colin Shield"]
6
6
  s.date = %q{2011-09-06}
@@ -20,6 +20,7 @@ Gem::Specification.new do |s|
20
20
  s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
21
  s.require_paths = ["lib"]
22
22
 
23
+ s.add_dependency "hashie"
23
24
  s.add_development_dependency "rspec"
24
25
  s.add_development_dependency "rake"
25
26
  s.add_development_dependency "rdoc"
data/lib/setting.rb CHANGED
@@ -1,21 +1,7 @@
1
1
  require 'singleton'
2
2
  require 'yaml'
3
3
  require 'erb'
4
-
5
- class Hash
6
- def recursive_merge!(other)
7
- other.keys.each do |k|
8
- if self[k].is_a?(Array) && other[k].is_a?(Array)
9
- self[k] = other[k]
10
- elsif self[k].is_a?(Hash) && other[k].is_a?(Hash)
11
- self[k].recursive_merge!(other[k])
12
- else
13
- self[k] = other[k]
14
- end
15
- end
16
- self
17
- end
18
- end
4
+ require 'hashie'
19
5
 
20
6
  class Setting
21
7
  class NotFound < RuntimeError; end
@@ -101,7 +87,7 @@ class Setting
101
87
  #=================================================================
102
88
 
103
89
  def initialize
104
- @available_settings ||= {}
90
+ @available_settings ||= Hashie::Mash.new
105
91
  end
106
92
 
107
93
  def has_key?(key)
@@ -133,7 +119,7 @@ class Setting
133
119
 
134
120
  # This method performs collapsing of the Hash settings values if the Hash
135
121
  # contains 'default' value, or just 1 element.
136
-
122
+
137
123
  def collapse_hashes(v, args)
138
124
  out = if v.is_a?(Hash)
139
125
  if args.empty?
@@ -158,14 +144,14 @@ class Setting
158
144
  out
159
145
  end
160
146
  end
161
-
147
+
162
148
  def loaded?
163
149
  @loaded
164
150
  end
165
151
 
166
152
  def load(params)
167
153
  # reset settings hash
168
- @available_settings = {}
154
+ @available_settings = Hashie::Mash.new
169
155
  @loaded = false
170
156
 
171
157
  files = []
@@ -180,7 +166,14 @@ class Setting
180
166
 
181
167
  files.flatten.each do |file|
182
168
  begin
183
- @available_settings.recursive_merge!(YAML::unsafe_load(ERB.new(IO.read(file)).result) || {}) if File.exists?(file)
169
+ # Ruby versions before 3.0.3 include Psych < 3.3.2, which does not include `unsafe_load`. In those versions,
170
+ # `load` is the behavior we want (in later versions, `load` uses `safe_load`, which doesn't support aliases and
171
+ # requires allowlisting classes used in files.
172
+ if Psych::VERSION < '3.3.2'
173
+ @available_settings.deep_merge!(YAML::load(ERB.new(IO.read(file)).result) || {}) if File.exists?(file)
174
+ else
175
+ @available_settings.deep_merge!(YAML::unsafe_load(ERB.new(IO.read(file)).result) || {}) if File.exists?(file)
176
+ end
184
177
  rescue Exception => e
185
178
  raise FileError.new("Error parsing file #{file}, with: #{e.message}")
186
179
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fittings
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Edwin Cruz
@@ -11,6 +11,20 @@ bindir: exe
11
11
  cert_chain: []
12
12
  date: 2011-09-06 00:00:00.000000000 Z
13
13
  dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: hashie
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ">="
19
+ - !ruby/object:Gem::Version
20
+ version: '0'
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ version: '0'
14
28
  - !ruby/object:Gem::Dependency
15
29
  name: rspec
16
30
  requirement: !ruby/object:Gem::Requirement
@@ -82,6 +96,7 @@ files:
82
96
  - ".ruby-gemset"
83
97
  - ".ruby-version"
84
98
  - ".travis.yml"
99
+ - CHANGELOG.md
85
100
  - CODE_OF_CONDUCT.md
86
101
  - Gemfile
87
102
  - LICENSE.txt
@@ -114,7 +129,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
114
129
  - !ruby/object:Gem::Version
115
130
  version: '0'
116
131
  requirements: []
117
- rubygems_version: 3.2.7
132
+ rubygems_version: 3.1.4
118
133
  signing_key:
119
134
  specification_version: 4
120
135
  summary: Manage settings per environment