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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 53af9d714dc548d9c4c29abe2876d9e380809e3ef4eb871d013a048d4eee4dc7
4
- data.tar.gz: ec8252bd1ab496b402ebcc73dec9d748128d52b64b726df986593b6a78857616
3
+ metadata.gz: 1edaa1dc5bed9b7c3647d4026db9c9a63912bad4d98b018202da5ae2b4cc1dc3
4
+ data.tar.gz: 1128004ce02570411ded4c05301912bd3f8e7ba31cbe408357bdafcd6bb008c7
5
5
  SHA512:
6
- metadata.gz: f3d7d67c59e8c52840305f94756b17443d87412e70b44b06e9beaf4aeb5ff1cd85e30d2a20a367d5c4d80212293d5ea460cc840e793cb798d9d6936870094fa4
7
- data.tar.gz: aab511ef8002737664a495bf892aa9d8b6bcdda08f8116518a8a5ecaaf59c5a080c1cc377b9189200d2e020996eb8f2839913183a554991425b717a1dc9e9931
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
- # spec.add_dependency 'k_type', '~> 0.0.0'
46
- # spec.add_dependency 'k_util', '~> 0.0.0'
45
+ spec.add_dependency 'k_type', '~> 0.0.0'
46
+ spec.add_dependency 'k_util', '~> 0.0.0'
47
47
  end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module KConfig
4
+ # Configuration object for all k_* GEMs.
5
+ class Configuration
6
+ include KUtil::Data::InstanceVariablesToH
7
+
8
+ attr_accessor :config_name
9
+ end
10
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module KConfig
4
- VERSION = '0.0.2'
4
+ VERSION = '0.0.3'
5
5
  end
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
- # Your code goes here...
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.2",
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.2",
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "k_config",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "description": "Command line and CI/CD tools for K Config",
5
5
  "scripts": {
6
6
  "release": "semantic-release"
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.2
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