qonfig 0.25.0 → 0.26.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (136) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +0 -2
  3. data/.rubocop.yml +19 -1
  4. data/.travis.yml +7 -2
  5. data/CHANGELOG.md +4 -0
  6. data/Gemfile.lock +102 -0
  7. data/README.md +2 -0
  8. data/gemfiles/with_external_deps.gemfile.lock +112 -0
  9. data/gemfiles/without_external_deps.gemfile.lock +102 -0
  10. data/lib/qonfig.rb +1 -1
  11. data/lib/qonfig/commands/definition/load_from_env.rb +2 -0
  12. data/lib/qonfig/commands/definition/load_from_env/value_converter.rb +2 -0
  13. data/lib/qonfig/imports/direct_key.rb +8 -2
  14. data/lib/qonfig/imports/mappings.rb +8 -2
  15. data/lib/qonfig/loaders/basic.rb +2 -0
  16. data/lib/qonfig/loaders/json.rb +2 -1
  17. data/lib/qonfig/settings.rb +5 -1
  18. data/lib/qonfig/settings/key_matcher.rb +1 -1
  19. data/lib/qonfig/uploaders/base.rb +2 -0
  20. data/lib/qonfig/uploaders/yaml.rb +2 -0
  21. data/lib/qonfig/version.rb +1 -1
  22. data/qonfig.gemspec +4 -6
  23. data/sig/.keep +0 -0
  24. data/spec/features/clear_options_spec.rb +92 -0
  25. data/spec/features/compacted_config_spec.rb +308 -0
  26. data/spec/features/composition_spec.rb +207 -0
  27. data/spec/features/config_definition_and_representation_spec.rb +535 -0
  28. data/spec/features/definition_order_spec.rb +69 -0
  29. data/spec/features/dig_functionality_spec.rb +47 -0
  30. data/spec/features/dot_notation_spec.rb +159 -0
  31. data/spec/features/export_settings_spec.rb +138 -0
  32. data/spec/features/expose_json_spec.rb +281 -0
  33. data/spec/features/expose_self/format_option_dynamic_spec.rb +69 -0
  34. data/spec/features/expose_self/format_option_json_spec.rb +74 -0
  35. data/spec/features/expose_self/format_option_unsupported_spec.rb +27 -0
  36. data/spec/features/expose_self/format_option_yaml_spec.rb +77 -0
  37. data/spec/features/expose_self_spec.rb +97 -0
  38. data/spec/features/expose_yaml_spec.rb +263 -0
  39. data/spec/features/freeze_state_spec.rb +122 -0
  40. data/spec/features/get_config_keys_spec.rb +62 -0
  41. data/spec/features/get_config_values_spec.rb +41 -0
  42. data/spec/features/has_a_key_spec.rb +48 -0
  43. data/spec/features/import_settings_spec.rb +323 -0
  44. data/spec/features/indifferent_access_spec.rb +57 -0
  45. data/spec/features/inheritance_spec.rb +110 -0
  46. data/spec/features/instantiation_without_class_definition_spec.rb +59 -0
  47. data/spec/features/iteration_over_setting_keys_spec.rb +48 -0
  48. data/spec/features/load_from_env_spec.rb +240 -0
  49. data/spec/features/load_from_json_spec.rb +97 -0
  50. data/spec/features/load_from_self/format_option_json_spec.rb +31 -0
  51. data/spec/features/load_from_self/format_option_unsupported_spec.rb +27 -0
  52. data/spec/features/load_from_self/format_option_yaml_spec.rb +49 -0
  53. data/spec/features/load_from_self/with_erb_instructions_spec.rb +33 -0
  54. data/spec/features/load_from_self/with_hash_like_data_representation_spec.rb +66 -0
  55. data/spec/features/load_from_self/with_non_hash_like_data_representation_spec.rb +19 -0
  56. data/spec/features/load_from_self/without_end_data_spec.rb +11 -0
  57. data/spec/features/load_from_yaml_spec.rb +110 -0
  58. data/spec/features/load_setting_values_from_file/by_instance_method_examples.rb +171 -0
  59. data/spec/features/load_setting_values_from_file/by_macros_examples.rb +165 -0
  60. data/spec/features/load_setting_values_from_file/load_from_json_spec.rb +21 -0
  61. data/spec/features/load_setting_values_from_file/load_from_self/json_format/end_data_with_env_spec.rb +100 -0
  62. data/spec/features/load_setting_values_from_file/load_from_self/json_format/with_end_data_spec.rb +129 -0
  63. data/spec/features/load_setting_values_from_file/load_from_self/json_format/with_incorrect_end_data_spec.rb +34 -0
  64. data/spec/features/load_setting_values_from_file/load_from_self/json_format/without_end_data_spec.rb +65 -0
  65. data/spec/features/load_setting_values_from_file/load_from_self/yaml_format/end_data_with_env_spec.rb +94 -0
  66. data/spec/features/load_setting_values_from_file/load_from_self/yaml_format/with_end_data_spec.rb +126 -0
  67. data/spec/features/load_setting_values_from_file/load_from_self/yaml_format/with_incorrect_end_data_spec.rb +32 -0
  68. data/spec/features/load_setting_values_from_file/load_from_self/yaml_format/without_end_data_spec.rb +65 -0
  69. data/spec/features/load_setting_values_from_file/load_from_yaml_spec.rb +21 -0
  70. data/spec/features/load_setting_values_from_file/shared_behavior_spec.rb +33 -0
  71. data/spec/features/mixin_spec.rb +387 -0
  72. data/spec/features/non_redefineable_core_methods_spec.rb +29 -0
  73. data/spec/features/plugins/pretty_print_spec.rb +86 -0
  74. data/spec/features/plugins/toml/expose_self/format_option_toml_spec.rb +71 -0
  75. data/spec/features/plugins/toml/expose_toml_spec.rb +221 -0
  76. data/spec/features/plugins/toml/load_from_self/format_option_toml_spec.rb +27 -0
  77. data/spec/features/plugins/toml/load_from_toml_spec.rb +109 -0
  78. data/spec/features/plugins/toml/load_setting_values_from_file/load_from_toml_spec.rb +27 -0
  79. data/spec/features/plugins/toml/load_setting_values_from_file/load_toml_from_self/end_data_with_env_spec.rb +95 -0
  80. data/spec/features/plugins/toml/load_setting_values_from_file/load_toml_from_self/with_end_data_spec.rb +125 -0
  81. data/spec/features/plugins/toml/load_setting_values_from_file/load_toml_from_self/with_incorrect_end_data_spec.rb +34 -0
  82. data/spec/features/plugins/toml/load_setting_values_from_file/load_toml_from_self/without_end_data_spec.rb +65 -0
  83. data/spec/features/plugins/toml/load_setting_values_from_file/shared_behavior_spec.rb +34 -0
  84. data/spec/features/plugins/toml/save_to_toml_spec.rb +149 -0
  85. data/spec/features/plugins/vault/expose_vault_spec.rb +117 -0
  86. data/spec/features/plugins/vault/load_from_vault_spec.rb +80 -0
  87. data/spec/features/plugins_spec.rb +89 -0
  88. data/spec/features/reload_spec.rb +75 -0
  89. data/spec/features/run_code_with_temporary_settings_spec.rb +104 -0
  90. data/spec/features/save_to_file/save_to_json_spec.rb +157 -0
  91. data/spec/features/save_to_file/save_to_yaml_spec.rb +189 -0
  92. data/spec/features/settings_as_predicates_spec.rb +47 -0
  93. data/spec/features/settings_redefinition_spec.rb +30 -0
  94. data/spec/features/slice_functionality_spec.rb +69 -0
  95. data/spec/features/subset_functionality_spec.rb +49 -0
  96. data/spec/features/validation_spec.rb +916 -0
  97. data/spec/fixtures/array_settings.yml +3 -0
  98. data/spec/fixtures/expose_json/incompatible_root_structure.json +6 -0
  99. data/spec/fixtures/expose_json/incompatible_structure.json +4 -0
  100. data/spec/fixtures/expose_json/project.development.json +7 -0
  101. data/spec/fixtures/expose_json/project.json +30 -0
  102. data/spec/fixtures/expose_json/project.production.json +7 -0
  103. data/spec/fixtures/expose_json/project.staging.json +7 -0
  104. data/spec/fixtures/expose_json/project.test.json +7 -0
  105. data/spec/fixtures/expose_yaml/incompatible_structure.yml +2 -0
  106. data/spec/fixtures/expose_yaml/project.development.yml +4 -0
  107. data/spec/fixtures/expose_yaml/project.production.yml +4 -0
  108. data/spec/fixtures/expose_yaml/project.staging.yml +4 -0
  109. data/spec/fixtures/expose_yaml/project.test.yml +4 -0
  110. data/spec/fixtures/expose_yaml/project.yml +25 -0
  111. data/spec/fixtures/json_array_sample.json +14 -0
  112. data/spec/fixtures/json_object_sample.json +9 -0
  113. data/spec/fixtures/json_with_empty_object.json +6 -0
  114. data/spec/fixtures/json_with_erb.json +6 -0
  115. data/spec/fixtures/plugins/toml/expose_toml/project.development.toml +4 -0
  116. data/spec/fixtures/plugins/toml/expose_toml/project.production.toml +4 -0
  117. data/spec/fixtures/plugins/toml/expose_toml/project.staging.toml +4 -0
  118. data/spec/fixtures/plugins/toml/expose_toml/project.test.toml +4 -0
  119. data/spec/fixtures/plugins/toml/expose_toml/project.toml +27 -0
  120. data/spec/fixtures/plugins/toml/mini_file.toml +6 -0
  121. data/spec/fixtures/plugins/toml/toml_sample_with_all_types.toml +72 -0
  122. data/spec/fixtures/plugins/toml/values_file/with_env.toml +13 -0
  123. data/spec/fixtures/plugins/toml/values_file/without_env.toml +6 -0
  124. data/spec/fixtures/rubocop_settings.yml +12 -0
  125. data/spec/fixtures/shared_settings_with_aliases.yml +10 -0
  126. data/spec/fixtures/travis_settings.yml +6 -0
  127. data/spec/fixtures/values_file/with_env.json +19 -0
  128. data/spec/fixtures/values_file/with_env.yml +17 -0
  129. data/spec/fixtures/values_file/without_env.json +8 -0
  130. data/spec/fixtures/values_file/without_env.yml +5 -0
  131. data/spec/fixtures/with_empty_hash.yml +4 -0
  132. data/spec/fixtures/with_erb_instructions.yml +3 -0
  133. data/spec/spec_helper.rb +27 -0
  134. data/spec/support/meta_scopes.rb +20 -0
  135. data/spec/support/spec_support.rb +42 -0
  136. metadata +128 -11
