gorynich 1.3.2.231715 → 1.3.3.231946

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: 934c609dc4ca0e3ebff06eacd58dde28bef02381862cafaed2c75836ccdc00b8
4
- data.tar.gz: 563a7047f3c58c139bd3b18f9826fb2fe5a7c54ab27b2f3f2a034c7cfca2438b
3
+ metadata.gz: c580367795e9f7b4337327a151bb380c0beb210126b4c3382f9cd9179b517b6f
4
+ data.tar.gz: 072e6a4cdf3f7948c7861ca53d5c94075d451302ad837acbfdea90dcbc6d4a26
5
5
  SHA512:
6
- metadata.gz: 4fd586dc2bfea2e076cb11c04e9a4e8f97897c2ce50bdb0f7dbfc20f6059f8c10d100dd5c8e82edaa1586f19692a3050349a937c70086a64d823cb1fa0e6e475
7
- data.tar.gz: 0bc93c0a785765a98e8abfd0d1679c80565e6e34aeb7f7ba07c8a41928e3d75385570eb4b7b74594cc03d8ceeae55a523ddde4cfc4fbe2e96bc921c0300f0688
6
+ metadata.gz: b5a314c932a44623e787e77858e247127e7f437bd77f1d0888767579c63c6908467f7baafcafc03c8d82476ea0131ecd59713207e71920b6a6a2522af8ae2878
7
+ data.tar.gz: 42332bba266151eda388aa3dea13904806721d29b9d9e3f4a1e295ec23f5b62e16def75dacf5151fafbf78eb95c7d2ab779a61ae089b0b7dac2eb2e903de1303
@@ -126,13 +126,17 @@ module Gorynich
126
126
 
127
127
  #
128
128
  # Database config for database.yml
129
+ # If used <%= Gorynich.instance.database_config(your_enviroment) %> without gorynich config it will raise an error.
130
+ # You can use <%= Gorynich.instance.database_config(your_enviroment, fail_ignore: true) %> if there is no configuration for the environment
131
+ # and dummy_value depending on whether you have a configuration in the database.yml under this environment (dummy_value: nil when there is and dummy_value: {} if there is not. Default dummy_value is nil)
129
132
  #
130
133
  # @param [String] env enviroment
131
- # @param [Boolean] with_ignore ignore if there is no configuration for the environment
134
+ # @param [Boolean] fail_ignore ignore if there is no configuration for the environment
135
+ # @param [nil or Hash] dummy_value value for YAML if there is no config.
132
136
  #
133
137
  # @return [String] yaml result
134
138
  #
135
- def database_config(env = nil, fail_ignore: false)
139
+ def database_config(env = nil, fail_ignore: false, dummy_value: nil)
136
140
  envs = Dir.glob(Rails.root.join('config/environments/*.rb').to_s).map { |f| File.basename(f, '.rb') }
137
141
  cfg = fetcher.fetch.extract!(*envs)
138
142
 
@@ -146,7 +150,7 @@ module Gorynich
146
150
  end
147
151
  else
148
152
  if fail_ignore && cfg[env].nil?
149
- { env => {} }
153
+ { env => dummy_value }
150
154
  else
151
155
  {
152
156
  env => configs_sort(cfg.fetch(env)).to_h { |t, c| [t, c.fetch('db_config')] }
@@ -1,3 +1,3 @@
1
1
  module Gorynich
2
- VERSION = '1.3.2'
2
+ VERSION = '1.3.3'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gorynich
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.2.231715
4
+ version: 1.3.3.231946
5
5
  platform: ruby
6
6
  authors:
7
7
  - Poliev Alexey