qonfig 0.19.0 → 0.19.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a79da0cb673ac91a97924b8b6c1a0a6ae193eb3e0529d784debe2b281827f130
4
- data.tar.gz: f2280966ff22e8ef1bfbe55d62641be2c1edd0f5a7bfca208d832903f7ef85ab
3
+ metadata.gz: dab3b453c59fc8f9431ddeb3e0fb3cccd067947bf2275e94d2b75f8862e66c70
4
+ data.tar.gz: 7fb3387c500b3d9f738710ed5db17b3d594fffef048b06895498b8710b224257
5
5
  SHA512:
6
- metadata.gz: 86521c09f933f5e8deb88fb1a8cecb59e6a050006a76a0b3b18502c900e8cbafcca6fd46bd8b6d45c2caf4e7c007cda319b267951a7a09733f9ef8f4fd22cdd3
7
- data.tar.gz: 8d180bf77e2a3082843a3a05b5ea36f88de70997100cf829c1824515c9c6c8e23cbcf58ff8f2b908a18efee26563def86bcaf92700ee19b8402b14a0c83f7c73
6
+ metadata.gz: 8317ded309d56239bbf763a4e72f6b0364981f6a2c87831f0dab396f9c9c2de61b8a062ec22f45b58a942731f46f0d171983e0f25cce2d07e2291f98049d8987
7
+ data.tar.gz: a06e95e78176a44c7de83548ee5e57f614442ecca6a42b681429cd26f4ef0489cf89ddfec716bf59b96bbd30d7a044a718a020bb9db98fcd5ee8d6f9a9629b86
data/.travis.yml CHANGED
@@ -2,9 +2,6 @@ language: ruby
2
2
  matrix:
3
3
  fast_finish: true
4
4
  include:
5
- - rvm: 2.3.8
6
- gemfile: gemfiles/with_external_deps.gemfile
7
- env: TEST_PLUGINS=true
8
5
  - rvm: 2.4.9
9
6
  gemfile: gemfiles/with_external_deps.gemfile
10
7
  env: TEST_PLUGINS=true
@@ -20,8 +17,6 @@ matrix:
20
17
  - rvm: jruby-head
21
18
  gemfile: gemfiles/with_external_deps.gemfile
22
19
  env: TEST_PLUGINS=true
23
- - rvm: 2.3.8
24
- gemfile: gemfiles/without_external_deps.gemfile
25
20
  - rvm: 2.4.9
26
21
  gemfile: gemfiles/without_external_deps.gemfile
27
22
  - rvm: 2.5.7
data/CHANGELOG.md CHANGED
@@ -1,6 +1,13 @@
1
1
  # Changelog
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
+ ## [0.19.1] - 2019-11-29
5
+ ### Changed
6
+ - Support for Ruby 2.3 has ended.
7
+
8
+ ### Fixed
9
+ - Invalid default values for `#export_settings` method attributes (invalid `mappings:` value);
10
+
4
11
  ## [0.19.0] - 2019-11-26
5
12
  ### Added
6
13
  - **FINALY**: support for dot-notation in `#key?`, `#option?`, `#setting?`, `#dig`, `#subset`, `#slice`, `#slice_value`, `[]`;
data/README.md CHANGED
@@ -1,8 +1,7 @@
1
1
  # Qonfig · [![Gem Version](https://badge.fury.io/rb/qonfig.svg)](https://badge.fury.io/rb/qonfig) [![Build Status](https://travis-ci.org/0exp/qonfig.svg?branch=master)](https://travis-ci.org/0exp/qonfig) [![Coverage Status](https://coveralls.io/repos/github/0exp/qonfig/badge.svg?branch=master)](https://coveralls.io/github/0exp/qonfig?branch=master)
2
2
 
3
3
  Config. Defined as a class. Used as an instance. Support for inheritance and composition.
