legion-settings 1.1.3 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/sourcehawk-scan.yml +20 -0
- data/.gitignore +5 -4
- data/.rubocop.yml +4 -1
- data/CHANGELOG.md +2 -7
- data/CODE_OF_CONDUCT.md +75 -0
- data/CONTRIBUTING.md +55 -0
- data/Gemfile +8 -0
- data/INDIVIDUAL_CONTRIBUTOR_LICENSE.md +30 -0
- data/LICENSE +201 -0
- data/NOTICE.txt +9 -0
- data/README.md +23 -36
- data/SECURITY.md +9 -0
- data/attribution.txt +1 -0
- data/legion-settings.gemspec +22 -22
- data/lib/legion/settings.rb +11 -2
- data/lib/legion/settings/loader.rb +3 -0
- data/lib/legion/settings/os.rb +34 -0
- data/lib/legion/settings/version.rb +1 -1
- data/sourcehawk.yml +4 -0
- metadata +36 -122
- data/.circleci/config.yml +0 -105
- data/Gemfile.lock +0 -78
- data/LICENSE.txt +0 -21
- data/Rakefile +0 -6
- data/bitbucket-pipelines.yml +0 -17
- data/lib/legion/settings/constants.rb +0 -5
- data/lib/legion/settings/rules.rb +0 -92
- data/lib/legion/settings/validator.rb +0 -63
- data/lib/legion/settings/validators.rb +0 -9
data/NOTICE.txt
ADDED
data/README.md
CHANGED
@@ -1,49 +1,36 @@
|
|
1
|
-
|
1
|
+
Legion::Settings
|
2
|
+
=====
|
2
3
|
|
3
|
-
Legion::Settings is
|
4
|
+
Legion::Settings is a hash like class used to store LegionIO Settings.
|
4
5
|
|
5
|
-
|
6
|
-
|
7
|
-
| | License | CircleCI | CodeCov | CodeBeat |
|
8
|
-
|---------|---------|----------|---------|----------|
|
9
|
-
| Master |[![MIT Licence](https://badges.frapsoft.com/os/mit/mit.svg?v=103)](https://opensource.org/licenses/mit-license.php)|[![CircleCI](https://circleci.com/bb/legion-io/legion-settings/tree/master.svg?style=svg)](https://circleci.com/bb/legion-io/legion-settings/tree/master)|[![codecov](https://codecov.io/bb/legion-io/legion-settings/branch/master/graph/badge.svg)](https://codecov.io/bb/legion-io/legion-settings)|[![codebeat badge](https://codebeat.co/badges/e86dbe3e-b463-4f3c-91a8-c85492fd3833)](https://codebeat.co/projects/bitbucket-org-legion-io-legion-settings-master)|
|
10
|
-
| Develop |[![MIT Licence](https://badges.frapsoft.com/os/mit/mit.svg?v=103)](https://opensource.org/licenses/mit-license.php)|[![CircleCI](https://circleci.com/bb/legion-io/legion-settings/tree/develop.svg?style=svg)](https://circleci.com/bb/legion-io/legion-settings/tree/develop)|[![codecov](https://codecov.io/bb/legion-io/legion-settings/branch/develop/graph/badge.svg)](https://codecov.io/bb/legion-io/legion-settings)|[![codebeat badge](https://codebeat.co/badges/e86dbe3e-b463-4f3c-91a8-c85492fd3833)](https://codebeat.co/projects/bitbucket-org-legion-io-legion-settings-develop)|
|
6
|
+
Supported Ruby versions and implementations
|
7
|
+
------------------------------------------------
|
11
8
|
|
12
|
-
|
13
|
-
![](https://ruby-gem-downloads-badge.herokuapp.com/legion-settings)
|
14
|
-
[![Gem Version](https://badge.fury.io/rb/legion-settings.svg)](https://badge.fury.io/rb/legion-settings)
|
9
|
+
Legion::Json should work identically on:
|
15
10
|
|
16
|
-
|
17
|
-
|
18
|
-
![](https://img.shields.io/bitbucket/pr-raw/legion-io/legion-settings.svg)
|
19
|
-
## Installation
|
11
|
+
* JRuby 9.2+
|
12
|
+
* Ruby 2.4+
|
20
13
|
|
21
|
-
Add this line to your application's Gemfile:
|
22
14
|
|
23
|
-
|
24
|
-
|
25
|
-
```
|
26
|
-
|
27
|
-
And then execute:
|
28
|
-
|
29
|
-
$ bundle
|
30
|
-
|
31
|
-
Or install it yourself as:
|
15
|
+
Installation and Usage
|
16
|
+
------------------------
|
32
17
|
|
33
|
-
|
18
|
+
You can verify your installation using this piece of code:
|
34
19
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
## Gem
|
20
|
+
```bash
|
21
|
+
gem install legion-json
|
22
|
+
```
|
40
23
|
|
41
|
-
|
24
|
+
```ruby
|
25
|
+
require 'legion-settings'
|
26
|
+
Legion::Settings.load(config_dir: './') # will automatically load json files it has access to inside this dir
|
42
27
|
|
43
|
-
|
28
|
+
Legion::Settings[:client][:hostname]
|
29
|
+
Legion::Settings[:client][:new_attribute] = 'foobar'
|
44
30
|
|
45
|
-
|
31
|
+
```
|
46
32
|
|
47
|
-
|
33
|
+
Authors
|
34
|
+
----------
|
48
35
|
|
49
|
-
|
36
|
+
* [Matthew Iverson](https://github.com/Esity) - current maintainer
|
data/SECURITY.md
ADDED
data/attribution.txt
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Add attributions here.
|
data/legion-settings.gemspec
CHANGED
@@ -1,30 +1,30 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'lib/legion/settings/version'
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
|
-
spec.name
|
6
|
+
spec.name = 'legion-settings'
|
7
7
|
spec.version = Legion::Settings::VERSION
|
8
8
|
spec.authors = ['Esity']
|
9
|
-
spec.email = [
|
10
|
-
|
11
|
-
spec.summary = 'Used to load the json settings files'
|
12
|
-
spec.description = "Based on Sensu's implementation of settings"
|
13
|
-
spec.homepage = 'https://bitbucket.org/whonodes/legion-settings'
|
14
|
-
spec.license = 'MIT'
|
15
|
-
spec.required_ruby_version = '>= 2.5.0'
|
9
|
+
spec.email = %w[matthewdiverson@gmail.com ruby@optum.com]
|
16
10
|
|
17
|
-
spec.
|
18
|
-
|
19
|
-
|
11
|
+
spec.summary = 'Legion::Settings'
|
12
|
+
spec.description = 'A gem written to handle LegionIO Settings in a consistent way across extensions'
|
13
|
+
spec.homepage = 'https://github.com/Optum/legion-settings'
|
14
|
+
spec.license = 'Apache-2.0'
|
20
15
|
spec.require_paths = ['lib']
|
16
|
+
spec.required_ruby_version = '>= 2.4'
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.test_files = spec.files.select { |p| p =~ %r{^test/.*_test.rb} }
|
19
|
+
spec.extra_rdoc_files = %w[README.md LICENSE CHANGELOG.md]
|
20
|
+
spec.metadata = {
|
21
|
+
'bug_tracker_uri' => 'https://github.com/Optum/legion-settings/issues',
|
22
|
+
'changelog_uri' => 'https://github.com/Optum/legion-settings/src/main/CHANGELOG.md',
|
23
|
+
'documentation_uri' => 'https://github.com/Optum/legion-settings',
|
24
|
+
'homepage_uri' => 'https://github.com/Optum/LegionIO',
|
25
|
+
'source_code_uri' => 'https://github.com/Optum/legion-settings',
|
26
|
+
'wiki_uri' => 'https://github.com/Optum/legion-settings/wiki'
|
27
|
+
}
|
21
28
|
|
22
|
-
spec.
|
23
|
-
spec.add_development_dependency 'rake'
|
24
|
-
spec.add_development_dependency 'rspec'
|
25
|
-
spec.add_development_dependency 'rspec_junit_formatter'
|
26
|
-
spec.add_development_dependency 'rubocop'
|
27
|
-
spec.add_development_dependency 'simplecov', '< 0.18.0'
|
28
|
-
spec.add_dependency 'legion-json'
|
29
|
-
spec.add_dependency 'legion-logging'
|
29
|
+
spec.add_dependency 'legion-json', '>= 1.2'
|
30
30
|
end
|
data/lib/legion/settings.rb
CHANGED
@@ -24,11 +24,11 @@ module Legion
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def [](key)
|
27
|
-
|
27
|
+
logger.info('Legion::Settings was not loading, auto loading now!') if @loader.nil?
|
28
28
|
@loader = load if @loader.nil?
|
29
29
|
@loader[key]
|
30
30
|
rescue NoMethodError, TypeError
|
31
|
-
|
31
|
+
logger.fatal 'rescue inside [](key)'
|
32
32
|
nil
|
33
33
|
end
|
34
34
|
|
@@ -43,6 +43,15 @@ module Legion
|
|
43
43
|
thing[key.to_sym] = hash
|
44
44
|
@loader.load_module_settings(thing)
|
45
45
|
end
|
46
|
+
|
47
|
+
def logger
|
48
|
+
@logger = if ::Legion.const_defined?('Logging')
|
49
|
+
::Legion::Logging
|
50
|
+
else
|
51
|
+
require 'logger'
|
52
|
+
::Logger.new($stdout)
|
53
|
+
end
|
54
|
+
end
|
46
55
|
end
|
47
56
|
end
|
48
57
|
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module Legion
|
2
|
+
module Settings
|
3
|
+
module OS
|
4
|
+
def self.windows?
|
5
|
+
(/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM) != nil
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.mac?
|
9
|
+
(/darwin/ =~ RUBY_PLATFORM) != nil
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.unix?
|
13
|
+
!OS.windows?
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.linux?
|
17
|
+
OS.unix? and !OS.mac?
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.jruby?
|
21
|
+
RUBY_ENGINE == 'jruby'
|
22
|
+
end
|
23
|
+
|
24
|
+
def os
|
25
|
+
return 'jruby' if jruby?
|
26
|
+
return 'windows' if windows?
|
27
|
+
return 'mac' if mac?
|
28
|
+
return 'unix' if unix?
|
29
|
+
|
30
|
+
'linux'
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
data/sourcehawk.yml
ADDED
metadata
CHANGED
@@ -1,159 +1,73 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: legion-settings
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Esity
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-06-04 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: '0'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rake
|
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: rspec
|
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
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: rspec_junit_formatter
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: rubocop
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - ">="
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - ">="
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '0'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: simplecov
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - "<"
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: 0.18.0
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - "<"
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: 0.18.0
|
97
13
|
- !ruby/object:Gem::Dependency
|
98
14
|
name: legion-json
|
99
15
|
requirement: !ruby/object:Gem::Requirement
|
100
16
|
requirements:
|
101
17
|
- - ">="
|
102
18
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
19
|
+
version: '1.2'
|
104
20
|
type: :runtime
|
105
21
|
prerelease: false
|
106
22
|
version_requirements: !ruby/object:Gem::Requirement
|
107
23
|
requirements:
|
108
24
|
- - ">="
|
109
25
|
- !ruby/object:Gem::Version
|
110
|
-
version: '
|
111
|
-
|
112
|
-
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - ">="
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '0'
|
118
|
-
type: :runtime
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - ">="
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: '0'
|
125
|
-
description: Based on Sensu's implementation of settings
|
26
|
+
version: '1.2'
|
27
|
+
description: A gem written to handle LegionIO Settings in a consistent way across
|
28
|
+
extensions
|
126
29
|
email:
|
127
30
|
- matthewdiverson@gmail.com
|
31
|
+
- ruby@optum.com
|
128
32
|
executables: []
|
129
33
|
extensions: []
|
130
|
-
extra_rdoc_files:
|
34
|
+
extra_rdoc_files:
|
35
|
+
- README.md
|
36
|
+
- LICENSE
|
37
|
+
- CHANGELOG.md
|
131
38
|
files:
|
132
|
-
- ".
|
39
|
+
- ".github/workflows/sourcehawk-scan.yml"
|
133
40
|
- ".gitignore"
|
134
41
|
- ".rubocop.yml"
|
135
42
|
- CHANGELOG.md
|
43
|
+
- CODE_OF_CONDUCT.md
|
44
|
+
- CONTRIBUTING.md
|
136
45
|
- Gemfile
|
137
|
-
-
|
138
|
-
- LICENSE
|
46
|
+
- INDIVIDUAL_CONTRIBUTOR_LICENSE.md
|
47
|
+
- LICENSE
|
48
|
+
- NOTICE.txt
|
139
49
|
- README.md
|
140
|
-
-
|
141
|
-
-
|
50
|
+
- SECURITY.md
|
51
|
+
- attribution.txt
|
142
52
|
- legion-settings.gemspec
|
143
53
|
- lib/legion/settings.rb
|
144
|
-
- lib/legion/settings/constants.rb
|
145
54
|
- lib/legion/settings/loader.rb
|
146
|
-
- lib/legion/settings/
|
147
|
-
- lib/legion/settings/validator.rb
|
148
|
-
- lib/legion/settings/validators.rb
|
55
|
+
- lib/legion/settings/os.rb
|
149
56
|
- lib/legion/settings/validators/legion.rb
|
150
57
|
- lib/legion/settings/version.rb
|
151
58
|
- sonar-project.properties
|
152
|
-
|
59
|
+
- sourcehawk.yml
|
60
|
+
homepage: https://github.com/Optum/legion-settings
|
153
61
|
licenses:
|
154
|
-
-
|
155
|
-
metadata:
|
156
|
-
|
62
|
+
- Apache-2.0
|
63
|
+
metadata:
|
64
|
+
bug_tracker_uri: https://github.com/Optum/legion-settings/issues
|
65
|
+
changelog_uri: https://github.com/Optum/legion-settings/src/main/CHANGELOG.md
|
66
|
+
documentation_uri: https://github.com/Optum/legion-settings
|
67
|
+
homepage_uri: https://github.com/Optum/LegionIO
|
68
|
+
source_code_uri: https://github.com/Optum/legion-settings
|
69
|
+
wiki_uri: https://github.com/Optum/legion-settings/wiki
|
70
|
+
post_install_message:
|
157
71
|
rdoc_options: []
|
158
72
|
require_paths:
|
159
73
|
- lib
|
@@ -161,15 +75,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
161
75
|
requirements:
|
162
76
|
- - ">="
|
163
77
|
- !ruby/object:Gem::Version
|
164
|
-
version: 2.
|
78
|
+
version: '2.4'
|
165
79
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
166
80
|
requirements:
|
167
81
|
- - ">="
|
168
82
|
- !ruby/object:Gem::Version
|
169
83
|
version: '0'
|
170
84
|
requirements: []
|
171
|
-
rubygems_version: 3.1.
|
172
|
-
signing_key:
|
85
|
+
rubygems_version: 3.1.6
|
86
|
+
signing_key:
|
173
87
|
specification_version: 4
|
174
|
-
summary:
|
88
|
+
summary: Legion::Settings
|
175
89
|
test_files: []
|