populate-me 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/Gemfile +3 -0
- data/LICENSE +20 -0
- data/README.md +655 -0
- data/Rakefile +14 -0
- data/example/config.ru +100 -0
- data/lib/populate_me.rb +2 -0
- data/lib/populate_me/admin.rb +157 -0
- data/lib/populate_me/admin/__assets__/css/asmselect.css +63 -0
- data/lib/populate_me/admin/__assets__/css/jquery-ui.min.css +6 -0
- data/lib/populate_me/admin/__assets__/css/main.css +244 -0
- data/lib/populate_me/admin/__assets__/img/help/children.png +0 -0
- data/lib/populate_me/admin/__assets__/img/help/create.png +0 -0
- data/lib/populate_me/admin/__assets__/img/help/delete.png +0 -0
- data/lib/populate_me/admin/__assets__/img/help/edit.png +0 -0
- data/lib/populate_me/admin/__assets__/img/help/form.png +0 -0
- data/lib/populate_me/admin/__assets__/img/help/list.png +0 -0
- data/lib/populate_me/admin/__assets__/img/help/login.png +0 -0
- data/lib/populate_me/admin/__assets__/img/help/logout.png +0 -0
- data/lib/populate_me/admin/__assets__/img/help/menu.png +0 -0
- data/lib/populate_me/admin/__assets__/img/help/overview.png +0 -0
- data/lib/populate_me/admin/__assets__/img/help/save.png +0 -0
- data/lib/populate_me/admin/__assets__/img/help/sort.png +0 -0
- data/lib/populate_me/admin/__assets__/img/help/sublist.png +0 -0
- data/lib/populate_me/admin/__assets__/js/asmselect.js +412 -0
- data/lib/populate_me/admin/__assets__/js/columnav.js +87 -0
- data/lib/populate_me/admin/__assets__/js/jquery-ui.min.js +7 -0
- data/lib/populate_me/admin/__assets__/js/main.js +388 -0
- data/lib/populate_me/admin/__assets__/js/mustache.js +578 -0
- data/lib/populate_me/admin/__assets__/js/sortable.js +2 -0
- data/lib/populate_me/admin/views/help.erb +94 -0
- data/lib/populate_me/admin/views/page.erb +189 -0
- data/lib/populate_me/api.rb +124 -0
- data/lib/populate_me/attachment.rb +186 -0
- data/lib/populate_me/document.rb +192 -0
- data/lib/populate_me/document_mixins/admin_adapter.rb +149 -0
- data/lib/populate_me/document_mixins/callbacks.rb +125 -0
- data/lib/populate_me/document_mixins/outcasting.rb +83 -0
- data/lib/populate_me/document_mixins/persistence.rb +95 -0
- data/lib/populate_me/document_mixins/schema.rb +198 -0
- data/lib/populate_me/document_mixins/typecasting.rb +70 -0
- data/lib/populate_me/document_mixins/validation.rb +44 -0
- data/lib/populate_me/file_system_attachment.rb +40 -0
- data/lib/populate_me/grid_fs_attachment.rb +103 -0
- data/lib/populate_me/mongo.rb +160 -0
- data/lib/populate_me/s3_attachment.rb +120 -0
- data/lib/populate_me/variation.rb +38 -0
- data/lib/populate_me/version.rb +4 -0
- data/populate-me.gemspec +34 -0
- data/test/helper.rb +37 -0
- data/test/test_admin.rb +183 -0
- data/test/test_api.rb +246 -0
- data/test/test_attachment.rb +167 -0
- data/test/test_document.rb +128 -0
- data/test/test_document_admin_adapter.rb +221 -0
- data/test/test_document_callbacks.rb +151 -0
- data/test/test_document_outcasting.rb +247 -0
- data/test/test_document_persistence.rb +83 -0
- data/test/test_document_schema.rb +280 -0
- data/test/test_document_typecasting.rb +128 -0
- data/test/test_grid_fs_attachment.rb +239 -0
- data/test/test_mongo.rb +324 -0
- data/test/test_s3_attachment.rb +281 -0
- data/test/test_variation.rb +91 -0
- data/test/test_version.rb +11 -0
- metadata +294 -0
@@ -0,0 +1,91 @@
|
|
1
|
+
require 'helper'
|
2
|
+
require 'populate_me/variation'
|
3
|
+
|
4
|
+
describe PopulateMe::Variation do
|
5
|
+
|
6
|
+
parallelize_me!
|
7
|
+
|
8
|
+
let(:described_class) { PopulateMe::Variation }
|
9
|
+
subject { described_class.new attachment_name, ext, job }
|
10
|
+
let(:attachment_name) { :thumbnail }
|
11
|
+
let(:ext) { :jpg }
|
12
|
+
let(:job) { proc{ :expected } }
|
13
|
+
|
14
|
+
def self.it_has_attributes_set
|
15
|
+
it 'Has attributes set' do
|
16
|
+
assert_equal attachment_name, subject.name
|
17
|
+
assert_equal ext, subject.ext
|
18
|
+
assert_instance_of Proc, subject.job
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
it_has_attributes_set
|
23
|
+
|
24
|
+
it "Can call the job" do
|
25
|
+
assert_equal :expected, subject.job.call
|
26
|
+
end
|
27
|
+
|
28
|
+
describe "Job is a block" do
|
29
|
+
subject {
|
30
|
+
described_class.new(attachment_name, ext) do
|
31
|
+
:expected_in_block
|
32
|
+
end
|
33
|
+
}
|
34
|
+
it "Can call the job" do
|
35
|
+
assert_equal :expected_in_block, subject.job.call
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
describe "::new_image_magick_job" do
|
40
|
+
|
41
|
+
subject {
|
42
|
+
described_class.new_image_magick_job attachment_name, ext, convert_string, opts
|
43
|
+
}
|
44
|
+
let(:convert_string) { "-negate" }
|
45
|
+
let(:opts) { {} }
|
46
|
+
|
47
|
+
let(:src) { "/path/src.jpg" }
|
48
|
+
let(:dst) { "/path/dst.jpg" }
|
49
|
+
|
50
|
+
it_has_attributes_set
|
51
|
+
|
52
|
+
it "Has a job waiting for src and dst" do
|
53
|
+
assert_equal 2, subject.job.arity
|
54
|
+
end
|
55
|
+
|
56
|
+
it "Triggers a well formed convert job" do
|
57
|
+
assert_receive(Kernel, :system, nil, ["convert \"#{src}\" -strip -interlace Plane #{convert_string} \"#{dst}\""]) do
|
58
|
+
subject.job.call(src,dst)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
describe "When strip is off" do
|
63
|
+
let(:opts) { {strip: false} }
|
64
|
+
it "Removes the corresponding command" do
|
65
|
+
assert_receive(Kernel, :system, nil, ["convert \"#{src}\" -interlace Plane #{convert_string} \"#{dst}\""]) do
|
66
|
+
subject.job.call(src,dst)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
describe "When progressive jpeg is off" do
|
72
|
+
let(:opts) { {progressive: false} }
|
73
|
+
it "Removes the corresponding command" do
|
74
|
+
assert_receive(Kernel, :system, nil, ["convert \"#{src}\" -strip #{convert_string} \"#{dst}\""]) do
|
75
|
+
subject.job.call(src,dst)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
describe "When extention is not jpeg" do
|
81
|
+
let(:ext) { :png }
|
82
|
+
it "Does not add commands for progressive jpeg" do
|
83
|
+
assert_receive(Kernel, :system, nil, ["convert \"#{src}\" -strip #{convert_string} \"#{dst}\""]) do
|
84
|
+
subject.job.call(src,dst)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
end
|
90
|
+
|
91
|
+
end
|
metadata
ADDED
@@ -0,0 +1,294 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: populate-me
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.12.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Mickael Riga
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-07-21 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: web-utils
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: sinatra
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '2'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '2'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: json
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '2.1'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '2.1'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: bundler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.13'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.13'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: minitest
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '5.8'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '5.8'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rack-test
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0.6'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0.6'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rack-cerberus
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '1.0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '1.0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: mongo
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '2.0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '2.0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: rack-grid-serve
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 0.0.8
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: 0.0.8
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: aws-sdk-s3
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '1'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '1'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: racksh
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - "~>"
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '1.0'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - "~>"
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '1.0'
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: rake
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - ">="
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: 12.3.3
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - ">="
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: 12.3.3
|
181
|
+
description: PopulateMe is an admin system for managing structured content of web
|
182
|
+
applications. It is built on top of the Sinatra framework, but can be used along
|
183
|
+
any framework using Rack.
|
184
|
+
email:
|
185
|
+
- mig@mypeplum.com
|
186
|
+
executables: []
|
187
|
+
extensions: []
|
188
|
+
extra_rdoc_files: []
|
189
|
+
files:
|
190
|
+
- ".gitignore"
|
191
|
+
- Gemfile
|
192
|
+
- LICENSE
|
193
|
+
- README.md
|
194
|
+
- Rakefile
|
195
|
+
- example/config.ru
|
196
|
+
- lib/populate_me.rb
|
197
|
+
- lib/populate_me/admin.rb
|
198
|
+
- lib/populate_me/admin/__assets__/css/asmselect.css
|
199
|
+
- lib/populate_me/admin/__assets__/css/jquery-ui.min.css
|
200
|
+
- lib/populate_me/admin/__assets__/css/main.css
|
201
|
+
- lib/populate_me/admin/__assets__/img/help/children.png
|
202
|
+
- lib/populate_me/admin/__assets__/img/help/create.png
|
203
|
+
- lib/populate_me/admin/__assets__/img/help/delete.png
|
204
|
+
- lib/populate_me/admin/__assets__/img/help/edit.png
|
205
|
+
- lib/populate_me/admin/__assets__/img/help/form.png
|
206
|
+
- lib/populate_me/admin/__assets__/img/help/list.png
|
207
|
+
- lib/populate_me/admin/__assets__/img/help/login.png
|
208
|
+
- lib/populate_me/admin/__assets__/img/help/logout.png
|
209
|
+
- lib/populate_me/admin/__assets__/img/help/menu.png
|
210
|
+
- lib/populate_me/admin/__assets__/img/help/overview.png
|
211
|
+
- lib/populate_me/admin/__assets__/img/help/save.png
|
212
|
+
- lib/populate_me/admin/__assets__/img/help/sort.png
|
213
|
+
- lib/populate_me/admin/__assets__/img/help/sublist.png
|
214
|
+
- lib/populate_me/admin/__assets__/js/asmselect.js
|
215
|
+
- lib/populate_me/admin/__assets__/js/columnav.js
|
216
|
+
- lib/populate_me/admin/__assets__/js/jquery-ui.min.js
|
217
|
+
- lib/populate_me/admin/__assets__/js/main.js
|
218
|
+
- lib/populate_me/admin/__assets__/js/mustache.js
|
219
|
+
- lib/populate_me/admin/__assets__/js/sortable.js
|
220
|
+
- lib/populate_me/admin/views/help.erb
|
221
|
+
- lib/populate_me/admin/views/page.erb
|
222
|
+
- lib/populate_me/api.rb
|
223
|
+
- lib/populate_me/attachment.rb
|
224
|
+
- lib/populate_me/document.rb
|
225
|
+
- lib/populate_me/document_mixins/admin_adapter.rb
|
226
|
+
- lib/populate_me/document_mixins/callbacks.rb
|
227
|
+
- lib/populate_me/document_mixins/outcasting.rb
|
228
|
+
- lib/populate_me/document_mixins/persistence.rb
|
229
|
+
- lib/populate_me/document_mixins/schema.rb
|
230
|
+
- lib/populate_me/document_mixins/typecasting.rb
|
231
|
+
- lib/populate_me/document_mixins/validation.rb
|
232
|
+
- lib/populate_me/file_system_attachment.rb
|
233
|
+
- lib/populate_me/grid_fs_attachment.rb
|
234
|
+
- lib/populate_me/mongo.rb
|
235
|
+
- lib/populate_me/s3_attachment.rb
|
236
|
+
- lib/populate_me/variation.rb
|
237
|
+
- lib/populate_me/version.rb
|
238
|
+
- populate-me.gemspec
|
239
|
+
- test/helper.rb
|
240
|
+
- test/test_admin.rb
|
241
|
+
- test/test_api.rb
|
242
|
+
- test/test_attachment.rb
|
243
|
+
- test/test_document.rb
|
244
|
+
- test/test_document_admin_adapter.rb
|
245
|
+
- test/test_document_callbacks.rb
|
246
|
+
- test/test_document_outcasting.rb
|
247
|
+
- test/test_document_persistence.rb
|
248
|
+
- test/test_document_schema.rb
|
249
|
+
- test/test_document_typecasting.rb
|
250
|
+
- test/test_grid_fs_attachment.rb
|
251
|
+
- test/test_mongo.rb
|
252
|
+
- test/test_s3_attachment.rb
|
253
|
+
- test/test_variation.rb
|
254
|
+
- test/test_version.rb
|
255
|
+
homepage: https://github.com/mig-hub/populate-me
|
256
|
+
licenses:
|
257
|
+
- MIT
|
258
|
+
metadata: {}
|
259
|
+
post_install_message:
|
260
|
+
rdoc_options: []
|
261
|
+
require_paths:
|
262
|
+
- lib
|
263
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
264
|
+
requirements:
|
265
|
+
- - ">="
|
266
|
+
- !ruby/object:Gem::Version
|
267
|
+
version: '0'
|
268
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
269
|
+
requirements:
|
270
|
+
- - ">="
|
271
|
+
- !ruby/object:Gem::Version
|
272
|
+
version: '0'
|
273
|
+
requirements: []
|
274
|
+
rubygems_version: 3.0.3
|
275
|
+
signing_key:
|
276
|
+
specification_version: 4
|
277
|
+
summary: PopulateMe is an admin system for web applications.
|
278
|
+
test_files:
|
279
|
+
- test/helper.rb
|
280
|
+
- test/test_admin.rb
|
281
|
+
- test/test_api.rb
|
282
|
+
- test/test_attachment.rb
|
283
|
+
- test/test_document.rb
|
284
|
+
- test/test_document_admin_adapter.rb
|
285
|
+
- test/test_document_callbacks.rb
|
286
|
+
- test/test_document_outcasting.rb
|
287
|
+
- test/test_document_persistence.rb
|
288
|
+
- test/test_document_schema.rb
|
289
|
+
- test/test_document_typecasting.rb
|
290
|
+
- test/test_grid_fs_attachment.rb
|
291
|
+
- test/test_mongo.rb
|
292
|
+
- test/test_s3_attachment.rb
|
293
|
+
- test/test_variation.rb
|
294
|
+
- test/test_version.rb
|