@@ -0,0 +1,3 @@
1
+ - 1
2
+ - 2
3
+ - 3
@@ -0,0 +1,6 @@
1
+ [
2
+ {
3
+ "staging": {},
4
+ "test": {}
5
+ }
6
+ ]
@@ -0,0 +1,4 @@
1
+ {
2
+ "staging": 123,
3
+ "test": {}
4
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "api_mode_enabled": true,
3
+ "logging": false,
4
+ "db_driver": "sequel",
5
+ "throttle_requests": false,
6
+ "credentials": {}
7
+ }
@@ -0,0 +1,30 @@
1
+ {
2
+ "development": {
3
+ "api_mode_enabled": true,
4
+ "logging": false,
5
+ "db_driver": "sequel",
6
+ "throttle_requests": false,
7
+ "credentials": {}
8
+ },
9
+ "test": {
10
+ "api_mode_enabled": true,
11
+ "logging": false,
12
+ "db_driver": "in_memory",
13
+ "throttle_requests": false,
14
+ "credentials": {}
15
+ },
16
+ "staging": {
17
+ "api_mode_enabled": true,
18
+ "logging": true,
19
+ "db_driver": "active_record",
20
+ "throttle_requests": true,
21
+ "credentials": {}
22
+ },
23
+ "production": {
24
+ "api_mode_enabled": true,
25
+ "logging": true,
26
+ "db_driver": "rom",
27
+ "throttle_requests": true,
28
+ "credentials": {}
29
+ }
30
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "api_mode_enabled": true,
3
+ "logging": true,
4
+ "db_driver": "rom",
5
+ "throttle_requests": true,
6
+ "credentials": {}
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "api_mode_enabled": true,
3
+ "logging": true,
4
+ "db_driver": "active_record",
5
+ "throttle_requests": true,
6
+ "credentials": {}
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "api_mode_enabled": false,
3
+ "logging": false,
4
+ "db_driver": "in_memory",
5
+ "throttle_requests": false,
6
+ "credentials": {}
7
+ }
@@ -0,0 +1,2 @@
1
+ staging: 123
2
+ test: {}
@@ -0,0 +1,4 @@
1
+ api_mode_enabled: true
2
+ db_driver: sequel
3
+ logging: false
4
+ credentials: {}
@@ -0,0 +1,4 @@
1
+ api_mode_enabled: true
2
+ db_driver: rom
3
+ logging: true
4
+ credentials: {}
@@ -0,0 +1,4 @@
1
+ api_mode_enabled: true
2
+ db_driver: active_record
3
+ logging: true
4
+ credentials: {}
@@ -0,0 +1,4 @@
1
+ api_mode_enabled: false
2
+ db_driver: in_memory
3
+ logging: false
4
+ credentials: {}
@@ -0,0 +1,25 @@
1
+ default: &default
2
+ api_mode_enabled: true
3
+ logging: true
4
+ db_driver: in_memory
5
+ throttle_requests: false
6
+ credentials: {}
7
+
8
+ development:
9
+ <<: *default
10
+ db_driver: sequel
11
+ logging: false
12
+
13
+ test:
14
+ <<: *default
15
+ logging: false
16
+
17
+ staging:
18
+ <<: *default
19
+ db_driver: active_record
20
+ throttle_requests: true
21
+
22
+ production:
23
+ <<: *default
24
+ db_driver: rom
25
+ throttle_requests: true
@@ -0,0 +1,14 @@
1
+ [
2
+ {
3
+ "user": "D@iveR",
4
+ "maxAuthCount": 55,
5
+ "rubySettings": {
6
+ "allowedVersions": ["2.3", "2.4.2", "1.9.8"],
7
+ "gitLink": null,
8
+ "withAdditionals": false
9
+ }
10
+ },
11
+ {
12
+ "name": "none"
13
+ }
14
+ ]
@@ -0,0 +1,9 @@
1
+ {
2
+ "user": "D@iVeR",
3
+ "maxAuthCount": 55,
4
+ "rubySettings": {
5
+ "allowedVersions": ["2.3", "2.4.2", "1.9.8"],
6
+ "gitLink": null,
7
+ "withAdditionals": false
8
+ }
9
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "requirements": {},
3
+ "credentials": {
4
+ "excluded": {}
5
+ }
6
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "count": <%= 10_000 %>,
3
+ "credentials": {
4
+ "excluded": "<%= 'some string here' %>"
5
+ }
6
+ }
@@ -0,0 +1,4 @@
1
+ api_mode_enabled = true
2
+ db_driver = 'sequel'
3
+ logging = false
4
+ [credentials]
@@ -0,0 +1,4 @@
1
+ api_mode_enabled = true
2
+ db_driver = 'rom'
3
+ logging = true
4
+ [credentials]
@@ -0,0 +1,4 @@
1
+ api_mode_enabled = true
2
+ db_driver = 'active_record'
3
+ logging = true
4
+ [credentials]
@@ -0,0 +1,4 @@
1
+ api_mode_enabled = false
2
+ db_driver = 'in_memory'
3
+ logging = false
4
+ [credentials]
@@ -0,0 +1,27 @@
1
+ [development]
2
+ api_mode_enabled = true
3
+ logging = false
4
+ db_driver = 'sequel'
5
+ throttle_requests = false
6
+ [development.credentials]
7
+
8
+ [test]
9
+ api_mode_enabled = true
10
+ logging = false
11
+ db_driver = 'in_memory'
12
+ throttle_requests = false
13
+ [test.credentials]
14
+
15
+ [staging]
16
+ api_mode_enabled = true
17
+ logging = true
18
+ db_driver = 'active_record'
19
+ throttle_requests = true
20
+ [staging.credentials]
21
+
22
+ [production]
23
+ api_mode_enabled = true
24
+ logging = true
25
+ db_driver = 'rom'
26
+ throttle_requests = true
27
+ [production.credentials]
@@ -0,0 +1,6 @@
1
+ enabled = false
2
+ adapter = 'sidekiq'
3
+
4
+ [credentials]
5
+ user = '0exp'
6
+ timeout = 123
@@ -0,0 +1,72 @@
1
+ key_in_air = "TOML Example"
2
+
3
+ inline_table_of_tables = [
4
+ { x = 1, y = 2, z = 3 },
5
+ { x = 7, y = 8, z = 9 },
6
+ { x = 2, y = 4, z = 8 }
7
+ ]
8
+
9
+ [strings]
10
+ simple_string = "Simple String"
11
+ first_multi_line_string = """
12
+ first multiline
13
+ string defined"""
14
+ second_multiline_string = '''
15
+ second multiline
16
+ string defined
17
+ '''
18
+
19
+ [times]
20
+ first_format = 1979-05-27T07:32:00Z
21
+ second_format = 1979-05-27T00:32:00-07:00
22
+ third_format = 1979-05-27T00:32:00.999999-07:00
23
+
24
+ [arrays]
25
+ array_of_integers = [ 1, 2, 3 ]
26
+ array_of_strings = [ "a", "b", "c" ]
27
+ array_of_integer_arrays = [ [ 1, 2 ], [3, 4, 5] ]
28
+ array_of_different_string_literals = [ "azaza", 'trazaza', """kek""", '''pek''']
29
+ array_of_multityped_arrays = [ [ 1, 2 ], ["a", "b", "c"] ]
30
+ multyline_array = [
31
+ "super",
32
+ "puper"
33
+ ]
34
+
35
+ [number_definitions]
36
+ number_with_parts = [ 8_001, 8_001, 8_002 ]
37
+ number_with_idiot_parts = 5_0_0_0
38
+ simple_float = 3.12138
39
+ epic_float = 5e+22
40
+ haha_float = 1e6
41
+ wow_float = -2E-2
42
+
43
+ [booleans]
44
+ boolean_true = true
45
+ boolean_false = false
46
+
47
+ [nesteds]
48
+ [nesteds.first]
49
+ ip = "10.0.0.1"
50
+ host = "google.sru"
51
+ [nesteds.second]
52
+ ip = "10.0.0.2"
53
+ host = "poogle.fru"
54
+
55
+ [[deep_nesteds]]
56
+ name = "apple"
57
+
58
+ [deep_nesteds.first]
59
+ model = "iphone xs"
60
+ color = "white"
61
+
62
+ [[deep_nesteds.second]]
63
+ model = "iphone x"
64
+
65
+ [[deep_nesteds.third]]
66
+ model = "iphone se"
67
+
68
+ [[deep_nesteds]]
69
+ name = "xiaomi"
70
+
71
+ [[deep_nesteds.fourth]]
72
+ model = "mi8 explorer edition"
@@ -0,0 +1,13 @@
1
+ [test]
2
+ enabled = false
3
+ adapter = 'sidekiq'
4
+ [test.credentials]
5
+ user = 'D@iVeR'
6
+ timeout = 321
7
+
8
+ [production]
9
+ enabled = true
10
+ adapter = 'que'
11
+ [production.credentials]
12
+ user = '0exp'
13
+ timeout = 123
@@ -0,0 +1,6 @@
1
+ enabled = false
2
+ adapter = 'sidekiq'
3
+
4
+ [credentials]
5
+ user = '0exp'
6
+ timeout = 123
@@ -0,0 +1,12 @@
1
+ require: rubocop-rspec
2
+
3
+ AllCops:
4
+ Include:
5
+ - lib/**/*
6
+ - spec/**/*
7
+ Exclude:
8
+ - bin/**/*
9
+ - Gemfile
10
+
11
+ Metrics/LineLength:
12
+ Max: 100
@@ -0,0 +1,10 @@
1
+ enable_api: false
2
+ run_sidekiq: true
3
+
4
+ default: &default
5
+ test: true
6
+ engine: rspec
7
+
8
+ staging:
9
+ <<: *default
10
+ engine: minitest
@@ -0,0 +1,6 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.5.1
5
+ - ruby-head
6
+ - jruby-head
@@ -0,0 +1,19 @@
1
+ {
2
+ "test": {
3
+ "enabled": false,
4
+ "adapter": "sidekiq",
5
+ "credentials": {
6
+ "user": "D@iVeR",
7
+ "timeout": 321
8
+ }
9
+ },
10
+
11
+ "production": {
12
+ "enabled": true,
13
+ "adapter": "que",
14
+ "credentials": {
15
+ "user": "0exp",
16
+ "timeout": 123
17
+ }
18
+ }
19
+ }
@@ -0,0 +1,17 @@
1
+ defaults: &defaults
2
+ enabled: false
3
+ adapter: sidekiq
4
+ credentials:
5
+ user: 0exp
6
+ timeout: 123
7
+
8
+ test:
9
+ <<: *defaults
10
+ credentials:
11
+ user: D@iVeR
12
+ timeout: 321
13
+
14
+ production:
15
+ <<: *defaults
16
+ adapter: que
17
+ enabled: true
@@ -0,0 +1,8 @@
1
+ {
2
+ "enabled": false,
3
+ "adapter": "sidekiq",
4
+ "credentials": {
5
+ "user": "0exp",
6
+ "timeout": 123
7
+ }
8
+ }
@@ -0,0 +1,5 @@
1
+ enabled: false
2
+ adapter: sidekiq
3
+ credentials:
4
+ user: 0exp
5
+ timeout: 123
@@ -0,0 +1,4 @@
1
+ settings: {}
2
+ another_settings:
3
+ option_a: {}
4
+ option_b: 1