4
- Lazy instantiation. Thread-safe. Command-style DSL. Validation layer. **DOT-NOTATION**!
5
- Support for **YAML**, **TOML**, **JSON**, **\_\_END\_\_**, **ENV**.
4
+ Lazy instantiation. Thread-safe. Command-style DSL. Validation layer. **DOT-NOTATION**! And pretty-print :) Support for **YAML**, **TOML**, **JSON**, **\_\_END\_\_**, **ENV**.
6
5
  Extremely simple to define. Extremely simple to use. That's all? **NOT** :)
7
6
 
8
7
  ## Installation
@@ -939,11 +938,17 @@ config.settings.database.engine.driver? # => true (true => true)
939
938
 
940
939
  ### Setting key existence
941
940
 
942
- - `#key?(*key_path)` / `#option?(*key_path)` / `#setting?(*key_path)`
941
+ - supports **dynamic array-like format** and **canonical dot-notation format**;
942
+ - returns `true` if the concrete key is exist;
943
+ - returns `false` if the concrete key does not exist;
944
+ - **dynamic array-like format**:
945
+ - `#key?(*key_path)` / `#option?(*key_path)` / `#setting?(*key_path)`;
943
946
  - `*key_path` - an array of symbols and strings that represents a path to the concrete setting key;
944
947
  - (for example, `config.key?(:credentials, :user)` tries to check that `config.settings.credentials.user` is exist);
945
- - returns `true` if the concrete key is exist;
946
- - returns `false` if the concrete key does not exist;
948
+ - **dot-notation format**:
949
+ - `#key?(key)` / `#option?(key)` / `#setting?(key)`;
950
+ - `key` - string in dot-notated format
951
+ - (for example: `config.key?('credentials.user')` tries to check that `config.settings.crednetials.user` is exist);
947
952
 
948
953
  ```ruby
949
954
  class Config < Qonfig::DataSet
@@ -955,15 +960,21 @@ end
955
960
 
956
961
  config = Config.new
957
962
 
963
+ # --- array-like format ---
958
964
  config.key?('credentials', 'user') # => true
959
965
  config.key?('credentials', 'token') # => false (key does not exist)
960
966
 
967
+ # --- dot-notation format ---
968
+ config.key?('credentials.user') # => true
969
+ config.key?('credentials.token') # => false (key does not exist)
970
+
961
971
  config.key?('credentials') # => true
962
972
  config.key?('que_adapter') # => false (key does not exist)
963
973
 
964
974
  # aliases
965
975
  config.setting?('credentials') # => true
966
976
  config.option?(:credentials, :password) # => true
977
+ config.option?('credentials.password') # => true
967
978
  ```
968
979
 
969
980
  ---
@@ -1148,7 +1159,7 @@ service.credentials # => { "account" => { "login" => "D@iVeR", "auth_token" => "
1148
1159
 
1149
1160
  - all config objects can export their settings to an arbitrary object as singleton methods;
1150
1161
  - (**IMPORTANT**) `export_settings` exports config settings as access methods to config's settings (creates `attr_reader`s for your config);
1151
- - signature: `#export(exportable_object, *setting_keys, mappings: {}, prefix: '', raw: false)`:
1162
+ - signature: `#export_settings(exportable_object, *setting_keys, mappings: {}, prefix: '', raw: false)`:
1152
1163
  - `exportable_object` - an arbitrary object for exporting;
1153
1164
  - `*setting_keys` - an array of dot-notaed config's setting keys that should be exported
1154
1165
  (dot-notaed key is a key that describes each part of nested setting key as a string separated by `dot`-symbol);
@@ -1178,7 +1189,7 @@ service = ServiceObject.new
1178
1189
  service.config_account # => NoMethodError
1179
1190
 
1180
1191
  # NOTE: export settings as access methods to config's settings
1181
- config.export(service, 'web_api.credentials.account', prefix: 'config_')
1192
+ config.export_settings(service, 'web_api.credentials.account', prefix: 'config_')
1182
1193
 
1183
1194
  service.config_account # => { "login" => "D@iVeR", "auth_token" => "IAdkoa0@()1239uA" }
