system_settings 0.1.0 → 0.2.0

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: 9b0d4b4f84f7a19cd6befcc89649419e39607bb9c0e48a6b201d9c4eb8f07ba0
4
- data.tar.gz: abc9fae1214a54c4fd6f5baeaec24a3879efa4a895c413a31b7966040a7ca274
3
+ metadata.gz: 9ead2c929503c1f54525ff1aad7ae4facddc10010db17b969083e035b809d4e7
4
+ data.tar.gz: 8d0278d9641ac371e4625b9b180864a404df1308ab2c9b3971df39a573b5cf12
5
5
  SHA512:
6
- metadata.gz: f83ef8531ffbaf9f01c407baa8afd93848d9e1a4ff7671e0c656298f76d1e2d71449b30fa78847f8333efdf791cfb55e93e9d7b96eafafb9e27bd3e4e5fe8264
7
- data.tar.gz: 7a9c5493d48d403de25deac639c1055cc36cbd3a6129457bdccd99b220883ac808492b3eb39f5c3029fb04e1b687307ff9a7c0a8b1bbb12bb06fd74731452db8
6
+ metadata.gz: a7b70e81bdc6e6a79a9398fb25acd54004bcf6377df587a4819cb78519681b99071ae6fed2e743da45f658f084277b87c617446a9e3a1c032b03c31e6bb216b2
7
+ data.tar.gz: 5730ddafdeaf7602b27ebffc9ab212248dd14916aa2fed48c2b7f6f51290c1cace828e2e23f5d8029d75499d37c3d059f207bc922bce9f71c22687afad7ca33c
data/README.md CHANGED
@@ -44,6 +44,7 @@ integer :remainder_interval_in_hours, value: 48
44
44
 
45
45
  # Array type strings and integers
46
46
  string_list :admin_emails, description: "Will receive alerts"
47
+ string_list :upload_allowed_extensions, value: ["docx", "pdf", "txt"]
47
48
  integer_list :lucky_numbers, description: "Prime numbers are more effective", value: [2, 3, 5, 11]
48
49
  ```
49
50
 
@@ -89,6 +90,13 @@ System Settings admin panel is precompiled at gem's build time. So it does not r
89
90
 
90
91
  If you would like to store your settings somewhere else than `config/system_settings.rb` you can use ENV variable `SYSTEM_SETTINGS_PATH` to specify custom path.
91
92
 
93
+
94
+ ## Using System Settings in tests
95
+
96
+ Your test suite probably clears database before/after every test example. Fortunately is very easy to load fresh settings from configuration file. It can be done by running `SystemSettings.load`.
97
+ And if you modify settings values in test example you can reset to defaults with `SystemSettings.reset_to_defaults`.
98
+
99
+
92
100
  ## Development
93
101
 
94
102
  Required development dependencies:
@@ -1,3 +1,3 @@
1
1
  module SystemSettings
2
- VERSION = "0.1.0".freeze
2
+ VERSION = "0.2.0".freeze
3
3
  end
@@ -15,6 +15,11 @@ module SystemSettings
15
15
  Setting.find_by!(name: name).value
16
16
  end
17
17
 
18
+ def self.load
19
+ configurator = Configurator.from_file(settings_file_path)
20
+ configurator.persist
21
+ end
22
+
18
23
  def self.reset_to_defaults
19
24
  configurator = Configurator.from_file(settings_file_path)
20
25
  configurator.purge
@@ -2,7 +2,6 @@ namespace :system_settings do
2
2
  desc "Load system settings from SYSTEM_SETTINGS_PATH or config/system_settings.rb file"
3
3
  task :load => [:environment] do
4
4
  configurator = SystemSettings::Configurator.from_file(SystemSettings.settings_file_path)
5
- configurator.purge
6
5
  configurator.persist
7
6
  end
8
7
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: system_settings
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Krists Ozols
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-18 00:00:00.000000000 Z
11
+ date: 2019-05-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails