rails_admin_settings 1.4.1 → 1.7.0
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 +4 -4
- data/.gitignore +1 -0
- data/.rakeTasks +7 -0
- data/.ruby-version +1 -0
- data/.travis.yml +2 -0
- data/CHANGELOG.md +8 -0
- data/Gemfile.lock +218 -138
- data/README.md +5 -1
- data/app/models/rails_admin_settings/setting.rb +0 -1
- data/app/views/rails_admin/main/_setting_value.html.haml +1 -2
- data/lib/generators/rails_admin_settings/templates/migration.rb +3 -0
- data/lib/rails_admin_settings/determine_mime_type.rb +193 -0
- data/lib/rails_admin_settings/kinds.rb +1 -0
- data/lib/rails_admin_settings/processing.rb +14 -5
- data/lib/rails_admin_settings/rails_admin_config.rb +12 -5
- data/lib/rails_admin_settings/settings.rb +2 -0
- data/lib/rails_admin_settings/storage/shrine_uploader.rb +14 -0
- data/lib/rails_admin_settings/uploads.rb +11 -0
- data/lib/rails_admin_settings/validation.rb +2 -1
- data/lib/rails_admin_settings/version.rb +1 -1
- data/rails_admin_settings.gemspec +7 -3
- data/spec/factories/setting.rb +1 -1
- data/spec/shrine_spec.rb +34 -0
- data/spec/spec_helper.rb +16 -2
- data/spec/support/1024x768.gif +0 -0
- data/spec/types_spec.rb +7 -0
- metadata +72 -11
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5f1f9843ee528e7a9264626370073c5d5300c830fec7f1fd5098cce75e7982d6
|
|
4
|
+
data.tar.gz: 3b260282a0c0d4504d88123287111b45774eab05ca84352b8539af271b00268d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: dc1a6ec975b5f6e802dafe7345bd9753478d3cddcd4e25a93b9501482304db19a8e59bc681c30ffaf0d30d1415493f9af5db7643a3e3e4b3160ded5ba79782be
|
|
7
|
+
data.tar.gz: 7061025abfd54dcbf409e7215d171474f7e1f5068eea1ce704b80038f58a4f4e5dc0252211efbe74816858a95e7bf94f9dbe20c9812946fa508ef98c8613a85b
|
data/.gitignore
CHANGED
data/.rakeTasks
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<Settings><!--This file was automatically generated by Ruby plugin.
|
|
3
|
+
You are allowed to:
|
|
4
|
+
1. Remove rake task
|
|
5
|
+
2. Add existing rake tasks
|
|
6
|
+
To add existing rake tasks automatically delete this file and reload the project.
|
|
7
|
+
--><RakeGroup description="" fullCmd="" taksId="rake" /></Settings>
|
data/.ruby-version
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
2.7.2
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,193 +1,269 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
rails_admin_settings (1.
|
|
4
|
+
rails_admin_settings (1.7.0)
|
|
5
5
|
|
|
6
6
|
GEM
|
|
7
7
|
remote: https://rubygems.org/
|
|
8
8
|
specs:
|
|
9
|
-
actioncable (
|
|
10
|
-
actionpack (=
|
|
9
|
+
actioncable (6.1.3.1)
|
|
10
|
+
actionpack (= 6.1.3.1)
|
|
11
|
+
activesupport (= 6.1.3.1)
|
|
11
12
|
nio4r (~> 2.0)
|
|
12
|
-
websocket-driver (
|
|
13
|
-
|
|
14
|
-
actionpack (=
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
websocket-driver (>= 0.6.1)
|
|
14
|
+
actionmailbox (6.1.3.1)
|
|
15
|
+
actionpack (= 6.1.3.1)
|
|
16
|
+
activejob (= 6.1.3.1)
|
|
17
|
+
activerecord (= 6.1.3.1)
|
|
18
|
+
activestorage (= 6.1.3.1)
|
|
19
|
+
activesupport (= 6.1.3.1)
|
|
20
|
+
mail (>= 2.7.1)
|
|
21
|
+
actionmailer (6.1.3.1)
|
|
22
|
+
actionpack (= 6.1.3.1)
|
|
23
|
+
actionview (= 6.1.3.1)
|
|
24
|
+
activejob (= 6.1.3.1)
|
|
25
|
+
activesupport (= 6.1.3.1)
|
|
17
26
|
mail (~> 2.5, >= 2.5.4)
|
|
18
27
|
rails-dom-testing (~> 2.0)
|
|
19
|
-
actionpack (
|
|
20
|
-
actionview (=
|
|
21
|
-
activesupport (=
|
|
22
|
-
rack (~> 2.0)
|
|
28
|
+
actionpack (6.1.3.1)
|
|
29
|
+
actionview (= 6.1.3.1)
|
|
30
|
+
activesupport (= 6.1.3.1)
|
|
31
|
+
rack (~> 2.0, >= 2.0.9)
|
|
23
32
|
rack-test (>= 0.6.3)
|
|
24
33
|
rails-dom-testing (~> 2.0)
|
|
25
|
-
rails-html-sanitizer (~> 1.0, >= 1.0
|
|
26
|
-
|
|
27
|
-
|
|
34
|
+
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
|
35
|
+
actiontext (6.1.3.1)
|
|
36
|
+
actionpack (= 6.1.3.1)
|
|
37
|
+
activerecord (= 6.1.3.1)
|
|
38
|
+
activestorage (= 6.1.3.1)
|
|
39
|
+
activesupport (= 6.1.3.1)
|
|
40
|
+
nokogiri (>= 1.8.5)
|
|
41
|
+
actionview (6.1.3.1)
|
|
42
|
+
activesupport (= 6.1.3.1)
|
|
28
43
|
builder (~> 3.1)
|
|
29
44
|
erubi (~> 1.4)
|
|
30
45
|
rails-dom-testing (~> 2.0)
|
|
31
|
-
rails-html-sanitizer (~> 1.
|
|
32
|
-
activejob (
|
|
33
|
-
activesupport (=
|
|
46
|
+
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
|
47
|
+
activejob (6.1.3.1)
|
|
48
|
+
activesupport (= 6.1.3.1)
|
|
34
49
|
globalid (>= 0.3.6)
|
|
35
|
-
activemodel (
|
|
36
|
-
activesupport (=
|
|
37
|
-
activerecord (
|
|
38
|
-
activemodel (=
|
|
39
|
-
activesupport (=
|
|
40
|
-
|
|
41
|
-
|
|
50
|
+
activemodel (6.1.3.1)
|
|
51
|
+
activesupport (= 6.1.3.1)
|
|
52
|
+
activerecord (6.1.3.1)
|
|
53
|
+
activemodel (= 6.1.3.1)
|
|
54
|
+
activesupport (= 6.1.3.1)
|
|
55
|
+
activestorage (6.1.3.1)
|
|
56
|
+
actionpack (= 6.1.3.1)
|
|
57
|
+
activejob (= 6.1.3.1)
|
|
58
|
+
activerecord (= 6.1.3.1)
|
|
59
|
+
activesupport (= 6.1.3.1)
|
|
60
|
+
marcel (~> 1.0.0)
|
|
61
|
+
mini_mime (~> 1.0.2)
|
|
62
|
+
activesupport (6.1.3.1)
|
|
42
63
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
43
|
-
i18n (
|
|
44
|
-
minitest (
|
|
45
|
-
tzinfo (~>
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
64
|
+
i18n (>= 1.6, < 2)
|
|
65
|
+
minitest (>= 5.1)
|
|
66
|
+
tzinfo (~> 2.0)
|
|
67
|
+
zeitwerk (~> 2.3)
|
|
68
|
+
addressable (2.7.0)
|
|
69
|
+
public_suffix (>= 2.0.2, < 5.0)
|
|
70
|
+
ast (2.4.2)
|
|
71
|
+
bson (4.12.0)
|
|
72
|
+
builder (3.2.4)
|
|
73
|
+
carrierwave (2.2.1)
|
|
74
|
+
activemodel (>= 5.0.0)
|
|
75
|
+
activesupport (>= 5.0.0)
|
|
76
|
+
addressable (~> 2.6)
|
|
77
|
+
image_processing (~> 1.1)
|
|
78
|
+
marcel (~> 1.0.0)
|
|
79
|
+
mini_mime (>= 0.1.3)
|
|
80
|
+
ssrf_filter (~> 1.0)
|
|
81
|
+
carrierwave-mongoid (1.3.0)
|
|
82
|
+
carrierwave (>= 0.8, < 3)
|
|
83
|
+
mongoid (>= 3.0, < 8.0)
|
|
58
84
|
mongoid-grid_fs (>= 1.3, < 3.0)
|
|
59
85
|
climate_control (0.2.0)
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
database_cleaner (
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
86
|
+
concurrent-ruby (1.1.8)
|
|
87
|
+
content_disposition (1.0.0)
|
|
88
|
+
crass (1.0.6)
|
|
89
|
+
database_cleaner (2.0.1)
|
|
90
|
+
database_cleaner-active_record (~> 2.0.0)
|
|
91
|
+
database_cleaner-active_record (2.0.0)
|
|
92
|
+
activerecord (>= 5.a)
|
|
93
|
+
database_cleaner-core (~> 2.0.0)
|
|
94
|
+
database_cleaner-core (2.0.1)
|
|
95
|
+
diff-lcs (1.4.4)
|
|
96
|
+
docile (1.3.5)
|
|
97
|
+
down (5.2.0)
|
|
98
|
+
addressable (~> 2.5)
|
|
99
|
+
erubi (1.10.0)
|
|
100
|
+
factory_bot (6.1.0)
|
|
101
|
+
activesupport (>= 5.0.0)
|
|
102
|
+
ffi (1.15.0)
|
|
103
|
+
geocoder (1.6.6)
|
|
104
|
+
globalid (0.4.2)
|
|
73
105
|
activesupport (>= 4.2.0)
|
|
74
|
-
i18n (
|
|
106
|
+
i18n (1.8.10)
|
|
75
107
|
concurrent-ruby (~> 1.0)
|
|
76
|
-
|
|
77
|
-
|
|
108
|
+
image_processing (1.12.1)
|
|
109
|
+
mini_magick (>= 4.9.5, < 5)
|
|
110
|
+
ruby-vips (>= 2.0.17, < 3)
|
|
111
|
+
loofah (2.9.1)
|
|
78
112
|
crass (~> 1.0.2)
|
|
79
113
|
nokogiri (>= 1.5.9)
|
|
80
|
-
mail (2.7.
|
|
114
|
+
mail (2.7.1)
|
|
81
115
|
mini_mime (>= 0.1.1)
|
|
82
|
-
|
|
83
|
-
|
|
116
|
+
marcel (1.0.1)
|
|
117
|
+
method_source (1.0.0)
|
|
118
|
+
mime-types (3.3.1)
|
|
84
119
|
mime-types-data (~> 3.2015)
|
|
85
|
-
mime-types-data (3.
|
|
86
|
-
mimemagic (0.3.
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
120
|
+
mime-types-data (3.2021.0225)
|
|
121
|
+
mimemagic (0.3.10)
|
|
122
|
+
nokogiri (~> 1)
|
|
123
|
+
rake
|
|
124
|
+
mini_magick (4.11.0)
|
|
125
|
+
mini_mime (1.0.3)
|
|
126
|
+
mini_portile2 (2.5.0)
|
|
127
|
+
minitest (5.14.4)
|
|
128
|
+
mongo (2.14.0)
|
|
129
|
+
bson (>= 4.8.2, < 5.0.0)
|
|
130
|
+
mongoid (7.2.2)
|
|
131
|
+
activemodel (>= 5.1, < 6.2)
|
|
132
|
+
mongo (>= 2.10.5, < 3.0.0)
|
|
95
133
|
mongoid-compatibility (0.5.1)
|
|
96
134
|
activesupport
|
|
97
135
|
mongoid (>= 2.0)
|
|
98
|
-
mongoid-grid_fs (2.
|
|
136
|
+
mongoid-grid_fs (2.4.0)
|
|
99
137
|
mime-types (>= 1.0, < 4.0)
|
|
100
|
-
mongoid (>= 3.0, <
|
|
138
|
+
mongoid (>= 3.0, < 8.0)
|
|
101
139
|
mongoid-paperclip (0.0.11)
|
|
102
140
|
mongoid
|
|
103
141
|
paperclip (>= 2.3.6, != 4.3.0)
|
|
104
|
-
mongoid-rspec (4.
|
|
142
|
+
mongoid-rspec (4.1.0)
|
|
105
143
|
activesupport (>= 3.0.0)
|
|
106
|
-
mongoid (>=
|
|
107
|
-
mongoid-compatibility
|
|
108
|
-
rspec (~> 3.3)
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
144
|
+
mongoid (>= 3.1)
|
|
145
|
+
mongoid-compatibility (>= 0.5.1)
|
|
146
|
+
rspec-core (~> 3.3)
|
|
147
|
+
rspec-expectations (~> 3.3)
|
|
148
|
+
rspec-mocks (~> 3.3)
|
|
149
|
+
nio4r (2.5.7)
|
|
150
|
+
nokogiri (1.11.3)
|
|
151
|
+
mini_portile2 (~> 2.5.0)
|
|
152
|
+
racc (~> 1.4)
|
|
153
|
+
nokogumbo (2.0.5)
|
|
154
|
+
nokogiri (~> 1.8, >= 1.8.4)
|
|
155
|
+
paperclip (6.1.0)
|
|
115
156
|
activemodel (>= 4.2.0)
|
|
116
157
|
activesupport (>= 4.2.0)
|
|
117
|
-
cocaine (~> 0.5.5)
|
|
118
158
|
mime-types
|
|
119
159
|
mimemagic (~> 0.3.0)
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
160
|
+
terrapin (~> 0.6.0)
|
|
161
|
+
parallel (1.20.1)
|
|
162
|
+
parser (3.0.1.0)
|
|
163
|
+
ast (~> 2.4.1)
|
|
164
|
+
public_suffix (4.0.6)
|
|
165
|
+
racc (1.5.2)
|
|
166
|
+
rack (2.2.3)
|
|
167
|
+
rack-test (1.1.0)
|
|
126
168
|
rack (>= 1.0, < 3)
|
|
127
|
-
rails (
|
|
128
|
-
actioncable (=
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
169
|
+
rails (6.1.3.1)
|
|
170
|
+
actioncable (= 6.1.3.1)
|
|
171
|
+
actionmailbox (= 6.1.3.1)
|
|
172
|
+
actionmailer (= 6.1.3.1)
|
|
173
|
+
actionpack (= 6.1.3.1)
|
|
174
|
+
actiontext (= 6.1.3.1)
|
|
175
|
+
actionview (= 6.1.3.1)
|
|
176
|
+
activejob (= 6.1.3.1)
|
|
177
|
+
activemodel (= 6.1.3.1)
|
|
178
|
+
activerecord (= 6.1.3.1)
|
|
179
|
+
activestorage (= 6.1.3.1)
|
|
180
|
+
activesupport (= 6.1.3.1)
|
|
181
|
+
bundler (>= 1.15.0)
|
|
182
|
+
railties (= 6.1.3.1)
|
|
138
183
|
sprockets-rails (>= 2.0.0)
|
|
139
184
|
rails-dom-testing (2.0.3)
|
|
140
185
|
activesupport (>= 4.2.0)
|
|
141
186
|
nokogiri (>= 1.6)
|
|
142
|
-
rails-html-sanitizer (1.0
|
|
143
|
-
loofah (~> 2.
|
|
144
|
-
railties (
|
|
145
|
-
actionpack (=
|
|
146
|
-
activesupport (=
|
|
187
|
+
rails-html-sanitizer (1.3.0)
|
|
188
|
+
loofah (~> 2.3)
|
|
189
|
+
railties (6.1.3.1)
|
|
190
|
+
actionpack (= 6.1.3.1)
|
|
191
|
+
activesupport (= 6.1.3.1)
|
|
147
192
|
method_source
|
|
148
193
|
rake (>= 0.8.7)
|
|
149
|
-
thor (
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
rspec-
|
|
157
|
-
|
|
194
|
+
thor (~> 1.0)
|
|
195
|
+
rainbow (3.0.0)
|
|
196
|
+
rake (13.0.3)
|
|
197
|
+
regexp_parser (2.1.1)
|
|
198
|
+
rexml (3.2.5)
|
|
199
|
+
rspec (3.10.0)
|
|
200
|
+
rspec-core (~> 3.10.0)
|
|
201
|
+
rspec-expectations (~> 3.10.0)
|
|
202
|
+
rspec-mocks (~> 3.10.0)
|
|
203
|
+
rspec-core (3.10.1)
|
|
204
|
+
rspec-support (~> 3.10.0)
|
|
205
|
+
rspec-expectations (3.10.1)
|
|
158
206
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
159
|
-
rspec-support (~> 3.
|
|
160
|
-
rspec-mocks (3.
|
|
207
|
+
rspec-support (~> 3.10.0)
|
|
208
|
+
rspec-mocks (3.10.2)
|
|
161
209
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
162
|
-
rspec-support (~> 3.
|
|
163
|
-
rspec-support (3.
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
210
|
+
rspec-support (~> 3.10.0)
|
|
211
|
+
rspec-support (3.10.2)
|
|
212
|
+
rubocop (1.12.1)
|
|
213
|
+
parallel (~> 1.10)
|
|
214
|
+
parser (>= 3.0.0.0)
|
|
215
|
+
rainbow (>= 2.2.2, < 4.0)
|
|
216
|
+
regexp_parser (>= 1.8, < 3.0)
|
|
217
|
+
rexml
|
|
218
|
+
rubocop-ast (>= 1.2.0, < 2.0)
|
|
219
|
+
ruby-progressbar (~> 1.7)
|
|
220
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
|
221
|
+
rubocop-ast (1.4.1)
|
|
222
|
+
parser (>= 2.7.1.5)
|
|
223
|
+
rubocop-rspec (2.2.0)
|
|
224
|
+
rubocop (~> 1.0)
|
|
225
|
+
rubocop-ast (>= 1.1.0)
|
|
226
|
+
ruby-progressbar (1.11.0)
|
|
227
|
+
ruby-vips (2.1.0)
|
|
228
|
+
ffi (~> 1.12)
|
|
229
|
+
russian_phone (0.7.0)
|
|
230
|
+
safe_yaml (1.0.5)
|
|
231
|
+
sanitize (5.2.3)
|
|
167
232
|
crass (~> 1.0.2)
|
|
168
|
-
nokogiri (>= 1.
|
|
169
|
-
nokogumbo (~>
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
233
|
+
nokogiri (>= 1.8.0)
|
|
234
|
+
nokogumbo (~> 2.0)
|
|
235
|
+
shrine (3.3.0)
|
|
236
|
+
content_disposition (~> 1.0)
|
|
237
|
+
down (~> 5.1)
|
|
238
|
+
shrine-mongoid (1.0.0)
|
|
239
|
+
mongoid (>= 5.0)
|
|
240
|
+
shrine (>= 3.0.0.beta3, < 4)
|
|
241
|
+
simplecov (0.21.2)
|
|
242
|
+
docile (~> 1.1)
|
|
243
|
+
simplecov-html (~> 0.11)
|
|
244
|
+
simplecov_json_formatter (~> 0.1)
|
|
245
|
+
simplecov-html (0.12.3)
|
|
246
|
+
simplecov_json_formatter (0.1.2)
|
|
247
|
+
sprockets (4.0.2)
|
|
176
248
|
concurrent-ruby (~> 1.0)
|
|
177
249
|
rack (> 1, < 3)
|
|
178
|
-
sprockets-rails (3.2.
|
|
250
|
+
sprockets-rails (3.2.2)
|
|
179
251
|
actionpack (>= 4.0)
|
|
180
252
|
activesupport (>= 4.0)
|
|
181
253
|
sprockets (>= 3.0.0)
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
254
|
+
ssrf_filter (1.0.7)
|
|
255
|
+
terrapin (0.6.0)
|
|
256
|
+
climate_control (>= 0.0.3, < 1.0)
|
|
257
|
+
thor (1.1.0)
|
|
258
|
+
tzinfo (2.0.4)
|
|
259
|
+
concurrent-ruby (~> 1.0)
|
|
260
|
+
unicode-display_width (2.0.0)
|
|
186
261
|
validates_email_format_of (1.6.3)
|
|
187
262
|
i18n
|
|
188
|
-
websocket-driver (0.
|
|
263
|
+
websocket-driver (0.7.3)
|
|
189
264
|
websocket-extensions (>= 0.1.0)
|
|
190
|
-
websocket-extensions (0.1.
|
|
265
|
+
websocket-extensions (0.1.5)
|
|
266
|
+
zeitwerk (2.4.2)
|
|
191
267
|
|
|
192
268
|
PLATFORMS
|
|
193
269
|
ruby
|
|
@@ -199,19 +275,23 @@ DEPENDENCIES
|
|
|
199
275
|
database_cleaner
|
|
200
276
|
factory_bot
|
|
201
277
|
geocoder
|
|
202
|
-
|
|
278
|
+
image_processing
|
|
279
|
+
mini_magick
|
|
280
|
+
mongoid (~> 7.2.2)
|
|
203
281
|
mongoid-paperclip
|
|
204
282
|
mongoid-rspec
|
|
205
|
-
pry
|
|
206
283
|
rails
|
|
207
284
|
rails_admin_settings!
|
|
208
285
|
rake
|
|
209
286
|
rspec
|
|
287
|
+
rubocop-rspec
|
|
210
288
|
russian_phone
|
|
211
289
|
safe_yaml
|
|
212
290
|
sanitize
|
|
291
|
+
shrine (~> 3.0)
|
|
292
|
+
shrine-mongoid (~> 1.0)
|
|
213
293
|
simplecov
|
|
214
294
|
validates_email_format_of
|
|
215
295
|
|
|
216
296
|
BUNDLED WITH
|
|
217
|
-
1.
|
|
297
|
+
1.17.3
|
data/README.md
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
# RailsAdminSettings
|
|
2
2
|
|
|
3
|
+
Master repository has moved to gitlab, all new code will be there:
|
|
4
|
+
|
|
5
|
+
https://gitlab.com/rocket-science/rails_admin_settings
|
|
6
|
+
|
|
7
|
+
|
|
3
8
|
[](http://travis-ci.org/rs-pro/rails_admin_settings)
|
|
4
|
-
[](https://gemnasium.com/rs-pro/rails_admin_settings)
|
|
5
9
|
[](https://badge.fury.io/rb/rails_admin_settings)
|
|
6
10
|
[](https://hakiri.io/github/rs-pro/rails_admin_settings/master)
|
|
7
11
|
[](https://codeclimate.com/github/rs-pro/rails_admin_settings/maintainability)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
- if ['string', 'integer', 'phone', 'email', 'address', 'url', 'domain'].include?(@object.type)
|
|
1
|
+
- if ['string', 'integer', 'float', 'phone', 'email', 'address', 'url', 'domain'].include?(@object.type)
|
|
2
2
|
= form.text_field :raw, :value => field.value
|
|
3
3
|
- if @object.type == 'boolean'
|
|
4
4
|
= form.check_box :raw, {:value => field.value}, 'true', 'false'
|
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
= form.text_area :raw, :value => field.value, :rows => 10, :cols => 80
|
|
9
9
|
- elsif @object.type == 'code' || @object.type == 'sanitize_code'
|
|
10
10
|
:ruby
|
|
11
|
-
#binding.pry
|
|
12
11
|
js_data = {
|
|
13
12
|
csspath: asset_path('ckeditor/plugins/codemirror/css/codemirror.min.css'),
|
|
14
13
|
jspath: asset_path('ckeditor/plugins/codemirror/js/codemirror.min.js'),
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class Shrine
|
|
4
|
+
module Plugins
|
|
5
|
+
# Documentation can be found on https://shrinerb.com/docs/plugins/determine_mime_type
|
|
6
|
+
module DetermineMimeType
|
|
7
|
+
LOG_SUBSCRIBER = -> (event) do
|
|
8
|
+
Shrine.logger.info "MIME Type (#{event.duration}ms) – #{{
|
|
9
|
+
io: event[:io].class,
|
|
10
|
+
uploader: event[:uploader],
|
|
11
|
+
}.inspect}"
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def self.configure(uploader, log_subscriber: LOG_SUBSCRIBER, **opts)
|
|
15
|
+
uploader.opts[:determine_mime_type] ||= { analyzer: :file, analyzer_options: {} }
|
|
16
|
+
uploader.opts[:determine_mime_type].merge!(opts)
|
|
17
|
+
|
|
18
|
+
# instrumentation plugin integration
|
|
19
|
+
uploader.subscribe(:mime_type, &log_subscriber) if uploader.respond_to?(:subscribe)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
module ClassMethods
|
|
23
|
+
# Determines the MIME type of the IO object by calling the specified
|
|
24
|
+
# analyzer.
|
|
25
|
+
def determine_mime_type(io)
|
|
26
|
+
analyzer = opts[:determine_mime_type][:analyzer]
|
|
27
|
+
|
|
28
|
+
analyzer = mime_type_analyzer(analyzer) if analyzer.is_a?(Symbol)
|
|
29
|
+
args = if analyzer.is_a?(Proc)
|
|
30
|
+
[io, mime_type_analyzers].take(analyzer.arity.abs)
|
|
31
|
+
else
|
|
32
|
+
[io, opts[:determine_mime_type][:analyzer_options]]
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
mime_type = instrument_mime_type(io) { analyzer.call(*args) }
|
|
36
|
+
io.rewind
|
|
37
|
+
|
|
38
|
+
mime_type
|
|
39
|
+
end
|
|
40
|
+
alias mime_type determine_mime_type
|
|
41
|
+
|
|
42
|
+
# Returns a hash of built-in MIME type analyzers, where keys are
|
|
43
|
+
# analyzer names and values are `#call`-able objects which accepts the
|
|
44
|
+
# IO object.
|
|
45
|
+
def mime_type_analyzers
|
|
46
|
+
@mime_type_analyzers ||= MimeTypeAnalyzer::SUPPORTED_TOOLS.inject({}) do |hash, tool|
|
|
47
|
+
hash.merge!(tool => mime_type_analyzer(tool))
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Returns callable mime type analyzer object.
|
|
52
|
+
def mime_type_analyzer(name)
|
|
53
|
+
MimeTypeAnalyzer.new(name)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
private
|
|
57
|
+
|
|
58
|
+
# Sends a `mime_type.shrine` event for instrumentation plugin.
|
|
59
|
+
def instrument_mime_type(io, &block)
|
|
60
|
+
return yield unless respond_to?(:instrument)
|
|
61
|
+
|
|
62
|
+
instrument(:mime_type, io: io, &block)
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
module InstanceMethods
|
|
67
|
+
private
|
|
68
|
+
|
|
69
|
+
# Calls the configured MIME type analyzer.
|
|
70
|
+
def extract_mime_type(io)
|
|
71
|
+
self.class.determine_mime_type(io)
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
class MimeTypeAnalyzer
|
|
76
|
+
SUPPORTED_TOOLS = [:fastimage, :file, :filemagic, :mimemagic, :marcel, :mime_types, :mini_mime, :content_type]
|
|
77
|
+
MAGIC_NUMBER = 256 * 1024
|
|
78
|
+
|
|
79
|
+
def initialize(tool)
|
|
80
|
+
raise Error, "unknown mime type analyzer #{tool.inspect}, supported analyzers are: #{SUPPORTED_TOOLS.join(",")}" unless SUPPORTED_TOOLS.include?(tool)
|
|
81
|
+
|
|
82
|
+
@tool = tool
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
def call(io, options = {})
|
|
86
|
+
mime_type = send(:"extract_with_#{@tool}", io, options)
|
|
87
|
+
io.rewind
|
|
88
|
+
|
|
89
|
+
mime_type
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
private
|
|
93
|
+
|
|
94
|
+
def extract_with_file(io, options)
|
|
95
|
+
require "open3"
|
|
96
|
+
|
|
97
|
+
return nil if io.eof? # file command returns "application/x-empty" for empty files
|
|
98
|
+
|
|
99
|
+
Open3.popen3(*%W[file --mime-type --brief -]) do |stdin, stdout, stderr, thread|
|
|
100
|
+
begin
|
|
101
|
+
IO.copy_stream(io, stdin.binmode)
|
|
102
|
+
rescue Errno::EPIPE
|
|
103
|
+
end
|
|
104
|
+
stdin.close
|
|
105
|
+
|
|
106
|
+
status = thread.value
|
|
107
|
+
|
|
108
|
+
raise Error, "file command failed to spawn: #{stderr.read}" if status.nil?
|
|
109
|
+
raise Error, "file command failed: #{stderr.read}" unless status.success?
|
|
110
|
+
|
|
111
|
+
$stderr.print(stderr.read)
|
|
112
|
+
|
|
113
|
+
output = stdout.read.strip
|
|
114
|
+
|
|
115
|
+
raise Error, "file command failed: #{output}" if output.include?("cannot open")
|
|
116
|
+
|
|
117
|
+
output
|
|
118
|
+
end
|
|
119
|
+
rescue Errno::ENOENT
|
|
120
|
+
raise Error, "file command-line tool is not installed"
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
def extract_with_fastimage(io, options)
|
|
124
|
+
require "fastimage"
|
|
125
|
+
|
|
126
|
+
type = FastImage.type(io)
|
|
127
|
+
"image/#{type}" if type
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
def extract_with_filemagic(io, options)
|
|
131
|
+
require "filemagic"
|
|
132
|
+
|
|
133
|
+
return nil if io.eof? # FileMagic returns "application/x-empty" for empty files
|
|
134
|
+
|
|
135
|
+
FileMagic.open(FileMagic::MAGIC_MIME_TYPE) do |filemagic|
|
|
136
|
+
filemagic.buffer(io.read(MAGIC_NUMBER))
|
|
137
|
+
end
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
def extract_with_mimemagic(io, options)
|
|
141
|
+
require "mimemagic"
|
|
142
|
+
|
|
143
|
+
mime = MimeMagic.by_magic(io)
|
|
144
|
+
mime&.type
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
def extract_with_marcel(io, options)
|
|
148
|
+
require "marcel"
|
|
149
|
+
|
|
150
|
+
return nil if io.eof? # marcel returns "application/octet-stream" for empty files
|
|
151
|
+
|
|
152
|
+
filename = (options[:filename_fallback] ? extract_filename(io) : nil)
|
|
153
|
+
Marcel::MimeType.for(io, name: filename)
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
def extract_with_mime_types(io, options)
|
|
157
|
+
require "mime/types"
|
|
158
|
+
|
|
159
|
+
if filename = extract_filename(io)
|
|
160
|
+
mime_type = MIME::Types.of(filename).first
|
|
161
|
+
mime_type&.content_type
|
|
162
|
+
end
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
def extract_with_mini_mime(io, options)
|
|
166
|
+
require "mini_mime"
|
|
167
|
+
|
|
168
|
+
if filename = extract_filename(io)
|
|
169
|
+
info = MiniMime.lookup_by_filename(filename)
|
|
170
|
+
info&.content_type
|
|
171
|
+
end
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
def extract_with_content_type(io, options)
|
|
175
|
+
if io.respond_to?(:content_type) && io.content_type
|
|
176
|
+
io.content_type.split(";").first
|
|
177
|
+
end
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
def extract_filename(io)
|
|
181
|
+
if io.respond_to?(:original_filename)
|
|
182
|
+
io.original_filename
|
|
183
|
+
elsif io.respond_to?(:path)
|
|
184
|
+
File.basename(io.path)
|
|
185
|
+
end
|
|
186
|
+
end
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
register_plugin(:determine_mime_type, DetermineMimeType)
|
|
192
|
+
end
|
|
193
|
+
end
|
|
@@ -10,7 +10,7 @@ module RailsAdminSettings
|
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
def text_kind?
|
|
13
|
-
(RailsAdminSettings.kinds - ['phone', 'phones', 'integer', 'yaml', 'json', 'boolean']).include? kind
|
|
13
|
+
(RailsAdminSettings.kinds - ['phone', 'phones', 'integer', 'float', 'yaml', 'json', 'boolean']).include? kind
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
def upload_kind?
|
|
@@ -31,10 +31,14 @@ module RailsAdminSettings
|
|
|
31
31
|
|
|
32
32
|
def value
|
|
33
33
|
if upload_kind?
|
|
34
|
-
|
|
35
|
-
file
|
|
34
|
+
unless defined?(Shrine)
|
|
35
|
+
if file?
|
|
36
|
+
file.url
|
|
37
|
+
else
|
|
38
|
+
nil
|
|
39
|
+
end
|
|
36
40
|
else
|
|
37
|
-
|
|
41
|
+
file.url if file.present?
|
|
38
42
|
end
|
|
39
43
|
elsif raw.blank? || disabled?
|
|
40
44
|
default_value
|
|
@@ -54,7 +58,8 @@ module RailsAdminSettings
|
|
|
54
58
|
end
|
|
55
59
|
|
|
56
60
|
def to_s
|
|
57
|
-
if yaml_kind? || json_kind? || phone_kind? || integer_kind?
|
|
61
|
+
if yaml_kind? || json_kind? || phone_kind? || integer_kind? || float_kind?
|
|
62
|
+
|
|
58
63
|
raw
|
|
59
64
|
else
|
|
60
65
|
value
|
|
@@ -94,6 +99,8 @@ module RailsAdminSettings
|
|
|
94
99
|
''
|
|
95
100
|
elsif integer_kind?
|
|
96
101
|
0
|
|
102
|
+
elsif float_kind?
|
|
103
|
+
0
|
|
97
104
|
elsif yaml_kind?
|
|
98
105
|
nil
|
|
99
106
|
elsif json_kind?
|
|
@@ -181,6 +188,8 @@ module RailsAdminSettings
|
|
|
181
188
|
process_text
|
|
182
189
|
elsif integer_kind?
|
|
183
190
|
raw.to_i
|
|
191
|
+
elsif float_kind?
|
|
192
|
+
raw.to_f
|
|
184
193
|
elsif yaml_kind?
|
|
185
194
|
load_yaml
|
|
186
195
|
elsif json_kind?
|
|
@@ -4,7 +4,6 @@ module RailsAdminSettings
|
|
|
4
4
|
if base.respond_to?(:rails_admin)
|
|
5
5
|
base.rails_admin do
|
|
6
6
|
navigation_label I18n.t('admin.settings.label')
|
|
7
|
-
|
|
8
7
|
list do
|
|
9
8
|
if Object.const_defined?('RailsAdminToggleable')
|
|
10
9
|
field :enabled, :toggle
|
|
@@ -16,10 +15,18 @@ module RailsAdminSettings
|
|
|
16
15
|
field :name
|
|
17
16
|
field :raw do
|
|
18
17
|
pretty_value do
|
|
19
|
-
if bindings[:object].file_kind?
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
if bindings[:object].file_kind? and !defined?(Shrine) and bindings[:object].to_path.present?
|
|
19
|
+
if bindings[:object].file.url.blank?
|
|
20
|
+
"-"
|
|
21
|
+
else
|
|
22
|
+
"<a href='#{CGI::escapeHTML(bindings[:object].file.url)}'>#{CGI::escapeHTML(bindings[:object].to_path)}</a>".html_safe
|
|
23
|
+
end
|
|
24
|
+
elsif bindings[:object].image_kind? and !defined?(Shrine) and !bindings[:object].file.nil?
|
|
25
|
+
if bindings[:object].file.url.blank?
|
|
26
|
+
"-"
|
|
27
|
+
else
|
|
28
|
+
"<a href='#{CGI::escapeHTML(bindings[:object].file.url)}'><img src='#{CGI::escapeHTML(bindings[:object].file.url)}' /></a>".html_safe
|
|
29
|
+
end
|
|
23
30
|
else
|
|
24
31
|
value
|
|
25
32
|
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
module RailsAdminSettings
|
|
2
|
+
module Uploads
|
|
3
|
+
class ShrineUploader < Shrine
|
|
4
|
+
plugin :determine_mime_type
|
|
5
|
+
plugin :validation_helpers
|
|
6
|
+
plugin :mongoid if RailsAdminSettings.mongoid?
|
|
7
|
+
Attacher.validate do
|
|
8
|
+
validate_mime_type_inclusion %w[image/jpeg image/gif image/png]
|
|
9
|
+
validate_max_size 2.megabytes
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
module RailsAdminSettings
|
|
2
2
|
module Uploads
|
|
3
3
|
autoload :CarrierWaveUploader, "rails_admin_settings/storage/carrier_wave_uploader"
|
|
4
|
+
autoload :ShrineUploader, "rails_admin_settings/storage/shrine_uploader"
|
|
4
5
|
|
|
5
6
|
def self.paperclip_options
|
|
6
7
|
if defined?(Rails)
|
|
@@ -37,6 +38,16 @@ module RailsAdminSettings
|
|
|
37
38
|
end
|
|
38
39
|
Settings.file_uploads_supported = true
|
|
39
40
|
Settings.file_uploads_engine = :paperclip
|
|
41
|
+
elsif RailsAdminSettings.active_record? && defined?(Shrine)
|
|
42
|
+
Settings.file_uploads_supported = true
|
|
43
|
+
Settings.file_uploads_engine = :shrine
|
|
44
|
+
base.send(:include, ShrineUploader::Attachment(:file))
|
|
45
|
+
elsif RailsAdminSettings.mongoid? && ::Mongoid.const_defined?('Shrine')
|
|
46
|
+
base.send(:include, ::Mongoid::Document)
|
|
47
|
+
base.send(:include, ShrineUploader::Attachment(:file))
|
|
48
|
+
base.field(:file_data, type: String)
|
|
49
|
+
Settings.file_uploads_supported = true
|
|
50
|
+
Settings.file_uploads_engine = :shrine
|
|
40
51
|
else
|
|
41
52
|
# puts "[rails_admin_settings] Uploads disabled"
|
|
42
53
|
end
|
|
@@ -9,6 +9,7 @@ module RailsAdminSettings
|
|
|
9
9
|
base.validates_uniqueness_of :key, scope: :ns
|
|
10
10
|
base.validates_inclusion_of :kind, in: RailsAdminSettings.kinds
|
|
11
11
|
base.validates_numericality_of :raw, if: :integer_kind?
|
|
12
|
+
base.validates_numericality_of :raw, if: :float_kind?
|
|
12
13
|
|
|
13
14
|
add_validators(base)
|
|
14
15
|
end
|
|
@@ -31,7 +32,7 @@ module RailsAdminSettings
|
|
|
31
32
|
def add_file_validator(base)
|
|
32
33
|
base.validate if: :file_kind? do
|
|
33
34
|
unless Settings.file_uploads_supported
|
|
34
|
-
raise '[rails_admin_settings] File kind requires either CarrierWave or Paperclip. Check that rails_admin_settings is below them in Gemfile'
|
|
35
|
+
raise '[rails_admin_settings] File kind requires either CarrierWave or Paperclip or Shrine. Check that rails_admin_settings is below them in Gemfile'
|
|
35
36
|
end
|
|
36
37
|
end
|
|
37
38
|
end
|
|
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
|
10
10
|
spec.email = ["glebtv@gmail.com"]
|
|
11
11
|
spec.description = %q{Mongoid / ActiveRecord + RailsAdmin App Settings management}
|
|
12
12
|
spec.summary = %q{}
|
|
13
|
-
spec.homepage = "https://
|
|
13
|
+
spec.homepage = "https://gitlab.com/rocket-science/rails_admin_settings"
|
|
14
14
|
spec.license = "MIT"
|
|
15
15
|
|
|
16
16
|
spec.files = `git ls-files`.split($/)
|
|
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
|
|
|
19
19
|
spec.require_paths = ["lib"]
|
|
20
20
|
|
|
21
21
|
|
|
22
|
-
spec.add_development_dependency "mongoid", '~>
|
|
22
|
+
spec.add_development_dependency "mongoid", '~> 7.2.2'
|
|
23
23
|
spec.add_development_dependency "rails"
|
|
24
24
|
spec.add_development_dependency "bundler"
|
|
25
25
|
spec.add_development_dependency "rake"
|
|
@@ -36,5 +36,9 @@ Gem::Specification.new do |spec|
|
|
|
36
36
|
spec.add_development_dependency "addressable"
|
|
37
37
|
spec.add_development_dependency "carrierwave-mongoid"
|
|
38
38
|
spec.add_development_dependency "mongoid-paperclip"
|
|
39
|
-
spec.add_development_dependency "
|
|
39
|
+
spec.add_development_dependency "rubocop-rspec"
|
|
40
|
+
spec.add_development_dependency 'image_processing'
|
|
41
|
+
spec.add_development_dependency "mini_magick"
|
|
42
|
+
spec.add_development_dependency "shrine", "~> 3.0"
|
|
43
|
+
spec.add_development_dependency "shrine-mongoid", "~> 1.0"
|
|
40
44
|
end
|
data/spec/factories/setting.rb
CHANGED
data/spec/shrine_spec.rb
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
describe "Uploads" do
|
|
5
|
+
if Settings.file_uploads_engine != :shrine
|
|
6
|
+
pending "shrine not detected, skipped. To run use UPLOADS=shrine rspec"
|
|
7
|
+
else
|
|
8
|
+
before :each do
|
|
9
|
+
f = "#{File.dirname(__FILE__)}/../uploads/1024x768.gif"
|
|
10
|
+
if File.file?(f)
|
|
11
|
+
File.unlink(f)
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
it 'supports file kind' do
|
|
15
|
+
Settings.set('file', File.open("#{File.dirname(__FILE__)}/support/1024x768.gif"), kind: 'file')
|
|
16
|
+
expect(Settings.get(:file).file.metadata["filename"]).to eq '1024x768.gif'
|
|
17
|
+
expect(Settings.get(:file).file.metadata["size"]).to eq 4357
|
|
18
|
+
expect(Settings.get(:file).file.metadata["mime_type"]).to eq "image/gif"
|
|
19
|
+
expect(Settings.get(:file).file.id.split(".").last).to eq "gif"
|
|
20
|
+
expect(Settings.file.split("/").second + "/" + Settings.file.split("/").last.split(".").last).to eq "uploads/gif"
|
|
21
|
+
expect(File.exists?("public/uploads/#{Settings.get(:file).file.id}")).to be_truthy
|
|
22
|
+
end
|
|
23
|
+
it 'supports image kind' do
|
|
24
|
+
Settings.set('file', File.open("#{File.dirname(__FILE__)}/support/1024x768.gif"), kind: 'image')
|
|
25
|
+
expect(Settings.get(:file).file.metadata["filename"]).to eq '1024x768.gif'
|
|
26
|
+
expect(Settings.get(:file).file.metadata["size"]).to eq 4357
|
|
27
|
+
expect(Settings.get(:file).file.metadata["mime_type"]).to eq "image/gif"
|
|
28
|
+
expect(Settings.get(:file).file.id.split(".").last).to eq "gif"
|
|
29
|
+
expect(Settings.file.split("/").second + "/" + Settings.file.split("/").last.split(".").last).to eq "uploads/gif"
|
|
30
|
+
expect(File.exists?("public/uploads/#{Settings.get(:file).file.id}")).to be_truthy
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
data/spec/spec_helper.rb
CHANGED
|
@@ -5,7 +5,6 @@ require 'rubygems'
|
|
|
5
5
|
require 'simplecov'
|
|
6
6
|
SimpleCov.start
|
|
7
7
|
|
|
8
|
-
require 'pry'
|
|
9
8
|
require 'bundler/setup'
|
|
10
9
|
require 'active_support'
|
|
11
10
|
require 'active_support/core_ext'
|
|
@@ -18,7 +17,6 @@ require 'database_cleaner'
|
|
|
18
17
|
require 'factory_bot'
|
|
19
18
|
require 'mongoid-rspec'
|
|
20
19
|
|
|
21
|
-
p ENV["UPLOADS"]
|
|
22
20
|
if ENV['UPLOADS'] == 'paperclip'
|
|
23
21
|
require "mongoid-paperclip"
|
|
24
22
|
end
|
|
@@ -30,6 +28,22 @@ if ENV['UPLOADS'] == 'carrierwave'
|
|
|
30
28
|
end
|
|
31
29
|
end
|
|
32
30
|
end
|
|
31
|
+
if ENV['UPLOADS'] == 'shrine'
|
|
32
|
+
require "shrine"
|
|
33
|
+
require "shrine/storage/file_system"
|
|
34
|
+
Shrine.storages = {
|
|
35
|
+
cache: Shrine::Storage::FileSystem.new("public", prefix: "uploads/cache"), # temporary
|
|
36
|
+
store: Shrine::Storage::FileSystem.new("public", prefix: "uploads"), # permanent
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if ENV['ACTIVERECORD']
|
|
40
|
+
Shrine.plugin :activerecord
|
|
41
|
+
end
|
|
42
|
+
Shrine.plugin :cached_attachment_data # for retaining the cached file across form redisplays
|
|
43
|
+
Shrine.plugin :restore_cached_data # re-extract metadata when attaching a cached file
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
|
|
33
47
|
|
|
34
48
|
I18n.enforce_available_locales = true
|
|
35
49
|
I18n.load_path << File.join(File.dirname(__FILE__), "..", "config", "locales", "en.yml")
|
data/spec/support/1024x768.gif
CHANGED
|
File without changes
|
data/spec/types_spec.rb
CHANGED
|
@@ -23,6 +23,13 @@ describe 'Settings kind' do
|
|
|
23
23
|
expect(Settings.testint2).to eq 5
|
|
24
24
|
end
|
|
25
25
|
|
|
26
|
+
it 'float' do
|
|
27
|
+
expect(Settings.get(:testfloat, kind: 'float').value).to eq 0
|
|
28
|
+
expect(Settings.get(:testfloat, default: 5.2, kind: 'float').value).to eq 0
|
|
29
|
+
expect(Settings.get(:testfloat2, default: 5.5, kind: 'float').value).to eq 5.5
|
|
30
|
+
expect(Settings.testfloat2).to eq 5.5
|
|
31
|
+
end
|
|
32
|
+
|
|
26
33
|
it 'does yaml' do
|
|
27
34
|
Settings.set(:data, '[one, two, three]', kind: 'yaml')
|
|
28
35
|
expect(Settings.get(:data).raw).to eq '[one, two, three]'
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rails_admin_settings
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.7.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Gleb Tv
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2021-04-16 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: mongoid
|
|
@@ -16,14 +16,14 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - "~>"
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version:
|
|
19
|
+
version: 7.2.2
|
|
20
20
|
type: :development
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
24
|
- - "~>"
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version:
|
|
26
|
+
version: 7.2.2
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: rails
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -249,7 +249,7 @@ dependencies:
|
|
|
249
249
|
- !ruby/object:Gem::Version
|
|
250
250
|
version: '0'
|
|
251
251
|
- !ruby/object:Gem::Dependency
|
|
252
|
-
name:
|
|
252
|
+
name: rubocop-rspec
|
|
253
253
|
requirement: !ruby/object:Gem::Requirement
|
|
254
254
|
requirements:
|
|
255
255
|
- - ">="
|
|
@@ -262,6 +262,62 @@ dependencies:
|
|
|
262
262
|
- - ">="
|
|
263
263
|
- !ruby/object:Gem::Version
|
|
264
264
|
version: '0'
|
|
265
|
+
- !ruby/object:Gem::Dependency
|
|
266
|
+
name: image_processing
|
|
267
|
+
requirement: !ruby/object:Gem::Requirement
|
|
268
|
+
requirements:
|
|
269
|
+
- - ">="
|
|
270
|
+
- !ruby/object:Gem::Version
|
|
271
|
+
version: '0'
|
|
272
|
+
type: :development
|
|
273
|
+
prerelease: false
|
|
274
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
275
|
+
requirements:
|
|
276
|
+
- - ">="
|
|
277
|
+
- !ruby/object:Gem::Version
|
|
278
|
+
version: '0'
|
|
279
|
+
- !ruby/object:Gem::Dependency
|
|
280
|
+
name: mini_magick
|
|
281
|
+
requirement: !ruby/object:Gem::Requirement
|
|
282
|
+
requirements:
|
|
283
|
+
- - ">="
|
|
284
|
+
- !ruby/object:Gem::Version
|
|
285
|
+
version: '0'
|
|
286
|
+
type: :development
|
|
287
|
+
prerelease: false
|
|
288
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
289
|
+
requirements:
|
|
290
|
+
- - ">="
|
|
291
|
+
- !ruby/object:Gem::Version
|
|
292
|
+
version: '0'
|
|
293
|
+
- !ruby/object:Gem::Dependency
|
|
294
|
+
name: shrine
|
|
295
|
+
requirement: !ruby/object:Gem::Requirement
|
|
296
|
+
requirements:
|
|
297
|
+
- - "~>"
|
|
298
|
+
- !ruby/object:Gem::Version
|
|
299
|
+
version: '3.0'
|
|
300
|
+
type: :development
|
|
301
|
+
prerelease: false
|
|
302
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
303
|
+
requirements:
|
|
304
|
+
- - "~>"
|
|
305
|
+
- !ruby/object:Gem::Version
|
|
306
|
+
version: '3.0'
|
|
307
|
+
- !ruby/object:Gem::Dependency
|
|
308
|
+
name: shrine-mongoid
|
|
309
|
+
requirement: !ruby/object:Gem::Requirement
|
|
310
|
+
requirements:
|
|
311
|
+
- - "~>"
|
|
312
|
+
- !ruby/object:Gem::Version
|
|
313
|
+
version: '1.0'
|
|
314
|
+
type: :development
|
|
315
|
+
prerelease: false
|
|
316
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
317
|
+
requirements:
|
|
318
|
+
- - "~>"
|
|
319
|
+
- !ruby/object:Gem::Version
|
|
320
|
+
version: '1.0'
|
|
265
321
|
description: Mongoid / ActiveRecord + RailsAdmin App Settings management
|
|
266
322
|
email:
|
|
267
323
|
- glebtv@gmail.com
|
|
@@ -270,7 +326,9 @@ extensions: []
|
|
|
270
326
|
extra_rdoc_files: []
|
|
271
327
|
files:
|
|
272
328
|
- ".gitignore"
|
|
329
|
+
- ".rakeTasks"
|
|
273
330
|
- ".rspec"
|
|
331
|
+
- ".ruby-version"
|
|
274
332
|
- ".travis.yml"
|
|
275
333
|
- CHANGELOG.md
|
|
276
334
|
- Gemfile
|
|
@@ -288,6 +346,7 @@ files:
|
|
|
288
346
|
- lib/generators/rails_admin_settings/migration_generator.rb
|
|
289
347
|
- lib/generators/rails_admin_settings/templates/migration.rb
|
|
290
348
|
- lib/rails_admin_settings.rb
|
|
349
|
+
- lib/rails_admin_settings/determine_mime_type.rb
|
|
291
350
|
- lib/rails_admin_settings/dumper.rb
|
|
292
351
|
- lib/rails_admin_settings/engine.rb
|
|
293
352
|
- lib/rails_admin_settings/fallback.rb
|
|
@@ -300,6 +359,7 @@ files:
|
|
|
300
359
|
- lib/rails_admin_settings/require_helpers.rb
|
|
301
360
|
- lib/rails_admin_settings/settings.rb
|
|
302
361
|
- lib/rails_admin_settings/storage/carrier_wave_uploader.rb
|
|
362
|
+
- lib/rails_admin_settings/storage/shrine_uploader.rb
|
|
303
363
|
- lib/rails_admin_settings/tasks.rb
|
|
304
364
|
- lib/rails_admin_settings/uploads.rb
|
|
305
365
|
- lib/rails_admin_settings/validation.rb
|
|
@@ -318,6 +378,7 @@ files:
|
|
|
318
378
|
- spec/namespaced_spec.rb
|
|
319
379
|
- spec/paperclip_spec.rb
|
|
320
380
|
- spec/settings_spec.rb
|
|
381
|
+
- spec/shrine_spec.rb
|
|
321
382
|
- spec/spec_helper.rb
|
|
322
383
|
- spec/support/1024x768.gif
|
|
323
384
|
- spec/support/database_cleaner.rb
|
|
@@ -326,11 +387,11 @@ files:
|
|
|
326
387
|
- spec/support/mongoid.rb
|
|
327
388
|
- spec/support/mongoid.yml
|
|
328
389
|
- spec/types_spec.rb
|
|
329
|
-
homepage: https://
|
|
390
|
+
homepage: https://gitlab.com/rocket-science/rails_admin_settings
|
|
330
391
|
licenses:
|
|
331
392
|
- MIT
|
|
332
393
|
metadata: {}
|
|
333
|
-
post_install_message:
|
|
394
|
+
post_install_message:
|
|
334
395
|
rdoc_options: []
|
|
335
396
|
require_paths:
|
|
336
397
|
- lib
|
|
@@ -345,9 +406,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
345
406
|
- !ruby/object:Gem::Version
|
|
346
407
|
version: '0'
|
|
347
408
|
requirements: []
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
signing_key:
|
|
409
|
+
rubygems_version: 3.1.4
|
|
410
|
+
signing_key:
|
|
351
411
|
specification_version: 4
|
|
352
412
|
summary: ''
|
|
353
413
|
test_files:
|
|
@@ -363,6 +423,7 @@ test_files:
|
|
|
363
423
|
- spec/namespaced_spec.rb
|
|
364
424
|
- spec/paperclip_spec.rb
|
|
365
425
|
- spec/settings_spec.rb
|
|
426
|
+
- spec/shrine_spec.rb
|
|
366
427
|
- spec/spec_helper.rb
|
|
367
428
|
- spec/support/1024x768.gif
|
|
368
429
|
- spec/support/database_cleaner.rb
|