fittings 0.2.4 → 2.0.0
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 +4 -4
- data/.circleci/config.yml +36 -22
- data/.github/workflows/scheduled_cci.yml +14 -0
- data/.ruby-version +1 -1
- data/fittings.gemspec +3 -1
- data/lib/setting.rb +17 -27
- metadata +18 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: caecbb60f8fcd01f6487054124746dab9891db42699a575112fb641c3fbbbbd4
|
4
|
+
data.tar.gz: eefb06bd4cc4f11384582ee87c6b48870300ca28e9c39cfb51be25b4c8df2fe0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e9d4ee552dbe4e19299c57cd70973755203573d0851f0c48af37532c9b97715835fc0a981fa0a9a90fed745c520279a146d5e6761b1bc7beeacced4d024510de
|
7
|
+
data.tar.gz: 2639d507e51bd6b4b13b3d5730e711cb9fc38267c0d811c996f666ffc98ab3cd2a5ebc6a7b5c1d1007fa17cc6d897e4051620877d5fe71db0b301047855f1543
|
data/.circleci/config.yml
CHANGED
@@ -1,11 +1,30 @@
|
|
1
1
|
# DO NOT MODIFY - this is managed by Git Reduce in goro and generated from build-matrix.json
|
2
2
|
#
|
3
3
|
---
|
4
|
-
version: 2
|
4
|
+
version: 2.1
|
5
|
+
|
6
|
+
############
|
7
|
+
## Github Actions Pipeline Params
|
8
|
+
############
|
9
|
+
|
10
|
+
parameters:
|
11
|
+
GHA_Event:
|
12
|
+
type: string
|
13
|
+
default: ""
|
14
|
+
GHA_Actor:
|
15
|
+
type: string
|
16
|
+
default: ""
|
17
|
+
GHA_Action:
|
18
|
+
type: string
|
19
|
+
default: ""
|
20
|
+
GHA_Meta:
|
21
|
+
type: string
|
22
|
+
default: ""
|
23
|
+
|
5
24
|
jobs:
|
6
25
|
generate-and-push-docs:
|
7
26
|
docker:
|
8
|
-
- image: cimg/ruby:3.
|
27
|
+
- image: cimg/ruby:3.1.3
|
9
28
|
auth:
|
10
29
|
username: "$DOCKERHUB_USERNAME"
|
11
30
|
password: "$DOCKERHUB_PASSWORD"
|
@@ -26,7 +45,7 @@ jobs:
|
|
26
45
|
docs:push; fi
|
27
46
|
release:
|
28
47
|
docker:
|
29
|
-
- image: cimg/ruby:3.
|
48
|
+
- image: cimg/ruby:3.1.3
|
30
49
|
auth:
|
31
50
|
username: "$DOCKERHUB_USERNAME"
|
32
51
|
password: "$DOCKERHUB_PASSWORD"
|
@@ -41,9 +60,9 @@ jobs:
|
|
41
60
|
- run:
|
42
61
|
name: Build/release gem to artifactory
|
43
62
|
command: bundle exec rake push_artifactory
|
44
|
-
ruby-
|
63
|
+
ruby-3_1_3:
|
45
64
|
docker:
|
46
|
-
- image: cimg/ruby:3.
|
65
|
+
- image: cimg/ruby:3.1.3
|
47
66
|
auth:
|
48
67
|
username: "$DOCKERHUB_USERNAME"
|
49
68
|
password: "$DOCKERHUB_PASSWORD"
|
@@ -69,9 +88,9 @@ jobs:
|
|
69
88
|
when: on_fail
|
70
89
|
- store_test_results:
|
71
90
|
path: "/tmp/test-results"
|
72
|
-
ruby-
|
91
|
+
ruby-3_0_5:
|
73
92
|
docker:
|
74
|
-
- image: cimg/ruby:
|
93
|
+
- image: cimg/ruby:3.0.5
|
75
94
|
auth:
|
76
95
|
username: "$DOCKERHUB_USERNAME"
|
77
96
|
password: "$DOCKERHUB_PASSWORD"
|
@@ -104,11 +123,11 @@ workflows:
|
|
104
123
|
- release:
|
105
124
|
context: org-global
|
106
125
|
requires:
|
107
|
-
- ruby-
|
108
|
-
- ruby-
|
126
|
+
- ruby-3_1_3
|
127
|
+
- ruby-3_0_5
|
109
128
|
filters:
|
110
129
|
tags:
|
111
|
-
only: /^[0-9]+\.[0-9]+\.[0-9]+(
|
130
|
+
only: /^[0-9]+\.[0-9]+\.[0-9]+((-|\.)?(RC|rc)[-.]?\w*)?$/
|
112
131
|
branches:
|
113
132
|
ignore: /.*/
|
114
133
|
- generate-and-push-docs:
|
@@ -117,29 +136,24 @@ workflows:
|
|
117
136
|
- release
|
118
137
|
filters:
|
119
138
|
tags:
|
120
|
-
only: /^[0-9]+\.[0-9]+\.[0-9]+(
|
139
|
+
only: /^[0-9]+\.[0-9]+\.[0-9]+((-|\.)?(RC|rc)[-.]?\w*)?$/
|
121
140
|
branches:
|
122
141
|
ignore: /.*/
|
123
|
-
- ruby-
|
142
|
+
- ruby-3_1_3:
|
124
143
|
context: org-global
|
125
144
|
filters:
|
126
145
|
tags:
|
127
146
|
only: &1 /.*/
|
128
|
-
- ruby-
|
147
|
+
- ruby-3_0_5:
|
129
148
|
context: org-global
|
130
149
|
filters:
|
131
150
|
tags:
|
132
151
|
only: *1
|
133
152
|
scheduled:
|
134
|
-
|
135
|
-
|
136
|
-
cron: 26 18 * * 1,2,3,4,5
|
137
|
-
filters:
|
138
|
-
branches:
|
139
|
-
only:
|
140
|
-
- main
|
153
|
+
when:
|
154
|
+
equal: [ "schedule", << pipeline.parameters.GHA_Event >> ]
|
141
155
|
jobs:
|
142
|
-
- ruby-
|
156
|
+
- ruby-3_1_3:
|
143
157
|
context: org-global
|
144
|
-
- ruby-
|
158
|
+
- ruby-3_0_5:
|
145
159
|
context: org-global
|
@@ -0,0 +1,14 @@
|
|
1
|
+
on:
|
2
|
+
schedule:
|
3
|
+
- cron: '26 18 * * 1,2,3,4,5'
|
4
|
+
workflow_dispatch:
|
5
|
+
|
6
|
+
jobs:
|
7
|
+
trigger-circleci:
|
8
|
+
runs-on: ubuntu-latest
|
9
|
+
steps:
|
10
|
+
- name: CircleCI trigger on schedule
|
11
|
+
id: step1
|
12
|
+
uses: CircleCI-Public/trigger-circleci-pipeline-action@v1.0.5
|
13
|
+
env:
|
14
|
+
CCI_TOKEN: ${{ secrets.CCI_TOKEN || secrets.CCI_TOKEN_FOR_PUBLIC_REPOS }}
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
ruby-3.0.4
|
data/fittings.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "fittings"
|
3
|
-
s.version = "0.
|
3
|
+
s.version = "2.0.0"
|
4
4
|
|
5
5
|
s.authors = ["Edwin Cruz", "Colin Shield"]
|
6
6
|
s.date = %q{2011-09-06}
|
@@ -20,6 +20,8 @@ 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.required_ruby_version = ">= 2.4.0"
|
24
|
+
s.add_dependency "hashie"
|
23
25
|
s.add_development_dependency "rspec"
|
24
26
|
s.add_development_dependency "rake"
|
25
27
|
s.add_development_dependency "rdoc"
|
data/lib/setting.rb
CHANGED
@@ -1,33 +1,20 @@
|
|
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
|
22
8
|
class FileError < RuntimeError; end
|
23
9
|
class AlreadyLoaded < RuntimeError; end
|
24
10
|
|
11
|
+
class SettingHash < Hash
|
12
|
+
include Hashie::Extensions::IndifferentAccess
|
13
|
+
include Hashie::Extensions::KeyConversion
|
14
|
+
include Hashie::Extensions::DeepMerge
|
15
|
+
end
|
16
|
+
|
25
17
|
include Singleton
|
26
|
-
NUM_KLASS = if RUBY_VERSION.split(/\./)[0].to_i == 2 && RUBY_VERSION.split(/\./)[1].to_i >= 4
|
27
|
-
Integer
|
28
|
-
else
|
29
|
-
Fixnum
|
30
|
-
end
|
31
18
|
|
32
19
|
attr_reader :available_settings
|
33
20
|
|
@@ -101,7 +88,7 @@ class Setting
|
|
101
88
|
#=================================================================
|
102
89
|
|
103
90
|
def initialize
|
104
|
-
@available_settings ||=
|
91
|
+
@available_settings ||= SettingHash.new
|
105
92
|
end
|
106
93
|
|
107
94
|
def has_key?(key)
|
@@ -119,12 +106,15 @@ class Setting
|
|
119
106
|
end
|
120
107
|
|
121
108
|
v = @available_settings[name]
|
109
|
+
if v.is_a?(Hash)
|
110
|
+
v = SettingHash[v]
|
111
|
+
end
|
122
112
|
if block_given?
|
123
113
|
v = yield(v, args)
|
124
114
|
end
|
125
115
|
|
126
116
|
|
127
|
-
if v.is_a?(
|
117
|
+
if v.is_a?(Integer) && bool
|
128
118
|
v.to_i > 0
|
129
119
|
else
|
130
120
|
v
|
@@ -133,7 +123,7 @@ class Setting
|
|
133
123
|
|
134
124
|
# This method performs collapsing of the Hash settings values if the Hash
|
135
125
|
# contains 'default' value, or just 1 element.
|
136
|
-
|
126
|
+
|
137
127
|
def collapse_hashes(v, args)
|
138
128
|
out = if v.is_a?(Hash)
|
139
129
|
if args.empty?
|
@@ -158,14 +148,14 @@ class Setting
|
|
158
148
|
out
|
159
149
|
end
|
160
150
|
end
|
161
|
-
|
151
|
+
|
162
152
|
def loaded?
|
163
153
|
@loaded
|
164
154
|
end
|
165
155
|
|
166
156
|
def load(params)
|
167
157
|
# reset settings hash
|
168
|
-
@available_settings =
|
158
|
+
@available_settings = SettingHash.new
|
169
159
|
@loaded = false
|
170
160
|
|
171
161
|
files = []
|
@@ -184,9 +174,9 @@ class Setting
|
|
184
174
|
# `load` is the behavior we want (in later versions, `load` uses `safe_load`, which doesn't support aliases and
|
185
175
|
# requires allowlisting classes used in files.
|
186
176
|
if Psych::VERSION < '3.3.2'
|
187
|
-
@available_settings.
|
177
|
+
@available_settings.deep_merge!(YAML::load(ERB.new(IO.read(file)).result) || {}) if File.exist?(file)
|
188
178
|
else
|
189
|
-
@available_settings.
|
179
|
+
@available_settings.deep_merge!(YAML::unsafe_load(ERB.new(IO.read(file)).result) || {}) if File.exist?(file)
|
190
180
|
end
|
191
181
|
rescue Exception => e
|
192
182
|
raise FileError.new("Error parsing file #{file}, with: #{e.message}")
|
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.
|
4
|
+
version: 2.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
|
@@ -78,6 +92,7 @@ files:
|
|
78
92
|
- ".circleci/config.yml"
|
79
93
|
- ".github/CODEOWNERS"
|
80
94
|
- ".github/PULL_REQUEST_TEMPLATE.md"
|
95
|
+
- ".github/workflows/scheduled_cci.yml"
|
81
96
|
- ".gitignore"
|
82
97
|
- ".ruby-gemset"
|
83
98
|
- ".ruby-version"
|
@@ -107,14 +122,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
107
122
|
requirements:
|
108
123
|
- - ">="
|
109
124
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
125
|
+
version: 2.4.0
|
111
126
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
112
127
|
requirements:
|
113
128
|
- - ">="
|
114
129
|
- !ruby/object:Gem::Version
|
115
130
|
version: '0'
|
116
131
|
requirements: []
|
117
|
-
rubygems_version: 3.
|
132
|
+
rubygems_version: 3.4.0.dev
|
118
133
|
signing_key:
|
119
134
|
specification_version: 4
|
120
135
|
summary: Manage settings per environment
|