1184
1195
  ```
@@ -2655,7 +2666,7 @@ Qonfig.enable(:pretty_print) # or Qonfig.enable('pretty_print')
2655
2666
  Qonfig.load(:pretty_print) # or Qonfig.load('pretty_print')
2656
2667
  ```
2657
2668
 
2658
- - show load plugins:
2669
+ - show loaded plugins:
2659
2670
 
2660
2671
  ```ruby
2661
2672
  Qonfig.loaded_plugins # => ["pretty_print"]
@@ -409,7 +409,7 @@ class Qonfig::DataSet # rubocop:disable Metrics/ClassLength
409
409
  def export_settings(
410
410
  exportable_object,
411
411
  *exported_setting_keys,
412
- mappings: Qonfig::Imports::Abstract::EMPTY_MAPPINGS,
412
+ mappings: Qonfig::Imports::Mappings::EMPTY_MAPPINGS,
413
413
  raw: false,
414
414
  prefix: Qonfig::Imports::Abstract::EMPTY_PREFIX
415
415
  )
@@ -18,7 +18,7 @@ module Qonfig::Imports::Export
18
18
  exportable_object,
19
19
  exported_config,
20
20
  *exported_setting_keys,
21
- mappings: Qonfig::Imports::Abstract::EMPTY_MAPPINGS,
21
+ mappings: Qonfig::Imports::Mappings::EMPTY_MAPPINGS,
22
22
  raw: false,
23
23
  prefix: Qonfig::Imports::Abstract::EMPTY_PREFIX
24
24
  )
@@ -18,8 +18,8 @@ class Qonfig::Imports::General
18
18
  seeded_klass,
19
19
  imported_config,
20
20
  *imported_keys,
21
- mappings: EMPTY_MAPPINGS,
22
- prefix: EMPTY_PREFIX,
21
+ mappings: Qonfig::Imports::Mappings::EMPTY_MAPPINGS,
22
+ prefix: Qonfig::Imports::Abstract::EMPTY_PREFIX,
23
23
  raw: false
24
24
  )
25
25
  new(
@@ -47,8 +47,8 @@ class Qonfig::Imports::General
47
47
  seeded_klass,
48
48
  imported_config,
49
49
  *imported_keys,
50
- mappings: EMPTY_MAPPINGS,
51
- prefix: EMPTY_PREFIX,
50
+ mappings: Qonfig::Imports::Mappings::EMPTY_MAPPINGS,
51
+ prefix: Qonfig::Imports::Abstract::EMPTY_PREFIX,
52
52
  raw: false
53
53
  )
54
54
  @seeded_klass = seeded_klass
@@ -5,5 +5,5 @@ module Qonfig
5
5
  #
6
6
  # @api public
7
7
  # @since 0.1.0
8
- VERSION = '0.19.0'
8
+ VERSION = '0.19.1'
9
9
  end
data/qonfig.gemspec CHANGED
@@ -6,7 +6,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
6
6
  require 'qonfig/version'
7
7
 
8
8
  Gem::Specification.new do |spec|
9
- spec.required_ruby_version = '>= 2.3.8'
9
+ spec.required_ruby_version = '>= 2.4.9'
10
10
 
11
11
  spec.name = 'qonfig'
12
12
  spec.version = Qonfig::VERSION
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qonfig
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.19.0
4
+ version: 0.19.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rustam Ibragimov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-11-26 00:00:00.000000000 Z
11
+ date: 2019-11-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: coveralls
@@ -233,14 +233,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
233
233
  requirements:
234
234
  - - ">="
235
235
  - !ruby/object:Gem::Version
236
- version: 2.3.8
236
+ version: 2.4.9
237
237
  required_rubygems_version: !ruby/object:Gem::Requirement
238
238
  requirements:
239
239
  - - ">="
240
240
  - !ruby/object:Gem::Version
241
241
  version: '0'
242
242
  requirements: []
243
- rubygems_version: 3.0.3
243
+ rubyforge_project:
244
+ rubygems_version: 2.7.6
244
245
  signing_key:
245
246
  specification_version: 4
246
247
  summary: Config object