populate-me 0.0.33 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +1 -0
- data/LICENSE +1 -1
- data/README.md +399 -4
- data/Rakefile +14 -0
- data/example/config.ru +67 -0
- data/lib/populate_me.rb +2 -0
- data/lib/populate_me/admin.rb +143 -0
- data/lib/populate_me/admin/__assets__/css/main.css +174 -0
- data/lib/populate_me/admin/__assets__/js/columnav.js +82 -0
- data/lib/populate_me/admin/__assets__/js/main.js +251 -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/page.erb +163 -0
- data/lib/populate_me/api.rb +124 -0
- data/lib/populate_me/attachment.rb +182 -0
- data/lib/populate_me/document.rb +178 -0
- data/lib/populate_me/document_mixins/admin_adapter.rb +131 -0
- data/lib/populate_me/document_mixins/callbacks.rb +104 -0
- data/lib/populate_me/document_mixins/outcasting.rb +49 -0
- data/lib/populate_me/document_mixins/persistence.rb +92 -0
- data/lib/populate_me/document_mixins/schema.rb +99 -0
- data/lib/populate_me/document_mixins/typecasting.rb +60 -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 +127 -0
- data/lib/populate_me/mongo.rb +98 -3
- data/lib/populate_me/variation.rb +34 -0
- data/lib/populate_me/version.rb +4 -0
- data/populate-me.gemspec +20 -12
- data/test/helper.rb +37 -0
- data/test/test_admin.rb +161 -0
- data/test/test_api.rb +246 -0
- data/test/test_attachment.rb +155 -0
- data/test/test_document.rb +120 -0
- data/test/test_document_admin_adapter.rb +43 -0
- data/test/test_document_callbacks.rb +107 -0
- data/test/test_document_persistence.rb +56 -0
- data/test/test_document_typecasting.rb +121 -0
- data/test/test_mongo.rb +217 -0
- data/test/test_variation.rb +91 -0
- data/test/test_version.rb +11 -0
- metadata +115 -66
- data/lib/populate_me/control.rb +0 -196
- data/lib/populate_me/control/_public/css/main.css +0 -207
- data/lib/populate_me/control/_public/css/plugin.asmselect.css +0 -63
- data/lib/populate_me/control/_public/css/ui-darkness/images/ui-bg_flat_30_cccccc_40x100.png +0 -0
- data/lib/populate_me/control/_public/css/ui-darkness/images/ui-bg_flat_50_5c5c5c_40x100.png +0 -0
- data/lib/populate_me/control/_public/css/ui-darkness/images/ui-bg_glass_20_555555_1x400.png +0 -0
- data/lib/populate_me/control/_public/css/ui-darkness/images/ui-bg_glass_40_0078a3_1x400.png +0 -0
- data/lib/populate_me/control/_public/css/ui-darkness/images/ui-bg_glass_40_ffc73d_1x400.png +0 -0
- data/lib/populate_me/control/_public/css/ui-darkness/images/ui-bg_gloss-wave_25_333333_500x100.png +0 -0
- data/lib/populate_me/control/_public/css/ui-darkness/images/ui-bg_highlight-soft_80_eeeeee_1x100.png +0 -0
- data/lib/populate_me/control/_public/css/ui-darkness/images/ui-bg_inset-soft_25_000000_1x100.png +0 -0
- data/lib/populate_me/control/_public/css/ui-darkness/images/ui-bg_inset-soft_30_f58400_1x100.png +0 -0
- data/lib/populate_me/control/_public/css/ui-darkness/images/ui-icons_222222_256x240.png +0 -0
- data/lib/populate_me/control/_public/css/ui-darkness/images/ui-icons_4b8e0b_256x240.png +0 -0
- data/lib/populate_me/control/_public/css/ui-darkness/images/ui-icons_a83300_256x240.png +0 -0
- data/lib/populate_me/control/_public/css/ui-darkness/images/ui-icons_cccccc_256x240.png +0 -0
- data/lib/populate_me/control/_public/css/ui-darkness/images/ui-icons_ffffff_256x240.png +0 -0
- data/lib/populate_me/control/_public/css/ui-darkness/jquery-ui-1.8.17.custom.css +0 -430
- data/lib/populate_me/control/_public/img/grip.png +0 -0
- data/lib/populate_me/control/_public/img/icons-cms-solarized.png +0 -0
- data/lib/populate_me/control/_public/img/icons-cms.png +0 -0
- data/lib/populate_me/control/_public/img/placeholder.png +0 -0
- data/lib/populate_me/control/_public/img/placeholder.stash_thumb.gif +0 -0
- data/lib/populate_me/control/_public/img/placeholder.stash_thumb.png +0 -0
- data/lib/populate_me/control/_public/img/small-loader.gif +0 -0
- data/lib/populate_me/control/_public/js/addon.timepicker.js +0 -20
- data/lib/populate_me/control/_public/js/jquery-ui.js +0 -114
- data/lib/populate_me/control/_public/js/jquery.js +0 -167
- data/lib/populate_me/control/_public/js/jquery.mustache.js +0 -559
- data/lib/populate_me/control/_public/js/main.js +0 -144
- data/lib/populate_me/control/_public/js/plugin.asmselect.js +0 -407
- data/lib/populate_me/control/_public/js/plugin.form.js +0 -11
- data/lib/populate_me/control/_public/js/plugin.quicksearch.js +0 -1
- data/lib/populate_me/control/_public/js/plugin.underwood.js +0 -4
- data/lib/populate_me/control/views/populate_me_layout.erb +0 -75
- data/lib/populate_me/ext.rb +0 -16
- data/lib/populate_me/mongo/backend_api_plug.rb +0 -78
- data/lib/populate_me/mongo/crushyform.rb +0 -243
- data/lib/populate_me/mongo/mutation.rb +0 -324
- data/lib/populate_me/mongo/plug.rb +0 -134
- data/lib/populate_me/mongo/stash.rb +0 -171
- data/test/spec_ext.rb +0 -29
- data/test/spec_mongo_mutation.rb +0 -279
@@ -0,0 +1,121 @@
|
|
1
|
+
require 'helper'
|
2
|
+
require 'populate_me/document'
|
3
|
+
|
4
|
+
class Person < PopulateMe::Document
|
5
|
+
field :name
|
6
|
+
field :shared, type: :boolean
|
7
|
+
field :age, type: :integer
|
8
|
+
field :salary, type: :price
|
9
|
+
field :dob, type: :date
|
10
|
+
field :when, type: :datetime
|
11
|
+
end
|
12
|
+
|
13
|
+
describe PopulateMe::Document, 'Typecasting' do
|
14
|
+
|
15
|
+
parallelize_me!
|
16
|
+
|
17
|
+
let(:subject_class) { Person }
|
18
|
+
subject { subject_class.new }
|
19
|
+
|
20
|
+
describe "Value is blank or nil" do
|
21
|
+
it "Returns nil" do
|
22
|
+
assert_nil subject.typecast(:name,nil)
|
23
|
+
assert_nil subject.typecast(:name,'')
|
24
|
+
assert_nil subject.typecast(:salary,'')
|
25
|
+
assert_nil subject.typecast(:dob,'')
|
26
|
+
assert_nil subject.typecast(:when,'')
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe "Field has type :string" do
|
31
|
+
it "Returns it as-is" do
|
32
|
+
assert_equal 'Bob', subject.typecast(:name,'Bob')
|
33
|
+
assert_equal 'true', subject.typecast(:name,'true')
|
34
|
+
assert_equal '5', subject.typecast(:name,'5')
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
describe "Field has type :boolean" do
|
39
|
+
it "Casts as a boolean" do
|
40
|
+
assert_equal true, subject.typecast(:shared,'true')
|
41
|
+
assert_equal false, subject.typecast(:shared,'false')
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
describe "Field has type :integer" do
|
46
|
+
describe "Value is just an integer" do
|
47
|
+
it "Casts it as integer" do
|
48
|
+
assert_equal 42, subject.typecast(:age,'42')
|
49
|
+
end
|
50
|
+
end
|
51
|
+
describe "Value has something written at the end" do
|
52
|
+
it "Ignores it" do
|
53
|
+
assert_equal 42, subject.typecast(:age,'42 yo')
|
54
|
+
end
|
55
|
+
end
|
56
|
+
describe "Value is a float" do
|
57
|
+
it "Rounds it" do
|
58
|
+
assert_equal 42, subject.typecast(:age,'42.50')
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
describe "Field has type :price" do
|
64
|
+
describe "Value is an integer" do
|
65
|
+
it "Casts it in cents/pence (x100)" do
|
66
|
+
assert_equal 4200, subject.typecast(:salary,'42')
|
67
|
+
end
|
68
|
+
end
|
69
|
+
describe "Value is a float with 2 decimals" do
|
70
|
+
it "Casts it in cents/pence" do
|
71
|
+
assert_equal 4250, subject.typecast(:salary,'42.50')
|
72
|
+
end
|
73
|
+
end
|
74
|
+
describe "Value is a float with irregular decimals for a price" do
|
75
|
+
it "Rounds it" do
|
76
|
+
assert_equal 4250, subject.typecast(:salary,'42.5')
|
77
|
+
assert_equal 4257, subject.typecast(:salary,'42.567')
|
78
|
+
end
|
79
|
+
end
|
80
|
+
describe "Value is prefixed or suffixed" do
|
81
|
+
it "Ignores what is not part of the price" do
|
82
|
+
assert_equal 4250, subject.typecast(:salary,'$42.5')
|
83
|
+
assert_equal 4250, subject.typecast(:salary,'42.5 Dollars')
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
describe "Field has type :date" do
|
89
|
+
it "Parses the date with Date.parse" do
|
90
|
+
assert_equal Date.parse('10/11/1979'), subject.typecast(:dob,'10/11/1979')
|
91
|
+
end
|
92
|
+
describe "Delimiter is a dash" do
|
93
|
+
it "Replaces them with forward slash before parsing" do
|
94
|
+
assert_equal Date.parse('10/11/1979'), subject.typecast(:dob,'10-11-1979')
|
95
|
+
end
|
96
|
+
end
|
97
|
+
describe "Value is malformed" do
|
98
|
+
it "Returns nil" do
|
99
|
+
assert_nil subject.typecast(:dob,'10/11')
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
describe "Field has type :datetime" do
|
105
|
+
it "Splits the numbers and feed them to Time.utc" do
|
106
|
+
assert_equal Time.utc(1979,11,10,12,30,4), subject.typecast(:when,'10/11/1979 12:30:4')
|
107
|
+
end
|
108
|
+
describe "Delimiter is a dash" do
|
109
|
+
it "Replaces them with forward slash before parsing" do
|
110
|
+
assert_equal Time.utc(1979,11,10,12,30,4), subject.typecast(:when,'10-11-1979 12:30:4')
|
111
|
+
end
|
112
|
+
end
|
113
|
+
describe "Value is malformed" do
|
114
|
+
it "Returns nil" do
|
115
|
+
assert_nil subject.typecast(:when,'10/11')
|
116
|
+
assert_nil subject.typecast(:when,'10/11/1979')
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
end
|
data/test/test_mongo.rb
ADDED
@@ -0,0 +1,217 @@
|
|
1
|
+
require 'helper'
|
2
|
+
require 'populate_me/mongo'
|
3
|
+
# require 'mongo'
|
4
|
+
|
5
|
+
MONGO = Mongo::Client.new([ '127.0.0.1:27017' ], :database => 'populate-me-test')
|
6
|
+
DB = MONGO.database
|
7
|
+
DB.drop
|
8
|
+
OTHER_MONGO = Mongo::Client.new([ '127.0.0.1:27017' ], :database => 'populate-me-test-other')
|
9
|
+
OTHER_DB = OTHER_MONGO.database
|
10
|
+
OTHER_DB.drop
|
11
|
+
class NoMongoDB < PopulateMe::Mongo; end
|
12
|
+
PopulateMe::Mongo.set :db, DB
|
13
|
+
|
14
|
+
|
15
|
+
describe 'PopulateMe::Mongo' do
|
16
|
+
# PopulateMe::Mongo is the Mongo specific extention for
|
17
|
+
# Document.
|
18
|
+
#
|
19
|
+
# It contains what is specific to a Mongo
|
20
|
+
# database.
|
21
|
+
|
22
|
+
# parallelize_me!
|
23
|
+
|
24
|
+
class CatFish < PopulateMe::Mongo
|
25
|
+
field :name
|
26
|
+
end
|
27
|
+
module Paradise
|
28
|
+
class CatFish < PopulateMe::Mongo
|
29
|
+
field :name
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'Includes Document Module' do
|
34
|
+
assert_equal "Cat Fish", CatFish.to_s
|
35
|
+
assert_equal "Fred", CatFish.new(name: "Fred").to_s
|
36
|
+
end
|
37
|
+
|
38
|
+
it "Has _id as persistent variable if set" do
|
39
|
+
assert_equal [:@name], CatFish.new(name: "hank").persistent_instance_variables
|
40
|
+
cf = CatFish.new(id: "bbbbb", name: "honk")
|
41
|
+
assert cf.persistent_instance_variables.include?(:@_id)
|
42
|
+
assert cf.persistent_instance_variables.include?(:@name)
|
43
|
+
end
|
44
|
+
|
45
|
+
describe 'Database connection' do
|
46
|
+
|
47
|
+
it 'Should raise if db is not set' do
|
48
|
+
assert_raises(PopulateMe::MissingMongoDBError) do
|
49
|
+
NoMongoDB.collection
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'Should have db set by the parent class' do
|
54
|
+
assert_equal DB, CatFish.settings.db
|
55
|
+
end
|
56
|
+
|
57
|
+
it 'Can override db' do
|
58
|
+
CatFish.set :db, OTHER_DB
|
59
|
+
assert_equal OTHER_DB, CatFish.settings.db
|
60
|
+
CatFish.set :db, DB
|
61
|
+
assert_equal DB, CatFish.settings.db
|
62
|
+
end
|
63
|
+
|
64
|
+
it 'Should set DB collection to dasherized full class name by default' do
|
65
|
+
assert_equal "cat-fish", CatFish.settings.collection_name
|
66
|
+
assert_equal "paradise--cat-fish", Paradise::CatFish.settings.collection_name
|
67
|
+
end
|
68
|
+
|
69
|
+
it 'Finds collection in DB' do
|
70
|
+
assert_equal DB['cat-fish'].name, CatFish.collection.name
|
71
|
+
end
|
72
|
+
|
73
|
+
end
|
74
|
+
|
75
|
+
describe 'Low level CRUD' do
|
76
|
+
|
77
|
+
class LowFish < PopulateMe::Mongo
|
78
|
+
field :name
|
79
|
+
end
|
80
|
+
|
81
|
+
before do
|
82
|
+
LowFish.collection.drop
|
83
|
+
end
|
84
|
+
|
85
|
+
it 'Should create' do
|
86
|
+
fred = LowFish.new(name: "Fred")
|
87
|
+
id = fred.perform_create
|
88
|
+
assert_equal id, fred.id
|
89
|
+
refute_nil LowFish.collection.find({'name'=>"Fred"}).first
|
90
|
+
LowFish.collection.delete_one({'name'=>'Fred'})
|
91
|
+
end
|
92
|
+
|
93
|
+
it 'Should create with custom id' do
|
94
|
+
dddd = LowFish.new(id: "dddd", name: "tom")
|
95
|
+
id = dddd.perform_create
|
96
|
+
assert_equal "dddd", id
|
97
|
+
end
|
98
|
+
|
99
|
+
it 'Should update' do
|
100
|
+
jason = LowFish.new(name: "jason")
|
101
|
+
jason.perform_create
|
102
|
+
jason.name = "billy"
|
103
|
+
jason.perform_update
|
104
|
+
assert_equal "billy", LowFish.collection.find({'_id'=> jason.id}).first['name']
|
105
|
+
end
|
106
|
+
|
107
|
+
it "Should get correct item" do
|
108
|
+
jackson_id = LowFish.new(name: "jackson").perform_create
|
109
|
+
assert_equal "jackson", LowFish.admin_get(jackson_id).name
|
110
|
+
assert_equal "jackson", LowFish.admin_get(jackson_id.to_s).name
|
111
|
+
assert_nil LowFish.admin_get("nonexistentid")
|
112
|
+
|
113
|
+
regular_fish_id = LowFish.new(id: 87, name: "regular").perform_create
|
114
|
+
# need to test with .to_s
|
115
|
+
assert_equal "regular", LowFish.admin_get(regular_fish_id).name
|
116
|
+
end
|
117
|
+
|
118
|
+
it 'Should have the [] shortcut for admin_get' do
|
119
|
+
LowFish.collection.insert_one(_id: 42, name: "H2G2")
|
120
|
+
assert_equal LowFish[42], LowFish.admin_get(42)
|
121
|
+
end
|
122
|
+
|
123
|
+
it 'Should admin_find correctly' do
|
124
|
+
LowFish.collection.insert_one(_id: 42, name: "H2G2")
|
125
|
+
assert LowFish.admin_find.is_a?(Array)
|
126
|
+
assert_equal LowFish.collection.find(name: 'H2G2').count, LowFish.admin_find(query: {name: 'H2G2'}).size
|
127
|
+
assert_equal 42, LowFish.admin_find(query: {name: 'H2G2'})[0].id
|
128
|
+
end
|
129
|
+
|
130
|
+
it 'Should delete' do
|
131
|
+
herbert = LowFish.new(name: "herbert")
|
132
|
+
herbert.perform_create
|
133
|
+
refute_nil LowFish.collection.find({"_id"=> herbert.id}).first
|
134
|
+
herbert.perform_delete
|
135
|
+
assert_nil LowFish.collection.find({"_id"=> herbert.id}).first
|
136
|
+
end
|
137
|
+
|
138
|
+
it 'Should not save to the @@documents class variable' do
|
139
|
+
LowFish.collection.insert_one(_id: 42, name: "H2G2")
|
140
|
+
assert_equal [], LowFish.documents
|
141
|
+
end
|
142
|
+
|
143
|
+
end
|
144
|
+
|
145
|
+
describe 'High level CRUD' do
|
146
|
+
|
147
|
+
it 'Should use callbacks' do
|
148
|
+
danny = CatFish.new(name: "danny")
|
149
|
+
assert_nil danny.id
|
150
|
+
assert danny.new?
|
151
|
+
danny.save
|
152
|
+
refute_nil danny.id
|
153
|
+
refute danny.new?
|
154
|
+
end
|
155
|
+
|
156
|
+
end
|
157
|
+
|
158
|
+
describe 'Default Sorting' do
|
159
|
+
|
160
|
+
class MongoSoldier < PopulateMe::Mongo
|
161
|
+
field :name
|
162
|
+
field :position
|
163
|
+
end
|
164
|
+
|
165
|
+
before do
|
166
|
+
MongoSoldier.collection.drop
|
167
|
+
MongoSoldier.new(name: 'Bob', position: 2).perform_create
|
168
|
+
MongoSoldier.new(name: 'Albert', position: 3).perform_create
|
169
|
+
MongoSoldier.new(name: 'Tony', position: 1).perform_create
|
170
|
+
end
|
171
|
+
|
172
|
+
it 'Uses Doc::sort_by to determine the order' do
|
173
|
+
assert_equal 'Albert', MongoSoldier.sort_by(:name).admin_find[0].name
|
174
|
+
assert_equal 'Tony', MongoSoldier.sort_by(:name,:desc).admin_find[0].name
|
175
|
+
assert_equal 1, MongoSoldier.sort_by(:position).admin_find[0].position
|
176
|
+
assert_raises(ArgumentError) do
|
177
|
+
MongoSoldier.sort_by(:name,0)
|
178
|
+
end
|
179
|
+
assert_raises(ArgumentError) do
|
180
|
+
MongoSoldier.sort_by(:namespace)
|
181
|
+
end
|
182
|
+
end
|
183
|
+
|
184
|
+
it 'Can write Mongo-specific sort if a Hash or an Array is passed' do
|
185
|
+
assert_equal 'Tony', MongoSoldier.sort_by([[:name, -1]]).admin_find[0].name
|
186
|
+
assert_equal 'Tony', MongoSoldier.sort_by({name: -1}).admin_find[0].name
|
187
|
+
end
|
188
|
+
|
189
|
+
end
|
190
|
+
|
191
|
+
describe 'Manual Sorting' do
|
192
|
+
|
193
|
+
class MongoChampion < PopulateMe::Mongo
|
194
|
+
field :position
|
195
|
+
end
|
196
|
+
|
197
|
+
before do
|
198
|
+
MongoChampion.collection.drop
|
199
|
+
MongoChampion.new(id: 'a').perform_create
|
200
|
+
MongoChampion.new(id: 'b').perform_create
|
201
|
+
MongoChampion.new(id: 'c').perform_create
|
202
|
+
end
|
203
|
+
|
204
|
+
it 'Sets the indexes on the provided field' do
|
205
|
+
MongoChampion.set_indexes(:position,['b','a','c'])
|
206
|
+
assert_equal 1, MongoChampion.admin_get('a').position
|
207
|
+
assert_equal 0, MongoChampion.admin_get('b').position
|
208
|
+
assert_equal 2, MongoChampion.admin_get('c').position
|
209
|
+
end
|
210
|
+
|
211
|
+
end
|
212
|
+
|
213
|
+
end
|
214
|
+
|
215
|
+
DB.drop
|
216
|
+
OTHER_DB.drop
|
217
|
+
|
@@ -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
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: populate-me
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mickael Riga
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-05-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: web-utils
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
@@ -25,33 +25,33 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: sinatra
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '1.0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '1.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: json
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '2.
|
47
|
+
version: '2.1'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '2.
|
54
|
+
version: '2.1'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: bundler
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -67,19 +67,19 @@ dependencies:
|
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '1.13'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: minitest
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '5.8'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
82
|
+
version: '5.8'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rack-test
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,6 +94,34 @@ dependencies:
|
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
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'
|
97
125
|
- !ruby/object:Gem::Dependency
|
98
126
|
name: racksh
|
99
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -108,10 +136,25 @@ dependencies:
|
|
108
136
|
- - "~>"
|
109
137
|
- !ruby/object:Gem::Version
|
110
138
|
version: '1.0'
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: rake
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '10.1'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '10.1'
|
153
|
+
description: PopulateMe is an admin system for managing structured content of web
|
154
|
+
applications. It is built on top of the Sinatra framework, but can be used along
|
155
|
+
any framework using Rack.
|
156
|
+
email:
|
157
|
+
- mig@mypeplum.com
|
115
158
|
executables: []
|
116
159
|
extensions: []
|
117
160
|
extra_rdoc_files: []
|
@@ -120,59 +163,52 @@ files:
|
|
120
163
|
- Gemfile
|
121
164
|
- LICENSE
|
122
165
|
- README.md
|
123
|
-
-
|
124
|
-
-
|
125
|
-
- lib/populate_me
|
126
|
-
- lib/populate_me/
|
127
|
-
- lib/populate_me/
|
128
|
-
- lib/populate_me/
|
129
|
-
- lib/populate_me/
|
130
|
-
- lib/populate_me/
|
131
|
-
- lib/populate_me/
|
132
|
-
- lib/populate_me/
|
133
|
-
- lib/populate_me/
|
134
|
-
- lib/populate_me/
|
135
|
-
- lib/populate_me/
|
136
|
-
- lib/populate_me/
|
137
|
-
- lib/populate_me/
|
138
|
-
- lib/populate_me/
|
139
|
-
- lib/populate_me/
|
140
|
-
- lib/populate_me/
|
141
|
-
- lib/populate_me/
|
142
|
-
- lib/populate_me/
|
143
|
-
- lib/populate_me/
|
144
|
-
- lib/populate_me/
|
145
|
-
- lib/populate_me/control/_public/img/placeholder.stash_thumb.gif
|
146
|
-
- lib/populate_me/control/_public/img/placeholder.stash_thumb.png
|
147
|
-
- lib/populate_me/control/_public/img/small-loader.gif
|
148
|
-
- lib/populate_me/control/_public/js/addon.timepicker.js
|
149
|
-
- lib/populate_me/control/_public/js/jquery-ui.js
|
150
|
-
- lib/populate_me/control/_public/js/jquery.js
|
151
|
-
- lib/populate_me/control/_public/js/jquery.mustache.js
|
152
|
-
- lib/populate_me/control/_public/js/main.js
|
153
|
-
- lib/populate_me/control/_public/js/plugin.asmselect.js
|
154
|
-
- lib/populate_me/control/_public/js/plugin.form.js
|
155
|
-
- lib/populate_me/control/_public/js/plugin.quicksearch.js
|
156
|
-
- lib/populate_me/control/_public/js/plugin.underwood.js
|
157
|
-
- lib/populate_me/control/views/populate_me_layout.erb
|
158
|
-
- lib/populate_me/ext.rb
|
166
|
+
- Rakefile
|
167
|
+
- example/config.ru
|
168
|
+
- lib/populate_me.rb
|
169
|
+
- lib/populate_me/admin.rb
|
170
|
+
- lib/populate_me/admin/__assets__/css/main.css
|
171
|
+
- lib/populate_me/admin/__assets__/js/columnav.js
|
172
|
+
- lib/populate_me/admin/__assets__/js/main.js
|
173
|
+
- lib/populate_me/admin/__assets__/js/mustache.js
|
174
|
+
- lib/populate_me/admin/__assets__/js/sortable.js
|
175
|
+
- lib/populate_me/admin/views/page.erb
|
176
|
+
- lib/populate_me/api.rb
|
177
|
+
- lib/populate_me/attachment.rb
|
178
|
+
- lib/populate_me/document.rb
|
179
|
+
- lib/populate_me/document_mixins/admin_adapter.rb
|
180
|
+
- lib/populate_me/document_mixins/callbacks.rb
|
181
|
+
- lib/populate_me/document_mixins/outcasting.rb
|
182
|
+
- lib/populate_me/document_mixins/persistence.rb
|
183
|
+
- lib/populate_me/document_mixins/schema.rb
|
184
|
+
- lib/populate_me/document_mixins/typecasting.rb
|
185
|
+
- lib/populate_me/document_mixins/validation.rb
|
186
|
+
- lib/populate_me/file_system_attachment.rb
|
187
|
+
- lib/populate_me/grid_fs_attachment.rb
|
159
188
|
- lib/populate_me/mongo.rb
|
160
|
-
- lib/populate_me/
|
161
|
-
- lib/populate_me/
|
162
|
-
- lib/populate_me/mongo/mutation.rb
|
163
|
-
- lib/populate_me/mongo/plug.rb
|
164
|
-
- lib/populate_me/mongo/stash.rb
|
189
|
+
- lib/populate_me/variation.rb
|
190
|
+
- lib/populate_me/version.rb
|
165
191
|
- populate-me.gemspec
|
166
|
-
- test/
|
167
|
-
- test/
|
192
|
+
- test/helper.rb
|
193
|
+
- test/test_admin.rb
|
194
|
+
- test/test_api.rb
|
195
|
+
- test/test_attachment.rb
|
196
|
+
- test/test_document.rb
|
197
|
+
- test/test_document_admin_adapter.rb
|
198
|
+
- test/test_document_callbacks.rb
|
199
|
+
- test/test_document_persistence.rb
|
200
|
+
- test/test_document_typecasting.rb
|
201
|
+
- test/test_mongo.rb
|
202
|
+
- test/test_variation.rb
|
203
|
+
- test/test_version.rb
|
168
204
|
homepage: https://github.com/mig-hub/populate-me
|
169
205
|
licenses:
|
170
206
|
- MIT
|
171
207
|
metadata: {}
|
172
|
-
post_install_message:
|
208
|
+
post_install_message:
|
173
209
|
rdoc_options: []
|
174
210
|
require_paths:
|
175
|
-
-
|
211
|
+
- lib
|
176
212
|
required_ruby_version: !ruby/object:Gem::Requirement
|
177
213
|
requirements:
|
178
214
|
- - ">="
|
@@ -184,8 +220,21 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
184
220
|
- !ruby/object:Gem::Version
|
185
221
|
version: '0'
|
186
222
|
requirements: []
|
187
|
-
|
188
|
-
|
223
|
+
rubyforge_project:
|
224
|
+
rubygems_version: 2.4.5.1
|
225
|
+
signing_key:
|
189
226
|
specification_version: 4
|
190
|
-
summary:
|
191
|
-
test_files:
|
227
|
+
summary: PopulateMe is an admin system for web applications.
|
228
|
+
test_files:
|
229
|
+
- test/helper.rb
|
230
|
+
- test/test_admin.rb
|
231
|
+
- test/test_api.rb
|
232
|
+
- test/test_attachment.rb
|
233
|
+
- test/test_document.rb
|
234
|
+
- test/test_document_admin_adapter.rb
|
235
|
+
- test/test_document_callbacks.rb
|
236
|
+
- test/test_document_persistence.rb
|
237
|
+
- test/test_document_typecasting.rb
|
238
|
+
- test/test_mongo.rb
|
239
|
+
- test/test_variation.rb
|
240
|
+
- test/test_version.rb
|