k_config 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/docs/CHANGELOG.md +7 -0
- data/k_config.gemspec +2 -2
- data/lib/k_config/configuration.rb +10 -0
- data/lib/k_config/version.rb +1 -1
- data/lib/k_config.rb +36 -1
- data/package-lock.json +2 -2
- data/package.json +1 -1
- metadata +31 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1edaa1dc5bed9b7c3647d4026db9c9a63912bad4d98b018202da5ae2b4cc1dc3
|
4
|
+
data.tar.gz: 1128004ce02570411ded4c05301912bd3f8e7ba31cbe408357bdafcd6bb008c7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4cd0fef80d6e75ecc2116c693ec96f0950bd2cd2dca1a493909f1761e5b5ac6f879318d1d5f0af87bbcacb4e238dbfa9ad2676d9ab2afdc0dd71f03664811aa4
|
7
|
+
data.tar.gz: '0918a50a5de0aa66aace3f54d90fb29c5da9f0f9d57246e1b06329dca02d5e2380b89e7ffcea58d202deac95e45994e1d52a23ca528fd703c9da35cee1cf79a1'
|
data/docs/CHANGELOG.md
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
## [0.0.2](https://github.com/klueless-io/k_config/compare/v0.0.1...v0.0.2) (2022-02-04)
|
2
|
+
|
3
|
+
|
4
|
+
### Bug Fixes
|
5
|
+
|
6
|
+
* github actions (ci/cd) ([ddde14c](https://github.com/klueless-io/k_config/commit/ddde14c614eaf904cc15dc4dc5e2131e1c6ce620))
|
7
|
+
* github actions (ci/cd) ([2cfd62d](https://github.com/klueless-io/k_config/commit/2cfd62d6c4031008107366efc1fd88c78136fbc4))
|
data/k_config.gemspec
CHANGED
@@ -42,6 +42,6 @@ Gem::Specification.new do |spec|
|
|
42
42
|
}
|
43
43
|
|
44
44
|
spec.add_dependency 'k_log', '~> 0.0.0'
|
45
|
-
|
46
|
-
|
45
|
+
spec.add_dependency 'k_type', '~> 0.0.0'
|
46
|
+
spec.add_dependency 'k_util', '~> 0.0.0'
|
47
47
|
end
|
data/lib/k_config/version.rb
CHANGED
data/lib/k_config.rb
CHANGED
@@ -1,12 +1,47 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'k_log'
|
4
|
+
require 'k_type'
|
5
|
+
|
3
6
|
require_relative 'k_config/version'
|
7
|
+
require_relative 'k_config/configuration'
|
4
8
|
|
9
|
+
# KConfig is a configuration helper for k_* GEMs.
|
5
10
|
module KConfig
|
6
11
|
# raise KConfig::Error, 'Sample message'
|
7
12
|
Error = Class.new(StandardError)
|
8
13
|
|
9
|
-
#
|
14
|
+
# Configuration helpers
|
15
|
+
class << self
|
16
|
+
attr_writer :configuration
|
17
|
+
attr_writer :default_configuration_type
|
18
|
+
|
19
|
+
def default_configuration_type
|
20
|
+
@default_configuration_type ||= KConfig::Configuration
|
21
|
+
end
|
22
|
+
|
23
|
+
def configuration(config_name = :default)
|
24
|
+
@configuration ||= Hash.new do |h, key|
|
25
|
+
h[key] = default_configuration_type.new
|
26
|
+
end
|
27
|
+
config = @configuration[config_name]
|
28
|
+
config.config_name = config_name if config.respond_to?(:config_name) && config.config_name.nil?
|
29
|
+
config
|
30
|
+
end
|
31
|
+
|
32
|
+
def reset(config_name = :default)
|
33
|
+
@configuration ||= Hash.new do |h, key|
|
34
|
+
h[key] = default_configuration_type.new
|
35
|
+
end
|
36
|
+
config = default_configuration_type.new
|
37
|
+
config.config_name = config_name if config.respond_to?(:config_name) && config.config_name.nil?
|
38
|
+
@configuration[config_name] = config
|
39
|
+
end
|
40
|
+
|
41
|
+
def configure(config_name = :default)
|
42
|
+
yield(configuration(config_name))
|
43
|
+
end
|
44
|
+
end
|
10
45
|
end
|
11
46
|
|
12
47
|
if ENV['KLUE_DEBUG']&.to_s&.downcase == 'true'
|
data/package-lock.json
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
{
|
2
2
|
"name": "k_config",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.3",
|
4
4
|
"lockfileVersion": 2,
|
5
5
|
"requires": true,
|
6
6
|
"packages": {
|
7
7
|
"": {
|
8
8
|
"name": "k_config",
|
9
|
-
"version": "0.0.
|
9
|
+
"version": "0.0.3",
|
10
10
|
"devDependencies": {
|
11
11
|
"@klueless-js/semantic-release-rubygem": "github:klueless-js/semantic-release-rubygem",
|
12
12
|
"@semantic-release/changelog": "^6.0.1",
|
data/package.json
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: k_config
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Cruwys
|
@@ -24,6 +24,34 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 0.0.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: k_type
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.0.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.0.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: k_util
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.0.0
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.0.0
|
27
55
|
description: " KConfig provides configuration for multi-plugin architecture\n"
|
28
56
|
email:
|
29
57
|
- david@ideasmen.com.au
|
@@ -49,10 +77,12 @@ files:
|
|
49
77
|
- Rakefile
|
50
78
|
- bin/console
|
51
79
|
- bin/setup
|
80
|
+
- docs/CHANGELOG.md
|
52
81
|
- docs/CODE_OF_CONDUCT.md
|
53
82
|
- docs/LICENSE.txt
|
54
83
|
- k_config.gemspec
|
55
84
|
- lib/k_config.rb
|
85
|
+
- lib/k_config/configuration.rb
|
56
86
|
- lib/k_config/version.rb
|
57
87
|
- package-lock.json
|
58
88
|
- package.json
|