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 +4 -4
- data/README.md +8 -0
- data/lib/system_settings/version.rb +1 -1
- data/lib/system_settings.rb +5 -0
- data/lib/tasks/system_settings_tasks.rake +0 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9ead2c929503c1f54525ff1aad7ae4facddc10010db17b969083e035b809d4e7
|
4
|
+
data.tar.gz: 8d0278d9641ac371e4625b9b180864a404df1308ab2c9b3971df39a573b5cf12
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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:
|
data/lib/system_settings.rb
CHANGED
@@ -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.
|
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-
|
11
|
+
date: 2019-05-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|