settingson 1.7.6 → 1.7.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/.travis.yml +2 -2
- data/README.md +5 -3
- data/Rakefile +5 -2
- data/app/models/concerns/settingson/base.rb +1 -1
- data/gemfiles/4.2.gemfile +2 -2
- data/gemfiles/4.2.gemfile.lock +58 -60
- data/gemfiles/5.0.gemfile +2 -2
- data/gemfiles/5.0.gemfile.lock +63 -64
- data/lib/settingson.rb +1 -0
- data/lib/settingson/defaults.rb +12 -0
- data/lib/settingson/store.rb +7 -5
- data/lib/settingson/version.rb +1 -1
- data/settingson.gemspec +2 -2
- data/spec/dummy/config/environments/test.rb +7 -2
- data/spec/models/settings_spec.rb +12 -0
- data/spec/spec_helper.rb +3 -3
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e0abff7e29154b68e0008ebc83fb512c6418042
|
4
|
+
data.tar.gz: 3e3318ab67f0b95e0fc8a8dfce9f27f41753e286
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bdc095b96d9ef702464c42ec7f65fba3a8f5a86f9d45870eb4bf1d621f7b8ff4824b4ff83828fd3c6613c4a4d15c83f4a31de23b7ee6935112b7d22a44a1c22b
|
7
|
+
data.tar.gz: 3ce8f5406467feee5fc043ce643d6f47050c848e9af166075eb6559527971183aa69924dcb1f79bbea307960a6cdba806f1d551cf25e0656734afa63a99c8dc2
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
# Settingson
|
7
7
|
|
8
|
-
Simple settings management for applications (Ruby on Rails
|
8
|
+
Simple settings management for applications (Ruby on Rails with ActiveRecord)
|
9
9
|
|
10
10
|
## Installation
|
11
11
|
|
@@ -36,7 +36,10 @@ Replace MODEL by the class name used for the applications settings, it's frequen
|
|
36
36
|
|
37
37
|
Next, you'll usually run
|
38
38
|
```console
|
39
|
+
bin/rails db:migrate
|
40
|
+
# or
|
39
41
|
rake db:migrate
|
42
|
+
# for rails 4 or less
|
40
43
|
```
|
41
44
|
as the generator will have created a migration file (if your ORM supports them).
|
42
45
|
|
@@ -44,8 +47,7 @@ as the generator will have created a migration file (if your ORM supports them).
|
|
44
47
|
|
45
48
|
shell commands:
|
46
49
|
```console
|
47
|
-
rails g settingson Settings
|
48
|
-
rake db:migrate
|
50
|
+
bin/rails g settingson Settings
|
49
51
|
```
|
50
52
|
|
51
53
|
code:
|
data/Rakefile
CHANGED
data/gemfiles/4.2.gemfile
CHANGED
data/gemfiles/4.2.gemfile.lock
CHANGED
@@ -1,66 +1,65 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ../
|
3
3
|
specs:
|
4
|
-
settingson (1.6
|
4
|
+
settingson (1.7.6)
|
5
5
|
rails (>= 4.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
actionmailer (4.2.
|
11
|
-
actionpack (= 4.2.
|
12
|
-
actionview (= 4.2.
|
13
|
-
activejob (= 4.2.
|
10
|
+
actionmailer (4.2.8)
|
11
|
+
actionpack (= 4.2.8)
|
12
|
+
actionview (= 4.2.8)
|
13
|
+
activejob (= 4.2.8)
|
14
14
|
mail (~> 2.5, >= 2.5.4)
|
15
15
|
rails-dom-testing (~> 1.0, >= 1.0.5)
|
16
|
-
actionpack (4.2.
|
17
|
-
actionview (= 4.2.
|
18
|
-
activesupport (= 4.2.
|
16
|
+
actionpack (4.2.8)
|
17
|
+
actionview (= 4.2.8)
|
18
|
+
activesupport (= 4.2.8)
|
19
19
|
rack (~> 1.6)
|
20
20
|
rack-test (~> 0.6.2)
|
21
21
|
rails-dom-testing (~> 1.0, >= 1.0.5)
|
22
22
|
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
23
|
-
actionview (4.2.
|
24
|
-
activesupport (= 4.2.
|
23
|
+
actionview (4.2.8)
|
24
|
+
activesupport (= 4.2.8)
|
25
25
|
builder (~> 3.1)
|
26
26
|
erubis (~> 2.7.0)
|
27
27
|
rails-dom-testing (~> 1.0, >= 1.0.5)
|
28
|
-
rails-html-sanitizer (~> 1.0, >= 1.0.
|
29
|
-
activejob (4.2.
|
30
|
-
activesupport (= 4.2.
|
28
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
29
|
+
activejob (4.2.8)
|
30
|
+
activesupport (= 4.2.8)
|
31
31
|
globalid (>= 0.3.0)
|
32
|
-
activemodel (4.2.
|
33
|
-
activesupport (= 4.2.
|
32
|
+
activemodel (4.2.8)
|
33
|
+
activesupport (= 4.2.8)
|
34
34
|
builder (~> 3.1)
|
35
|
-
activerecord (4.2.
|
36
|
-
activemodel (= 4.2.
|
37
|
-
activesupport (= 4.2.
|
35
|
+
activerecord (4.2.8)
|
36
|
+
activemodel (= 4.2.8)
|
37
|
+
activesupport (= 4.2.8)
|
38
38
|
arel (~> 6.0)
|
39
|
-
activesupport (4.2.
|
39
|
+
activesupport (4.2.8)
|
40
40
|
i18n (~> 0.7)
|
41
|
-
json (~> 1.7, >= 1.7.7)
|
42
41
|
minitest (~> 5.1)
|
43
42
|
thread_safe (~> 0.3, >= 0.3.4)
|
44
43
|
tzinfo (~> 1.1)
|
45
|
-
appraisal (2.
|
44
|
+
appraisal (2.2.0)
|
46
45
|
bundler
|
47
46
|
rake
|
48
47
|
thor (>= 0.14.0)
|
49
|
-
arel (6.0.
|
50
|
-
builder (3.2.
|
51
|
-
codeclimate-test-reporter (0.
|
52
|
-
simplecov (
|
53
|
-
concurrent-ruby (1.0.
|
48
|
+
arel (6.0.4)
|
49
|
+
builder (3.2.3)
|
50
|
+
codeclimate-test-reporter (1.0.8)
|
51
|
+
simplecov (<= 0.13)
|
52
|
+
concurrent-ruby (1.0.5)
|
54
53
|
database_cleaner (1.5.3)
|
55
|
-
diff-lcs (1.
|
54
|
+
diff-lcs (1.3)
|
56
55
|
docile (1.1.5)
|
57
56
|
erubis (2.7.0)
|
58
|
-
faker (1.
|
57
|
+
faker (1.7.3)
|
59
58
|
i18n (~> 0.5)
|
60
|
-
globalid (0.
|
61
|
-
activesupport (>= 4.
|
62
|
-
i18n (0.
|
63
|
-
json (1.
|
59
|
+
globalid (0.4.0)
|
60
|
+
activesupport (>= 4.2.0)
|
61
|
+
i18n (0.8.1)
|
62
|
+
json (2.1.0)
|
64
63
|
loofah (2.0.3)
|
65
64
|
nokogiri (>= 1.5.9)
|
66
65
|
mail (2.6.4)
|
@@ -69,46 +68,44 @@ GEM
|
|
69
68
|
mime-types-data (~> 3.2015)
|
70
69
|
mime-types-data (3.2016.0521)
|
71
70
|
mini_portile2 (2.1.0)
|
72
|
-
minitest (5.
|
73
|
-
nokogiri (1.
|
71
|
+
minitest (5.10.1)
|
72
|
+
nokogiri (1.7.1)
|
74
73
|
mini_portile2 (~> 2.1.0)
|
75
|
-
|
76
|
-
pkg-config (1.1.7)
|
77
|
-
rack (1.6.4)
|
74
|
+
rack (1.6.5)
|
78
75
|
rack-test (0.6.3)
|
79
76
|
rack (>= 1.0)
|
80
|
-
rails (4.2.
|
81
|
-
actionmailer (= 4.2.
|
82
|
-
actionpack (= 4.2.
|
83
|
-
actionview (= 4.2.
|
84
|
-
activejob (= 4.2.
|
85
|
-
activemodel (= 4.2.
|
86
|
-
activerecord (= 4.2.
|
87
|
-
activesupport (= 4.2.
|
77
|
+
rails (4.2.8)
|
78
|
+
actionmailer (= 4.2.8)
|
79
|
+
actionpack (= 4.2.8)
|
80
|
+
actionview (= 4.2.8)
|
81
|
+
activejob (= 4.2.8)
|
82
|
+
activemodel (= 4.2.8)
|
83
|
+
activerecord (= 4.2.8)
|
84
|
+
activesupport (= 4.2.8)
|
88
85
|
bundler (>= 1.3.0, < 2.0)
|
89
|
-
railties (= 4.2.
|
86
|
+
railties (= 4.2.8)
|
90
87
|
sprockets-rails
|
91
88
|
rails-deprecated_sanitizer (1.0.3)
|
92
89
|
activesupport (>= 4.2.0.alpha)
|
93
|
-
rails-dom-testing (1.0.
|
90
|
+
rails-dom-testing (1.0.8)
|
94
91
|
activesupport (>= 4.2.0.beta, < 5.0)
|
95
|
-
nokogiri (~> 1.6
|
92
|
+
nokogiri (~> 1.6)
|
96
93
|
rails-deprecated_sanitizer (>= 1.0.1)
|
97
94
|
rails-dummy (0.0.4)
|
98
95
|
rails
|
99
96
|
rails-html-sanitizer (1.0.3)
|
100
97
|
loofah (~> 2.0)
|
101
|
-
railties (4.2.
|
102
|
-
actionpack (= 4.2.
|
103
|
-
activesupport (= 4.2.
|
98
|
+
railties (4.2.8)
|
99
|
+
actionpack (= 4.2.8)
|
100
|
+
activesupport (= 4.2.8)
|
104
101
|
rake (>= 0.8.7)
|
105
102
|
thor (>= 0.18.1, < 2.0)
|
106
|
-
rake (
|
103
|
+
rake (12.0.0)
|
107
104
|
rspec (3.5.0)
|
108
105
|
rspec-core (~> 3.5.0)
|
109
106
|
rspec-expectations (~> 3.5.0)
|
110
107
|
rspec-mocks (~> 3.5.0)
|
111
|
-
rspec-core (3.5.
|
108
|
+
rspec-core (3.5.4)
|
112
109
|
rspec-support (~> 3.5.0)
|
113
110
|
rspec-expectations (3.5.0)
|
114
111
|
diff-lcs (>= 1.2.0, < 2.0)
|
@@ -125,25 +122,26 @@ GEM
|
|
125
122
|
rspec-mocks (~> 3.5.0)
|
126
123
|
rspec-support (~> 3.5.0)
|
127
124
|
rspec-support (3.5.0)
|
128
|
-
simplecov (0.
|
125
|
+
simplecov (0.13.0)
|
129
126
|
docile (~> 1.1.0)
|
130
127
|
json (>= 1.8, < 3)
|
131
128
|
simplecov-html (~> 0.10.0)
|
132
129
|
simplecov-html (0.10.0)
|
133
|
-
spring (
|
130
|
+
spring (2.0.1)
|
131
|
+
activesupport (>= 4.2)
|
134
132
|
spring-commands-rspec (1.0.4)
|
135
133
|
spring (>= 0.9.1)
|
136
|
-
sprockets (3.7.
|
134
|
+
sprockets (3.7.1)
|
137
135
|
concurrent-ruby (~> 1.0)
|
138
136
|
rack (> 1, < 3)
|
139
137
|
sprockets-rails (3.2.0)
|
140
138
|
actionpack (>= 4.0)
|
141
139
|
activesupport (>= 4.0)
|
142
140
|
sprockets (>= 3.0.0)
|
143
|
-
sqlite3 (1.3.
|
144
|
-
thor (0.19.
|
145
|
-
thread_safe (0.3.
|
146
|
-
tzinfo (1.2.
|
141
|
+
sqlite3 (1.3.13)
|
142
|
+
thor (0.19.4)
|
143
|
+
thread_safe (0.3.6)
|
144
|
+
tzinfo (1.2.3)
|
147
145
|
thread_safe (~> 0.1)
|
148
146
|
|
149
147
|
PLATFORMS
|
data/gemfiles/5.0.gemfile
CHANGED
data/gemfiles/5.0.gemfile.lock
CHANGED
@@ -1,68 +1,68 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ../
|
3
3
|
specs:
|
4
|
-
settingson (1.6
|
4
|
+
settingson (1.7.6)
|
5
5
|
rails (>= 4.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
actioncable (5.0.
|
11
|
-
actionpack (= 5.0.
|
12
|
-
nio4r (
|
10
|
+
actioncable (5.0.2)
|
11
|
+
actionpack (= 5.0.2)
|
12
|
+
nio4r (>= 1.2, < 3.0)
|
13
13
|
websocket-driver (~> 0.6.1)
|
14
|
-
actionmailer (5.0.
|
15
|
-
actionpack (= 5.0.
|
16
|
-
actionview (= 5.0.
|
17
|
-
activejob (= 5.0.
|
14
|
+
actionmailer (5.0.2)
|
15
|
+
actionpack (= 5.0.2)
|
16
|
+
actionview (= 5.0.2)
|
17
|
+
activejob (= 5.0.2)
|
18
18
|
mail (~> 2.5, >= 2.5.4)
|
19
19
|
rails-dom-testing (~> 2.0)
|
20
|
-
actionpack (5.0.
|
21
|
-
actionview (= 5.0.
|
22
|
-
activesupport (= 5.0.
|
20
|
+
actionpack (5.0.2)
|
21
|
+
actionview (= 5.0.2)
|
22
|
+
activesupport (= 5.0.2)
|
23
23
|
rack (~> 2.0)
|
24
24
|
rack-test (~> 0.6.3)
|
25
25
|
rails-dom-testing (~> 2.0)
|
26
26
|
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
27
|
-
actionview (5.0.
|
28
|
-
activesupport (= 5.0.
|
27
|
+
actionview (5.0.2)
|
28
|
+
activesupport (= 5.0.2)
|
29
29
|
builder (~> 3.1)
|
30
30
|
erubis (~> 2.7.0)
|
31
31
|
rails-dom-testing (~> 2.0)
|
32
|
-
rails-html-sanitizer (~> 1.0, >= 1.0.
|
33
|
-
activejob (5.0.
|
34
|
-
activesupport (= 5.0.
|
32
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
33
|
+
activejob (5.0.2)
|
34
|
+
activesupport (= 5.0.2)
|
35
35
|
globalid (>= 0.3.6)
|
36
|
-
activemodel (5.0.
|
37
|
-
activesupport (= 5.0.
|
38
|
-
activerecord (5.0.
|
39
|
-
activemodel (= 5.0.
|
40
|
-
activesupport (= 5.0.
|
36
|
+
activemodel (5.0.2)
|
37
|
+
activesupport (= 5.0.2)
|
38
|
+
activerecord (5.0.2)
|
39
|
+
activemodel (= 5.0.2)
|
40
|
+
activesupport (= 5.0.2)
|
41
41
|
arel (~> 7.0)
|
42
|
-
activesupport (5.0.
|
42
|
+
activesupport (5.0.2)
|
43
43
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
44
44
|
i18n (~> 0.7)
|
45
45
|
minitest (~> 5.1)
|
46
46
|
tzinfo (~> 1.1)
|
47
|
-
appraisal (2.
|
47
|
+
appraisal (2.2.0)
|
48
48
|
bundler
|
49
49
|
rake
|
50
50
|
thor (>= 0.14.0)
|
51
|
-
arel (7.1.
|
52
|
-
builder (3.2.
|
53
|
-
codeclimate-test-reporter (0.
|
54
|
-
simplecov (
|
55
|
-
concurrent-ruby (1.0.
|
51
|
+
arel (7.1.4)
|
52
|
+
builder (3.2.3)
|
53
|
+
codeclimate-test-reporter (1.0.8)
|
54
|
+
simplecov (<= 0.13)
|
55
|
+
concurrent-ruby (1.0.5)
|
56
56
|
database_cleaner (1.5.3)
|
57
|
-
diff-lcs (1.
|
57
|
+
diff-lcs (1.3)
|
58
58
|
docile (1.1.5)
|
59
59
|
erubis (2.7.0)
|
60
|
-
faker (1.
|
60
|
+
faker (1.7.3)
|
61
61
|
i18n (~> 0.5)
|
62
|
-
globalid (0.
|
63
|
-
activesupport (>= 4.
|
64
|
-
i18n (0.
|
65
|
-
json (2.0
|
62
|
+
globalid (0.4.0)
|
63
|
+
activesupport (>= 4.2.0)
|
64
|
+
i18n (0.8.1)
|
65
|
+
json (2.1.0)
|
66
66
|
loofah (2.0.3)
|
67
67
|
nokogiri (>= 1.5.9)
|
68
68
|
mail (2.6.4)
|
@@ -72,46 +72,44 @@ GEM
|
|
72
72
|
mime-types-data (~> 3.2015)
|
73
73
|
mime-types-data (3.2016.0521)
|
74
74
|
mini_portile2 (2.1.0)
|
75
|
-
minitest (5.
|
76
|
-
nio4r (
|
77
|
-
nokogiri (1.
|
75
|
+
minitest (5.10.1)
|
76
|
+
nio4r (2.0.0)
|
77
|
+
nokogiri (1.7.1)
|
78
78
|
mini_portile2 (~> 2.1.0)
|
79
|
-
pkg-config (~> 1.1.7)
|
80
|
-
pkg-config (1.1.7)
|
81
79
|
rack (2.0.1)
|
82
80
|
rack-test (0.6.3)
|
83
81
|
rack (>= 1.0)
|
84
|
-
rails (5.0.
|
85
|
-
actioncable (= 5.0.
|
86
|
-
actionmailer (= 5.0.
|
87
|
-
actionpack (= 5.0.
|
88
|
-
actionview (= 5.0.
|
89
|
-
activejob (= 5.0.
|
90
|
-
activemodel (= 5.0.
|
91
|
-
activerecord (= 5.0.
|
92
|
-
activesupport (= 5.0.
|
82
|
+
rails (5.0.2)
|
83
|
+
actioncable (= 5.0.2)
|
84
|
+
actionmailer (= 5.0.2)
|
85
|
+
actionpack (= 5.0.2)
|
86
|
+
actionview (= 5.0.2)
|
87
|
+
activejob (= 5.0.2)
|
88
|
+
activemodel (= 5.0.2)
|
89
|
+
activerecord (= 5.0.2)
|
90
|
+
activesupport (= 5.0.2)
|
93
91
|
bundler (>= 1.3.0, < 2.0)
|
94
|
-
railties (= 5.0.
|
92
|
+
railties (= 5.0.2)
|
95
93
|
sprockets-rails (>= 2.0.0)
|
96
|
-
rails-dom-testing (2.0.
|
94
|
+
rails-dom-testing (2.0.2)
|
97
95
|
activesupport (>= 4.2.0, < 6.0)
|
98
|
-
nokogiri (~> 1.6
|
96
|
+
nokogiri (~> 1.6)
|
99
97
|
rails-dummy (0.0.4)
|
100
98
|
rails
|
101
99
|
rails-html-sanitizer (1.0.3)
|
102
100
|
loofah (~> 2.0)
|
103
|
-
railties (5.0.
|
104
|
-
actionpack (= 5.0.
|
105
|
-
activesupport (= 5.0.
|
101
|
+
railties (5.0.2)
|
102
|
+
actionpack (= 5.0.2)
|
103
|
+
activesupport (= 5.0.2)
|
106
104
|
method_source
|
107
105
|
rake (>= 0.8.7)
|
108
106
|
thor (>= 0.18.1, < 2.0)
|
109
|
-
rake (
|
107
|
+
rake (12.0.0)
|
110
108
|
rspec (3.5.0)
|
111
109
|
rspec-core (~> 3.5.0)
|
112
110
|
rspec-expectations (~> 3.5.0)
|
113
111
|
rspec-mocks (~> 3.5.0)
|
114
|
-
rspec-core (3.5.
|
112
|
+
rspec-core (3.5.4)
|
115
113
|
rspec-support (~> 3.5.0)
|
116
114
|
rspec-expectations (3.5.0)
|
117
115
|
diff-lcs (>= 1.2.0, < 2.0)
|
@@ -128,27 +126,28 @@ GEM
|
|
128
126
|
rspec-mocks (~> 3.5.0)
|
129
127
|
rspec-support (~> 3.5.0)
|
130
128
|
rspec-support (3.5.0)
|
131
|
-
simplecov (0.
|
129
|
+
simplecov (0.13.0)
|
132
130
|
docile (~> 1.1.0)
|
133
131
|
json (>= 1.8, < 3)
|
134
132
|
simplecov-html (~> 0.10.0)
|
135
133
|
simplecov-html (0.10.0)
|
136
|
-
spring (
|
134
|
+
spring (2.0.1)
|
135
|
+
activesupport (>= 4.2)
|
137
136
|
spring-commands-rspec (1.0.4)
|
138
137
|
spring (>= 0.9.1)
|
139
|
-
sprockets (3.7.
|
138
|
+
sprockets (3.7.1)
|
140
139
|
concurrent-ruby (~> 1.0)
|
141
140
|
rack (> 1, < 3)
|
142
141
|
sprockets-rails (3.2.0)
|
143
142
|
actionpack (>= 4.0)
|
144
143
|
activesupport (>= 4.0)
|
145
144
|
sprockets (>= 3.0.0)
|
146
|
-
sqlite3 (1.3.
|
147
|
-
thor (0.19.
|
148
|
-
thread_safe (0.3.
|
149
|
-
tzinfo (1.2.
|
145
|
+
sqlite3 (1.3.13)
|
146
|
+
thor (0.19.4)
|
147
|
+
thread_safe (0.3.6)
|
148
|
+
tzinfo (1.2.3)
|
150
149
|
thread_safe (~> 0.1)
|
151
|
-
websocket-driver (0.6.
|
150
|
+
websocket-driver (0.6.5)
|
152
151
|
websocket-extensions (>= 0.1.0)
|
153
152
|
websocket-extensions (0.1.2)
|
154
153
|
|
data/lib/settingson.rb
CHANGED
@@ -0,0 +1,12 @@
|
|
1
|
+
class Settingson::Defaults
|
2
|
+
def initialize(klass:)
|
3
|
+
@__klass = klass
|
4
|
+
@__path = '__defaults'
|
5
|
+
end # initialize
|
6
|
+
|
7
|
+
def method_missing(symbol, *args)
|
8
|
+
Settingson::Store.new(
|
9
|
+
klass: @__klass, path: @__path, defaults: true
|
10
|
+
).send(symbol, *args)
|
11
|
+
end # method_missing
|
12
|
+
end
|
data/lib/settingson/store.rb
CHANGED
@@ -3,9 +3,10 @@ class Settingson::Store
|
|
3
3
|
# extend ActiveModel::Naming
|
4
4
|
# include ActiveModel::Conversion
|
5
5
|
#
|
6
|
-
def initialize(klass:, path: nil)
|
7
|
-
@__klass
|
8
|
-
@__path
|
6
|
+
def initialize(klass:, path: nil, defaults: false)
|
7
|
+
@__klass = klass
|
8
|
+
@__path = path
|
9
|
+
@__defaults = defaults
|
9
10
|
end
|
10
11
|
|
11
12
|
def to_s
|
@@ -44,11 +45,12 @@ class Settingson::Store
|
|
44
45
|
protected
|
45
46
|
# TODO: move all methods to support class
|
46
47
|
def __debug(message="")
|
48
|
+
return unless @__klass.configure.debug
|
47
49
|
message = sprintf("%s#%20s: %s",
|
48
50
|
self.class.name,
|
49
51
|
caller_locations.first.label,
|
50
52
|
message)
|
51
|
-
Rails.logger.debug(message)
|
53
|
+
Rails.logger.debug(message)
|
52
54
|
end
|
53
55
|
|
54
56
|
def __references_action(symbol, *args)
|
@@ -153,7 +155,7 @@ class Settingson::Store
|
|
153
155
|
def __cached_or_default_value(key)
|
154
156
|
result = __cached_value(key)
|
155
157
|
|
156
|
-
if result.is_a?(ActiveRecord::RecordNotFound)
|
158
|
+
if ! @__defaults and result.is_a?(ActiveRecord::RecordNotFound)
|
157
159
|
__cached_value('__defaults.' + key)
|
158
160
|
else
|
159
161
|
result
|
data/lib/settingson/version.rb
CHANGED
data/settingson.gemspec
CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.version = Settingson::VERSION
|
9
9
|
spec.authors = ["dan"]
|
10
10
|
spec.email = ["daan.forever@gmail.com"]
|
11
|
-
spec.summary = %q{Settings management for Ruby on Rails
|
12
|
-
spec.description = %q{Settings management for Ruby on Rails
|
11
|
+
spec.summary = %q{Settings management for Ruby on Rails applications (with ActiveRecord) }
|
12
|
+
spec.description = %q{Settings management for Ruby on Rails applications (with ActiveRecord) }
|
13
13
|
spec.homepage = "https://github.com/daanforever/settingson"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
@@ -13,8 +13,13 @@ Rails.application.configure do
|
|
13
13
|
config.eager_load = false
|
14
14
|
|
15
15
|
# Configure static asset server for tests with Cache-Control for performance.
|
16
|
-
|
17
|
-
|
16
|
+
if Rails::VERSION::MAJOR < 5
|
17
|
+
config.serve_static_files = true
|
18
|
+
config.static_cache_control = 'public, max-age=3600'
|
19
|
+
else
|
20
|
+
config.public_file_server.enabled = true
|
21
|
+
config.public_file_server.headers = { 'Cache-Control' => 'public, max-age=3600' }
|
22
|
+
end
|
18
23
|
|
19
24
|
# Show full error reports and disable caching.
|
20
25
|
config.consider_all_requests_local = true
|
@@ -18,6 +18,18 @@ describe Settings do
|
|
18
18
|
Settings.defaults{|s| s.some.key = word}
|
19
19
|
expect( Settings.some.key ).to eq(word)
|
20
20
|
end
|
21
|
+
|
22
|
+
it 'save and returns correct value for multiple default values' do
|
23
|
+
word1 = Faker::Lorem.word
|
24
|
+
word2 = Faker::Lorem.word
|
25
|
+
Settings.defaults do |s|
|
26
|
+
s.some.key1 = word1
|
27
|
+
s.some.key2 = word2
|
28
|
+
end
|
29
|
+
expect( Settings.some.key1 ).to eq(word1)
|
30
|
+
expect( Settings.some.key2 ).to eq(word2)
|
31
|
+
end
|
32
|
+
|
21
33
|
end
|
22
34
|
|
23
35
|
describe '::from_hash' do
|
data/spec/spec_helper.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
ENV["RAILS_ENV"] ||= 'test'
|
2
2
|
|
3
|
-
require
|
4
|
-
|
3
|
+
require 'simplecov'
|
4
|
+
SimpleCov.start
|
5
5
|
|
6
6
|
require ::File.expand_path('../dummy/config/environment', __FILE__)
|
7
7
|
require 'rspec/rails'
|
@@ -35,7 +35,7 @@ RSpec.configure do |config|
|
|
35
35
|
config.before(:suite) do
|
36
36
|
begin
|
37
37
|
DatabaseCleaner.strategy = :transaction
|
38
|
-
DatabaseCleaner.clean_with(:
|
38
|
+
DatabaseCleaner.clean_with(:transaction)
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: settingson
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.7.
|
4
|
+
version: 1.7.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- dan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-10-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -150,7 +150,7 @@ dependencies:
|
|
150
150
|
- - ">="
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '0'
|
153
|
-
description: 'Settings management for Ruby on Rails
|
153
|
+
description: 'Settings management for Ruby on Rails applications (with ActiveRecord) '
|
154
154
|
email:
|
155
155
|
- daan.forever@gmail.com
|
156
156
|
executables: []
|
@@ -177,6 +177,7 @@ files:
|
|
177
177
|
- lib/generators/settingson/templates/migrations/rename_name_to_key_on_settings.rb
|
178
178
|
- lib/settingson.rb
|
179
179
|
- lib/settingson/config.rb
|
180
|
+
- lib/settingson/defaults.rb
|
180
181
|
- lib/settingson/engine.rb
|
181
182
|
- lib/settingson/store.rb
|
182
183
|
- lib/settingson/utils.rb
|
@@ -252,10 +253,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
252
253
|
version: '0'
|
253
254
|
requirements: []
|
254
255
|
rubyforge_project:
|
255
|
-
rubygems_version: 2.6.
|
256
|
+
rubygems_version: 2.6.14
|
256
257
|
signing_key:
|
257
258
|
specification_version: 4
|
258
|
-
summary: Settings management for Ruby on Rails
|
259
|
+
summary: Settings management for Ruby on Rails applications (with ActiveRecord)
|
259
260
|
test_files:
|
260
261
|
- spec/dummy/README.rdoc
|
261
262
|
- spec/dummy/Rakefile
|