nitro_config 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +8 -0
- data/Gemfile +16 -0
- data/config/config.yml +12 -0
- data/config.ru +9 -0
- data/doc/dependency_decisions.yml +3 -0
- data/docs/CHANGELOG.md +9 -0
- data/lib/nitro_config/options.rb +10 -4
- data/lib/nitro_config/version.rb +1 -1
- data/lib/nitro_config.rb +3 -3
- data/mkdocs.yml +5 -0
- data/nitro_config.gemspec +35 -0
- data/test.sh +7 -0
- metadata +23 -109
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d2106328cb7a570bf8f1be2906373b809cefde5e04f23f6a304f29c5a0326e72
|
4
|
+
data.tar.gz: a91b2f3fd1fb4094d0355d7f5f1143ee5e093f94766be229b1166771d7fe4579
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5af554d4c85dd235f48be6fc2a4e35763bf86fd48903ab7419814fbbf7701cd0c55db8ea826bfdacff26731f2c63e7e55db2694e5c114519d19a4f171737d45f
|
7
|
+
data.tar.gz: ccb35797f5102f1888ba4ef6f9a78bb3241e00f8d293584cb838a04572438f713b2ea53497986baf801eb9717404e77c902d44f4695da0259347fe015f9f276e
|
data/.rubocop.yml
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
gemspec
|
6
|
+
|
7
|
+
rails_version = ENV.fetch("RAILS_VERSION", ">= 5.2.8.1")
|
8
|
+
|
9
|
+
gem "rails", rails_version
|
10
|
+
|
11
|
+
gem "byebug"
|
12
|
+
gem "license_finder", ">= 7.0"
|
13
|
+
gem "rake", ">= 13.0"
|
14
|
+
gem "rspec", ">= 3.0"
|
15
|
+
gem "rubocop", ">= 1.32"
|
16
|
+
gem "rubocop-powerhome", ">= 0.5.0"
|
data/config/config.yml
ADDED
data/config.ru
ADDED
data/docs/CHANGELOG.md
ADDED
data/lib/nitro_config/options.rb
CHANGED
@@ -1,16 +1,22 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "active_support/core_ext/hash/indifferent_access"
|
4
|
-
require "active_support/core_ext/object/try"
|
5
4
|
require "active_support/hash_with_indifferent_access"
|
6
5
|
|
7
|
-
require "nitro_config/error"
|
8
|
-
|
9
6
|
module NitroConfig
|
10
7
|
PATH_SEPARATOR = "/"
|
11
8
|
|
12
9
|
# Representation of a config key-value tree with path-based access
|
13
10
|
class Options < HashWithIndifferentAccess
|
11
|
+
def self.load_yml(path, environment)
|
12
|
+
yaml = begin
|
13
|
+
YAML.load_file(path, aliases: true)
|
14
|
+
rescue ArgumentError
|
15
|
+
YAML.load_file(path)
|
16
|
+
end
|
17
|
+
new(yaml[environment])
|
18
|
+
end
|
19
|
+
|
14
20
|
# Preserves values in the global configuration which might be altered within the yielded block.
|
15
21
|
# This is useful for testing, where a test needs to assert behaviour with certain settings values,
|
16
22
|
# but you want them to be restored for the next test.
|
@@ -54,7 +60,7 @@ module NitroConfig
|
|
54
60
|
def get!(path)
|
55
61
|
split_path = path.respond_to?(:split) ? path.split(PATH_SEPARATOR) : path
|
56
62
|
split_path.flatten.reduce(self) do |config, key|
|
57
|
-
raise(NitroConfig::Error, path) unless config
|
63
|
+
raise(NitroConfig::Error, path) unless config&.key?(key)
|
58
64
|
|
59
65
|
config[key]
|
60
66
|
end
|
data/lib/nitro_config/version.rb
CHANGED
data/lib/nitro_config.rb
CHANGED
@@ -2,7 +2,9 @@
|
|
2
2
|
|
3
3
|
require "yaml"
|
4
4
|
|
5
|
+
require "nitro_config/error"
|
5
6
|
require "nitro_config/options"
|
7
|
+
require "nitro_config/railtie" if defined?(Rails)
|
6
8
|
|
7
9
|
# When included in a Rails application, NitroConfig loads the
|
8
10
|
# configuration file at `config/config.yml` within the application
|
@@ -19,7 +21,7 @@ module NitroConfig
|
|
19
21
|
#
|
20
22
|
# @return [NitroConfig::Options] the loaded configuration
|
21
23
|
def self.load!(file, env)
|
22
|
-
@config = NitroConfig::Options.
|
24
|
+
@config = NitroConfig::Options.load_yml(file, env)
|
23
25
|
end
|
24
26
|
|
25
27
|
# Provides the loaded global configuration
|
@@ -48,6 +50,4 @@ module NitroConfig
|
|
48
50
|
def self.get_deferred!(*args)
|
49
51
|
->(*_args) { config.get!(*args) }
|
50
52
|
end
|
51
|
-
|
52
|
-
require "nitro_config/railtie" if defined?(Rails)
|
53
53
|
end
|
data/mkdocs.yml
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "lib/nitro_config/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "nitro_config"
|
7
|
+
spec.version = NitroConfig::VERSION
|
8
|
+
spec.authors = ["Carlos Palhares", "Jill Klang"]
|
9
|
+
spec.email = ["chjunior@gmail.com", "jillian.emilie@gmail.com"]
|
10
|
+
|
11
|
+
spec.summary = "Nitro Configuration Loader"
|
12
|
+
spec.description = "Loads Nitro configuration and makes it available to the application"
|
13
|
+
spec.homepage = "https://github.com/powerhome/power-tools"
|
14
|
+
spec.license = "MIT"
|
15
|
+
spec.required_ruby_version = ">= 2.7"
|
16
|
+
|
17
|
+
spec.metadata["rubygems_mfa_required"] = "true"
|
18
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
19
|
+
spec.metadata["source_code_uri"] = spec.homepage
|
20
|
+
spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/main/packages/nitro_config/docs/CHANGELOG.md"
|
21
|
+
|
22
|
+
# Specify which files should be added to the gem when it is released.
|
23
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
24
|
+
spec.files = Dir.chdir(__dir__) do
|
25
|
+
`git ls-files -z`.split("\x0").reject do |f|
|
26
|
+
(f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
|
27
|
+
end
|
28
|
+
end
|
29
|
+
spec.bindir = "exe"
|
30
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
31
|
+
spec.require_paths = ["lib"]
|
32
|
+
|
33
|
+
spec.add_dependency "activesupport", ">= 5.2.8.1"
|
34
|
+
spec.add_development_dependency "combustion", "~> 1.3"
|
35
|
+
end
|
data/test.sh
ADDED
metadata
CHANGED
@@ -1,142 +1,44 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nitro_config
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Carlos Palhares
|
8
8
|
- Jill Klang
|
9
9
|
autorequire:
|
10
|
-
bindir:
|
10
|
+
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2022-
|
12
|
+
date: 2022-08-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- -
|
18
|
+
- - ">="
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: 5.2.8
|
20
|
+
version: 5.2.8.1
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
|
-
- -
|
25
|
+
- - ">="
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: 5.2.8
|
27
|
+
version: 5.2.8.1
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
|
-
name:
|
29
|
+
name: combustion
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
32
|
- - "~>"
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: '
|
34
|
+
version: '1.3'
|
35
35
|
type: :development
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
39
|
- - "~>"
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version: '
|
42
|
-
- !ruby/object:Gem::Dependency
|
43
|
-
name: pry-byebug
|
44
|
-
requirement: !ruby/object:Gem::Requirement
|
45
|
-
requirements:
|
46
|
-
- - '='
|
47
|
-
- !ruby/object:Gem::Version
|
48
|
-
version: 3.9.0
|
49
|
-
type: :development
|
50
|
-
prerelease: false
|
51
|
-
version_requirements: !ruby/object:Gem::Requirement
|
52
|
-
requirements:
|
53
|
-
- - '='
|
54
|
-
- !ruby/object:Gem::Version
|
55
|
-
version: 3.9.0
|
56
|
-
- !ruby/object:Gem::Dependency
|
57
|
-
name: rainbow
|
58
|
-
requirement: !ruby/object:Gem::Requirement
|
59
|
-
requirements:
|
60
|
-
- - '='
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
version: 2.2.2
|
63
|
-
type: :development
|
64
|
-
prerelease: false
|
65
|
-
version_requirements: !ruby/object:Gem::Requirement
|
66
|
-
requirements:
|
67
|
-
- - '='
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
version: 2.2.2
|
70
|
-
- !ruby/object:Gem::Dependency
|
71
|
-
name: rake
|
72
|
-
requirement: !ruby/object:Gem::Requirement
|
73
|
-
requirements:
|
74
|
-
- - "~>"
|
75
|
-
- !ruby/object:Gem::Version
|
76
|
-
version: '13.0'
|
77
|
-
type: :development
|
78
|
-
prerelease: false
|
79
|
-
version_requirements: !ruby/object:Gem::Requirement
|
80
|
-
requirements:
|
81
|
-
- - "~>"
|
82
|
-
- !ruby/object:Gem::Version
|
83
|
-
version: '13.0'
|
84
|
-
- !ruby/object:Gem::Dependency
|
85
|
-
name: rspec
|
86
|
-
requirement: !ruby/object:Gem::Requirement
|
87
|
-
requirements:
|
88
|
-
- - '='
|
89
|
-
- !ruby/object:Gem::Version
|
90
|
-
version: 3.9.0
|
91
|
-
type: :development
|
92
|
-
prerelease: false
|
93
|
-
version_requirements: !ruby/object:Gem::Requirement
|
94
|
-
requirements:
|
95
|
-
- - '='
|
96
|
-
- !ruby/object:Gem::Version
|
97
|
-
version: 3.9.0
|
98
|
-
- !ruby/object:Gem::Dependency
|
99
|
-
name: rubocop-powerhome
|
100
|
-
requirement: !ruby/object:Gem::Requirement
|
101
|
-
requirements:
|
102
|
-
- - '='
|
103
|
-
- !ruby/object:Gem::Version
|
104
|
-
version: 0.4.1
|
105
|
-
type: :development
|
106
|
-
prerelease: false
|
107
|
-
version_requirements: !ruby/object:Gem::Requirement
|
108
|
-
requirements:
|
109
|
-
- - '='
|
110
|
-
- !ruby/object:Gem::Version
|
111
|
-
version: 0.4.1
|
112
|
-
- !ruby/object:Gem::Dependency
|
113
|
-
name: simplecov
|
114
|
-
requirement: !ruby/object:Gem::Requirement
|
115
|
-
requirements:
|
116
|
-
- - '='
|
117
|
-
- !ruby/object:Gem::Version
|
118
|
-
version: 0.15.1
|
119
|
-
type: :development
|
120
|
-
prerelease: false
|
121
|
-
version_requirements: !ruby/object:Gem::Requirement
|
122
|
-
requirements:
|
123
|
-
- - '='
|
124
|
-
- !ruby/object:Gem::Version
|
125
|
-
version: 0.15.1
|
126
|
-
- !ruby/object:Gem::Dependency
|
127
|
-
name: yard
|
128
|
-
requirement: !ruby/object:Gem::Requirement
|
129
|
-
requirements:
|
130
|
-
- - '='
|
131
|
-
- !ruby/object:Gem::Version
|
132
|
-
version: 0.9.21
|
133
|
-
type: :development
|
134
|
-
prerelease: false
|
135
|
-
version_requirements: !ruby/object:Gem::Requirement
|
136
|
-
requirements:
|
137
|
-
- - '='
|
138
|
-
- !ruby/object:Gem::Version
|
139
|
-
version: 0.9.21
|
41
|
+
version: '1.3'
|
140
42
|
description: Loads Nitro configuration and makes it available to the application
|
141
43
|
email:
|
142
44
|
- chjunior@gmail.com
|
@@ -145,7 +47,13 @@ executables: []
|
|
145
47
|
extensions: []
|
146
48
|
extra_rdoc_files: []
|
147
49
|
files:
|
50
|
+
- ".rubocop.yml"
|
51
|
+
- Gemfile
|
148
52
|
- Rakefile
|
53
|
+
- config.ru
|
54
|
+
- config/config.yml
|
55
|
+
- doc/dependency_decisions.yml
|
56
|
+
- docs/CHANGELOG.md
|
149
57
|
- docs/README.md
|
150
58
|
- lib/nitro_config.rb
|
151
59
|
- lib/nitro_config/error.rb
|
@@ -153,11 +61,17 @@ files:
|
|
153
61
|
- lib/nitro_config/railtie.rb
|
154
62
|
- lib/nitro_config/rspec.rb
|
155
63
|
- lib/nitro_config/version.rb
|
156
|
-
|
64
|
+
- mkdocs.yml
|
65
|
+
- nitro_config.gemspec
|
66
|
+
- test.sh
|
67
|
+
homepage: https://github.com/powerhome/power-tools
|
157
68
|
licenses:
|
158
69
|
- MIT
|
159
70
|
metadata:
|
160
71
|
rubygems_mfa_required: 'true'
|
72
|
+
homepage_uri: https://github.com/powerhome/power-tools
|
73
|
+
source_code_uri: https://github.com/powerhome/power-tools
|
74
|
+
changelog_uri: https://github.com/powerhome/power-tools/blob/main/packages/nitro_config/docs/CHANGELOG.md
|
161
75
|
post_install_message:
|
162
76
|
rdoc_options: []
|
163
77
|
require_paths:
|