cdnget 0.3.0 → 1.0.2
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/CHANGES.md +35 -0
- data/MIT-LICENSE +1 -1
- data/README.md +32 -11
- data/Rakefile +2 -2
- data/bin/cdnget +381 -97
- data/cdnget.gemspec +5 -5
- data/lib/cdnget.rb +381 -97
- data/test/cdnget_test.rb +666 -115
- metadata +8 -8
data/test/cdnget_test.rb
CHANGED
@@ -54,6 +54,7 @@ describe CDNGet do
|
|
54
54
|
expected = <<END
|
55
55
|
cdnjs # https://cdnjs.com/
|
56
56
|
jsdelivr # https://www.jsdelivr.com/
|
57
|
+
unpkg # https://unpkg.com/
|
57
58
|
google # https://developers.google.com/speed/libraries/
|
58
59
|
#jquery # https://code.jquery.com/
|
59
60
|
#aspnet # https://www.asp.net/ajax/cdn/
|
@@ -77,15 +78,23 @@ END
|
|
77
78
|
it "(google) lists librareis." do
|
78
79
|
actual = CDNGet::Main.new().run("google")
|
79
80
|
ok {actual} =~ /^jquery /
|
80
|
-
ok {actual} =~ /^angularjs /
|
81
|
+
#ok {actual} =~ /^angularjs /
|
82
|
+
ok {actual} =~ /^swfobject /
|
81
83
|
ok {actual} =~ /^webfont /
|
82
84
|
end
|
83
85
|
|
84
86
|
it "(jsdelivr) lists librareis." do
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
ok {
|
87
|
+
exc = assert_raises(CDNGet::CommandError) do
|
88
|
+
actual = CDNGet::Main.new().run("jsdelivr")
|
89
|
+
end
|
90
|
+
ok {exc.message} == "jsdelivr: cannot list libraries; please specify pattern such as 'jquery*'."
|
91
|
+
end
|
92
|
+
|
93
|
+
it "(unpkg) lists librareis." do
|
94
|
+
exc = assert_raises(CDNGet::CommandError) do
|
95
|
+
actual = CDNGet::Main.new().run("unpkg")
|
96
|
+
end
|
97
|
+
ok {exc.message} == "unpkg: cannot list libraries; please specify pattern such as 'jquery*'."
|
89
98
|
end
|
90
99
|
|
91
100
|
end
|
@@ -113,11 +122,19 @@ END
|
|
113
122
|
it "(jsdelivr) lists libraries starting to pattern." do
|
114
123
|
actual = CDNGet::Main.new().run("jsdelivr", "jquery*")
|
115
124
|
ok {actual} =~ /^jquery #/
|
116
|
-
ok {actual} =~ /^jquery
|
125
|
+
ok {actual} =~ /^jquery-datepicker #/ # match
|
117
126
|
ok {actual} !~ /^angularjs/
|
118
127
|
ok {actual} !~ /^bootstrap/
|
119
128
|
end
|
120
129
|
|
130
|
+
it "(unpkg) lists libraries starting to pattern." do
|
131
|
+
actual = CDNGet::Main.new().run("unpkg", "jquery*")
|
132
|
+
ok {actual} =~ /^jquery #/
|
133
|
+
ok {actual} =~ /^jquery-ui #/ # match
|
134
|
+
ok {actual} !~ /^jquery\.ui /
|
135
|
+
ok {actual} !~ /^bootstrap/
|
136
|
+
end
|
137
|
+
|
121
138
|
end
|
122
139
|
|
123
140
|
|
@@ -143,7 +160,15 @@ END
|
|
143
160
|
it "(jsdelivr) lists libraries ending to pattern." do
|
144
161
|
actual = CDNGet::Main.new().run("jsdelivr", "*jquery")
|
145
162
|
ok {actual} =~ /^jquery #/
|
146
|
-
ok {actual} !~ /^jquery
|
163
|
+
ok {actual} !~ /^jquery-datepicker / # not match
|
164
|
+
ok {actual} !~ /^angularjs/
|
165
|
+
ok {actual} !~ /^bootstrap/
|
166
|
+
end
|
167
|
+
|
168
|
+
it "(unpkg) lists libraries ending to pattern." do
|
169
|
+
actual = CDNGet::Main.new().run("unpkg", "*jquery")
|
170
|
+
ok {actual} =~ /^jquery #/
|
171
|
+
ok {actual} !~ /^jquery-ui #/ # not match
|
147
172
|
ok {actual} !~ /^angularjs/
|
148
173
|
ok {actual} !~ /^bootstrap/
|
149
174
|
end
|
@@ -171,11 +196,21 @@ END
|
|
171
196
|
ok {actual} =~ /^swfobject /
|
172
197
|
end
|
173
198
|
|
174
|
-
it "(
|
199
|
+
it "(jsdelivr) lists libraries including pattern." do
|
175
200
|
actual = CDNGet::Main.new().run("jsdelivr", "*jquery*")
|
176
201
|
ok {actual} =~ /^jquery /
|
177
|
-
ok {actual} =~ /^jasmine
|
178
|
-
ok {actual} =~ /^jquery
|
202
|
+
ok {actual} =~ /^jasmine-jquery /
|
203
|
+
ok {actual} =~ /^jquery-form /
|
204
|
+
ok {actual} !~ /^angularjs/
|
205
|
+
ok {actual} !~ /^react/
|
206
|
+
end
|
207
|
+
|
208
|
+
it "(unpkg) lists libraries including pattern." do
|
209
|
+
actual = CDNGet::Main.new().run("unpkg", "*jquery*")
|
210
|
+
ok {actual} =~ /^jquery /
|
211
|
+
ok {actual} =~ /^jquery-csv /
|
212
|
+
ok {actual} =~ /^jquery\.terminal /
|
213
|
+
ok {actual} =~ /^nd-jquery /
|
179
214
|
ok {actual} !~ /^angularjs/
|
180
215
|
ok {actual} !~ /^bootstrap/
|
181
216
|
end
|
@@ -188,9 +223,12 @@ END
|
|
188
223
|
it "(cdnjs) lists versions of library." do
|
189
224
|
actual = CDNGet::Main.new().run("cdnjs", "jquery")
|
190
225
|
text1 = <<END
|
191
|
-
name:
|
192
|
-
desc:
|
193
|
-
tags:
|
226
|
+
name: jquery
|
227
|
+
desc: JavaScript library for DOM operations
|
228
|
+
tags: jquery, library, ajax, framework, toolkit, popular
|
229
|
+
site: http://jquery.com/
|
230
|
+
info: https://cdnjs.com/libraries/jquery
|
231
|
+
license: MIT
|
194
232
|
versions:
|
195
233
|
END
|
196
234
|
ok {actual}.start_with?(text1)
|
@@ -209,8 +247,9 @@ END
|
|
209
247
|
it "(google) lists versions of library." do
|
210
248
|
actual = CDNGet::Main.new().run("google", "jquery")
|
211
249
|
text1 = <<END
|
212
|
-
name:
|
213
|
-
site:
|
250
|
+
name: jquery
|
251
|
+
site: http://jquery.com/
|
252
|
+
info: https://developers.google.com/speed/libraries/#jquery
|
214
253
|
versions:
|
215
254
|
END
|
216
255
|
ok {actual}.start_with?(text1)
|
@@ -229,18 +268,46 @@ END
|
|
229
268
|
it "(jsdelivr) lists versions of library." do
|
230
269
|
actual = CDNGet::Main.new().run("jsdelivr", "jquery")
|
231
270
|
text1 = <<END
|
232
|
-
name:
|
233
|
-
desc:
|
234
|
-
|
271
|
+
name: jquery
|
272
|
+
desc: JavaScript library for DOM operations
|
273
|
+
tags: jquery, javascript, browser, library
|
274
|
+
site: https://jquery.com
|
275
|
+
info: https://www.jsdelivr.com/package/npm/jquery
|
276
|
+
license: MIT
|
277
|
+
versions:
|
278
|
+
END
|
279
|
+
ok {actual}.start_with?(text1)
|
280
|
+
text2 = <<END
|
281
|
+
- 1.8.2
|
282
|
+
- 1.7.3
|
283
|
+
- 1.7.2
|
284
|
+
- 1.6.3
|
285
|
+
- 1.6.2
|
286
|
+
- 1.5.1
|
287
|
+
END
|
288
|
+
ok {actual}.end_with?(text2)
|
289
|
+
ok {actual} =~ /^ - 2\.2\.0$/
|
290
|
+
ok {actual} =~ /^ - 1\.12\.0$/
|
291
|
+
end
|
292
|
+
|
293
|
+
it "(unpkg) lists versions of library." do
|
294
|
+
actual = CDNGet::Main.new().run("unpkg", "jquery")
|
295
|
+
text1 = <<END
|
296
|
+
name: jquery
|
297
|
+
desc: JavaScript library for DOM operations
|
298
|
+
tags: jquery, javascript, browser, library
|
299
|
+
site: https://jquery.com
|
300
|
+
info: https://unpkg.com/browse/jquery/
|
301
|
+
license: MIT
|
235
302
|
versions:
|
236
303
|
END
|
237
304
|
ok {actual}.start_with?(text1)
|
238
305
|
text2 = <<END
|
306
|
+
- 1.7.3
|
239
307
|
- 1.7.2
|
240
|
-
- 1.
|
241
|
-
- 1.
|
308
|
+
- 1.6.3
|
309
|
+
- 1.6.2
|
242
310
|
- 1.5.1
|
243
|
-
- 1.4.4
|
244
311
|
END
|
245
312
|
ok {actual}.end_with?(text2)
|
246
313
|
ok {actual} =~ /^ - 2\.2\.0$/
|
@@ -261,8 +328,13 @@ END
|
|
261
328
|
end
|
262
329
|
|
263
330
|
it "(jsdelivr) raises error when library name is wrong." do
|
264
|
-
pr = proc { CDNGet::Main.new().run("
|
265
|
-
ok {pr}.raise?(CDNGet::CommandError, "jquery-
|
331
|
+
pr = proc { CDNGet::Main.new().run("jsdelivr", "jquery-foobar") }
|
332
|
+
ok {pr}.raise?(CDNGet::CommandError, "jquery-foobar: Library not found.")
|
333
|
+
end
|
334
|
+
|
335
|
+
it "(unpkg) raises error when library name is wrong." do
|
336
|
+
pr = proc { CDNGet::Main.new().run("unpkg", "jquery-foobar") }
|
337
|
+
ok {pr}.raise?(CDNGet::CommandError, "jquery-foobar: Library not found.")
|
266
338
|
end
|
267
339
|
|
268
340
|
end
|
@@ -274,7 +346,11 @@ END
|
|
274
346
|
expected = <<END
|
275
347
|
name: jquery
|
276
348
|
version: 2.2.0
|
349
|
+
desc: JavaScript library for DOM operations
|
277
350
|
tags: jquery, library, ajax, framework, toolkit, popular
|
351
|
+
site: http://jquery.com/
|
352
|
+
info: https://cdnjs.com/libraries/jquery/2.2.0
|
353
|
+
license: MIT
|
278
354
|
urls:
|
279
355
|
- https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.0/jquery.js
|
280
356
|
- https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.0/jquery.min.js
|
@@ -289,6 +365,7 @@ END
|
|
289
365
|
name: jquery
|
290
366
|
version: 2.2.0
|
291
367
|
site: http://jquery.com/
|
368
|
+
info: https://developers.google.com/speed/libraries/#jquery
|
292
369
|
urls:
|
293
370
|
- https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js
|
294
371
|
END
|
@@ -300,12 +377,162 @@ END
|
|
300
377
|
expected = <<END
|
301
378
|
name: jquery
|
302
379
|
version: 2.2.0
|
380
|
+
desc: JavaScript library for DOM operations
|
381
|
+
tags: jquery, javascript, browser, library
|
382
|
+
site: https://jquery.com
|
383
|
+
info: https://www.jsdelivr.com/package/npm/jquery?version=2.2.0
|
384
|
+
npmpkg: https://registry.npmjs.org/jquery/-/jquery-2.2.0.tgz
|
385
|
+
default: /dist/jquery.min.js
|
386
|
+
license: MIT
|
303
387
|
urls:
|
304
|
-
- https://cdn.jsdelivr.net/jquery
|
305
|
-
- https://cdn.jsdelivr.net/jquery
|
306
|
-
- https://cdn.jsdelivr.net/jquery
|
388
|
+
- https://cdn.jsdelivr.net/npm/jquery@2.2.0/AUTHORS.txt
|
389
|
+
- https://cdn.jsdelivr.net/npm/jquery@2.2.0/bower.json
|
390
|
+
- https://cdn.jsdelivr.net/npm/jquery@2.2.0/dist/jquery.js
|
391
|
+
- https://cdn.jsdelivr.net/npm/jquery@2.2.0/dist/jquery.min.js
|
392
|
+
- https://cdn.jsdelivr.net/npm/jquery@2.2.0/dist/jquery.min.map
|
393
|
+
- https://cdn.jsdelivr.net/npm/jquery@2.2.0/LICENSE.txt
|
307
394
|
END
|
308
395
|
actual = CDNGet::Main.new().run("jsdelivr", "jquery", "2.2.0")
|
396
|
+
ok {actual}.start_with?(expected)
|
397
|
+
end
|
398
|
+
|
399
|
+
it "(unpkg) lists files." do
|
400
|
+
expected = <<END
|
401
|
+
name: jquery
|
402
|
+
version: 3.6.0
|
403
|
+
desc: JavaScript library for DOM operations
|
404
|
+
tags: jquery, javascript, browser, library
|
405
|
+
site: https://jquery.com
|
406
|
+
info: https://unpkg.com/browse/jquery@3.6.0/
|
407
|
+
npmpkg: https://registry.npmjs.org/jquery/-/jquery-3.6.0.tgz
|
408
|
+
default: /dist/jquery.min.js
|
409
|
+
license: MIT
|
410
|
+
urls:
|
411
|
+
- https://unpkg.com/jquery@3.6.0/AUTHORS.txt
|
412
|
+
- https://unpkg.com/jquery@3.6.0/bower.json
|
413
|
+
- https://unpkg.com/jquery@3.6.0/dist/jquery.js
|
414
|
+
- https://unpkg.com/jquery@3.6.0/dist/jquery.min.js
|
415
|
+
- https://unpkg.com/jquery@3.6.0/dist/jquery.min.map
|
416
|
+
- https://unpkg.com/jquery@3.6.0/dist/jquery.slim.js
|
417
|
+
- https://unpkg.com/jquery@3.6.0/dist/jquery.slim.min.js
|
418
|
+
- https://unpkg.com/jquery@3.6.0/dist/jquery.slim.min.map
|
419
|
+
- https://unpkg.com/jquery@3.6.0/external/sizzle/dist/sizzle.js
|
420
|
+
- https://unpkg.com/jquery@3.6.0/external/sizzle/dist/sizzle.min.js
|
421
|
+
- https://unpkg.com/jquery@3.6.0/external/sizzle/dist/sizzle.min.map
|
422
|
+
- https://unpkg.com/jquery@3.6.0/external/sizzle/LICENSE.txt
|
423
|
+
- https://unpkg.com/jquery@3.6.0/LICENSE.txt
|
424
|
+
- https://unpkg.com/jquery@3.6.0/package.json
|
425
|
+
- https://unpkg.com/jquery@3.6.0/README.md
|
426
|
+
- https://unpkg.com/jquery@3.6.0/src/ajax.js
|
427
|
+
- https://unpkg.com/jquery@3.6.0/src/ajax/jsonp.js
|
428
|
+
- https://unpkg.com/jquery@3.6.0/src/ajax/load.js
|
429
|
+
- https://unpkg.com/jquery@3.6.0/src/ajax/script.js
|
430
|
+
- https://unpkg.com/jquery@3.6.0/src/ajax/var/location.js
|
431
|
+
- https://unpkg.com/jquery@3.6.0/src/ajax/var/nonce.js
|
432
|
+
- https://unpkg.com/jquery@3.6.0/src/ajax/var/rquery.js
|
433
|
+
- https://unpkg.com/jquery@3.6.0/src/ajax/xhr.js
|
434
|
+
- https://unpkg.com/jquery@3.6.0/src/attributes.js
|
435
|
+
- https://unpkg.com/jquery@3.6.0/src/attributes/attr.js
|
436
|
+
- https://unpkg.com/jquery@3.6.0/src/attributes/classes.js
|
437
|
+
- https://unpkg.com/jquery@3.6.0/src/attributes/prop.js
|
438
|
+
- https://unpkg.com/jquery@3.6.0/src/attributes/support.js
|
439
|
+
- https://unpkg.com/jquery@3.6.0/src/attributes/val.js
|
440
|
+
- https://unpkg.com/jquery@3.6.0/src/callbacks.js
|
441
|
+
- https://unpkg.com/jquery@3.6.0/src/core.js
|
442
|
+
- https://unpkg.com/jquery@3.6.0/src/core/access.js
|
443
|
+
- https://unpkg.com/jquery@3.6.0/src/core/camelCase.js
|
444
|
+
- https://unpkg.com/jquery@3.6.0/src/core/DOMEval.js
|
445
|
+
- https://unpkg.com/jquery@3.6.0/src/core/init.js
|
446
|
+
- https://unpkg.com/jquery@3.6.0/src/core/isAttached.js
|
447
|
+
- https://unpkg.com/jquery@3.6.0/src/core/nodeName.js
|
448
|
+
- https://unpkg.com/jquery@3.6.0/src/core/parseHTML.js
|
449
|
+
- https://unpkg.com/jquery@3.6.0/src/core/parseXML.js
|
450
|
+
- https://unpkg.com/jquery@3.6.0/src/core/ready.js
|
451
|
+
- https://unpkg.com/jquery@3.6.0/src/core/ready-no-deferred.js
|
452
|
+
- https://unpkg.com/jquery@3.6.0/src/core/readyException.js
|
453
|
+
- https://unpkg.com/jquery@3.6.0/src/core/stripAndCollapse.js
|
454
|
+
- https://unpkg.com/jquery@3.6.0/src/core/support.js
|
455
|
+
- https://unpkg.com/jquery@3.6.0/src/core/toType.js
|
456
|
+
- https://unpkg.com/jquery@3.6.0/src/core/var/rsingleTag.js
|
457
|
+
- https://unpkg.com/jquery@3.6.0/src/css.js
|
458
|
+
- https://unpkg.com/jquery@3.6.0/src/css/addGetHookIf.js
|
459
|
+
- https://unpkg.com/jquery@3.6.0/src/css/adjustCSS.js
|
460
|
+
- https://unpkg.com/jquery@3.6.0/src/css/curCSS.js
|
461
|
+
- https://unpkg.com/jquery@3.6.0/src/css/finalPropName.js
|
462
|
+
- https://unpkg.com/jquery@3.6.0/src/css/hiddenVisibleSelectors.js
|
463
|
+
- https://unpkg.com/jquery@3.6.0/src/css/showHide.js
|
464
|
+
- https://unpkg.com/jquery@3.6.0/src/css/support.js
|
465
|
+
- https://unpkg.com/jquery@3.6.0/src/css/var/cssExpand.js
|
466
|
+
- https://unpkg.com/jquery@3.6.0/src/css/var/getStyles.js
|
467
|
+
- https://unpkg.com/jquery@3.6.0/src/css/var/isHiddenWithinTree.js
|
468
|
+
- https://unpkg.com/jquery@3.6.0/src/css/var/rboxStyle.js
|
469
|
+
- https://unpkg.com/jquery@3.6.0/src/css/var/rnumnonpx.js
|
470
|
+
- https://unpkg.com/jquery@3.6.0/src/css/var/swap.js
|
471
|
+
- https://unpkg.com/jquery@3.6.0/src/data.js
|
472
|
+
- https://unpkg.com/jquery@3.6.0/src/data/Data.js
|
473
|
+
- https://unpkg.com/jquery@3.6.0/src/data/var/acceptData.js
|
474
|
+
- https://unpkg.com/jquery@3.6.0/src/data/var/dataPriv.js
|
475
|
+
- https://unpkg.com/jquery@3.6.0/src/data/var/dataUser.js
|
476
|
+
- https://unpkg.com/jquery@3.6.0/src/deferred.js
|
477
|
+
- https://unpkg.com/jquery@3.6.0/src/deferred/exceptionHook.js
|
478
|
+
- https://unpkg.com/jquery@3.6.0/src/deprecated.js
|
479
|
+
- https://unpkg.com/jquery@3.6.0/src/deprecated/ajax-event-alias.js
|
480
|
+
- https://unpkg.com/jquery@3.6.0/src/deprecated/event.js
|
481
|
+
- https://unpkg.com/jquery@3.6.0/src/dimensions.js
|
482
|
+
- https://unpkg.com/jquery@3.6.0/src/effects.js
|
483
|
+
- https://unpkg.com/jquery@3.6.0/src/effects/animatedSelector.js
|
484
|
+
- https://unpkg.com/jquery@3.6.0/src/effects/Tween.js
|
485
|
+
- https://unpkg.com/jquery@3.6.0/src/event.js
|
486
|
+
- https://unpkg.com/jquery@3.6.0/src/event/focusin.js
|
487
|
+
- https://unpkg.com/jquery@3.6.0/src/event/support.js
|
488
|
+
- https://unpkg.com/jquery@3.6.0/src/event/trigger.js
|
489
|
+
- https://unpkg.com/jquery@3.6.0/src/exports/amd.js
|
490
|
+
- https://unpkg.com/jquery@3.6.0/src/exports/global.js
|
491
|
+
- https://unpkg.com/jquery@3.6.0/src/jquery.js
|
492
|
+
- https://unpkg.com/jquery@3.6.0/src/manipulation.js
|
493
|
+
- https://unpkg.com/jquery@3.6.0/src/manipulation/_evalUrl.js
|
494
|
+
- https://unpkg.com/jquery@3.6.0/src/manipulation/buildFragment.js
|
495
|
+
- https://unpkg.com/jquery@3.6.0/src/manipulation/getAll.js
|
496
|
+
- https://unpkg.com/jquery@3.6.0/src/manipulation/setGlobalEval.js
|
497
|
+
- https://unpkg.com/jquery@3.6.0/src/manipulation/support.js
|
498
|
+
- https://unpkg.com/jquery@3.6.0/src/manipulation/var/rscriptType.js
|
499
|
+
- https://unpkg.com/jquery@3.6.0/src/manipulation/var/rtagName.js
|
500
|
+
- https://unpkg.com/jquery@3.6.0/src/manipulation/wrapMap.js
|
501
|
+
- https://unpkg.com/jquery@3.6.0/src/offset.js
|
502
|
+
- https://unpkg.com/jquery@3.6.0/src/queue.js
|
503
|
+
- https://unpkg.com/jquery@3.6.0/src/queue/delay.js
|
504
|
+
- https://unpkg.com/jquery@3.6.0/src/selector.js
|
505
|
+
- https://unpkg.com/jquery@3.6.0/src/selector-native.js
|
506
|
+
- https://unpkg.com/jquery@3.6.0/src/selector-sizzle.js
|
507
|
+
- https://unpkg.com/jquery@3.6.0/src/serialize.js
|
508
|
+
- https://unpkg.com/jquery@3.6.0/src/traversing.js
|
509
|
+
- https://unpkg.com/jquery@3.6.0/src/traversing/findFilter.js
|
510
|
+
- https://unpkg.com/jquery@3.6.0/src/traversing/var/dir.js
|
511
|
+
- https://unpkg.com/jquery@3.6.0/src/traversing/var/rneedsContext.js
|
512
|
+
- https://unpkg.com/jquery@3.6.0/src/traversing/var/siblings.js
|
513
|
+
- https://unpkg.com/jquery@3.6.0/src/var/arr.js
|
514
|
+
- https://unpkg.com/jquery@3.6.0/src/var/class2type.js
|
515
|
+
- https://unpkg.com/jquery@3.6.0/src/var/document.js
|
516
|
+
- https://unpkg.com/jquery@3.6.0/src/var/documentElement.js
|
517
|
+
- https://unpkg.com/jquery@3.6.0/src/var/flat.js
|
518
|
+
- https://unpkg.com/jquery@3.6.0/src/var/fnToString.js
|
519
|
+
- https://unpkg.com/jquery@3.6.0/src/var/getProto.js
|
520
|
+
- https://unpkg.com/jquery@3.6.0/src/var/hasOwn.js
|
521
|
+
- https://unpkg.com/jquery@3.6.0/src/var/indexOf.js
|
522
|
+
- https://unpkg.com/jquery@3.6.0/src/var/isFunction.js
|
523
|
+
- https://unpkg.com/jquery@3.6.0/src/var/isWindow.js
|
524
|
+
- https://unpkg.com/jquery@3.6.0/src/var/ObjectFunctionString.js
|
525
|
+
- https://unpkg.com/jquery@3.6.0/src/var/pnum.js
|
526
|
+
- https://unpkg.com/jquery@3.6.0/src/var/push.js
|
527
|
+
- https://unpkg.com/jquery@3.6.0/src/var/rcheckableType.js
|
528
|
+
- https://unpkg.com/jquery@3.6.0/src/var/rcssNum.js
|
529
|
+
- https://unpkg.com/jquery@3.6.0/src/var/rnothtmlwhite.js
|
530
|
+
- https://unpkg.com/jquery@3.6.0/src/var/slice.js
|
531
|
+
- https://unpkg.com/jquery@3.6.0/src/var/support.js
|
532
|
+
- https://unpkg.com/jquery@3.6.0/src/var/toString.js
|
533
|
+
- https://unpkg.com/jquery@3.6.0/src/wrap.js
|
534
|
+
END
|
535
|
+
actual = CDNGet::Main.new().run("unpkg", "jquery", "3.6.0")
|
309
536
|
ok {actual} == expected
|
310
537
|
end
|
311
538
|
|
@@ -313,15 +540,19 @@ END
|
|
313
540
|
expected = <<END
|
314
541
|
name: jquery-jcrop
|
315
542
|
version: 0.9.12
|
543
|
+
desc: Jcrop is the quick and easy way to add image cropping functionality to your web application.
|
316
544
|
tags: jquery, crop
|
545
|
+
site: http://deepliquid.com/content/Jcrop.html
|
546
|
+
info: https://cdnjs.com/libraries/jquery-jcrop/0.9.12
|
547
|
+
license: MIT
|
317
548
|
urls:
|
318
549
|
- https://cdnjs.cloudflare.com/ajax/libs/jquery-jcrop/0.9.12/css/Jcrop.gif
|
319
550
|
- https://cdnjs.cloudflare.com/ajax/libs/jquery-jcrop/0.9.12/css/jquery.Jcrop.css
|
320
551
|
- https://cdnjs.cloudflare.com/ajax/libs/jquery-jcrop/0.9.12/css/jquery.Jcrop.min.css
|
321
|
-
- https://cdnjs.cloudflare.com/ajax/libs/jquery-jcrop/0.9.12/js/jquery.color.js
|
322
|
-
- https://cdnjs.cloudflare.com/ajax/libs/jquery-jcrop/0.9.12/js/jquery.color.min.js
|
323
552
|
- https://cdnjs.cloudflare.com/ajax/libs/jquery-jcrop/0.9.12/js/jquery.Jcrop.js
|
324
553
|
- https://cdnjs.cloudflare.com/ajax/libs/jquery-jcrop/0.9.12/js/jquery.Jcrop.min.js
|
554
|
+
- https://cdnjs.cloudflare.com/ajax/libs/jquery-jcrop/0.9.12/js/jquery.color.js
|
555
|
+
- https://cdnjs.cloudflare.com/ajax/libs/jquery-jcrop/0.9.12/js/jquery.color.min.js
|
325
556
|
- https://cdnjs.cloudflare.com/ajax/libs/jquery-jcrop/0.9.12/js/jquery.min.js
|
326
557
|
END
|
327
558
|
actual = CDNGet::Main.new().run("cdnjs", "jquery-jcrop", "0.9.12")
|
@@ -347,7 +578,12 @@ END
|
|
347
578
|
|
348
579
|
it "(jsdelivr) raises error when library name is wrong." do
|
349
580
|
pr = proc { CDNGet::Main.new().run("jsdelivr", "jquery-ui", "1.9.2") }
|
350
|
-
ok {pr}.raise?(CDNGet::CommandError, "jquery-ui: Library not found.")
|
581
|
+
ok {pr}.raise?(CDNGet::CommandError, "jquery-ui@1.9.2: Library or version not found.")
|
582
|
+
end
|
583
|
+
|
584
|
+
it "(unpkg) raises error when library name is wrong." do
|
585
|
+
pr = proc { CDNGet::Main.new().run("unpkg", "jquery-foobar", "1.9.2") }
|
586
|
+
ok {pr}.raise?(CDNGet::CommandError, "jquery-foobar: Library not found.")
|
351
587
|
end
|
352
588
|
|
353
589
|
end
|
@@ -355,13 +591,56 @@ END
|
|
355
591
|
|
356
592
|
describe "cdnget CDN jquery 2.2.0 dir" do
|
357
593
|
|
358
|
-
def _do_download_test1(cdn_code)
|
359
|
-
tmpdir = "tmpdir1"
|
594
|
+
def _do_download_test1(cdn_code, library="jquery", version="2.2.0")
|
595
|
+
@tmpdir = tmpdir = "tmpdir1"
|
596
|
+
Dir.mkdir(tmpdir)
|
597
|
+
sout, serr = capture_io() do
|
598
|
+
actual = CDNGet::Main.new().run(cdn_code, library, version, tmpdir)
|
599
|
+
end
|
600
|
+
yield tmpdir, sout, serr
|
601
|
+
ensure
|
602
|
+
FileUtils.rm_r(tmpdir) if File.directory?(tmpdir)
|
603
|
+
end
|
604
|
+
|
605
|
+
def _do_download_test2(cdn_code, library="jquery-jcrop", version="0.9.12")
|
606
|
+
@tmpdir = tmpdir = "tmpdir1"
|
360
607
|
Dir.mkdir(tmpdir)
|
361
|
-
|
362
|
-
|
363
|
-
|
608
|
+
sout, serr = capture_io() do
|
609
|
+
actual = CDNGet::Main.new().run(cdn_code, library, version, tmpdir)
|
610
|
+
end
|
611
|
+
yield tmpdir, sout, serr
|
612
|
+
ensure
|
613
|
+
FileUtils.rm_r(tmpdir) if File.directory?(tmpdir)
|
614
|
+
end
|
615
|
+
|
616
|
+
def _do_download_test3(cdn_code, libname, version, expected)
|
617
|
+
@tmpdir = tmpdir = "tmpdir1"
|
618
|
+
Dir.mkdir(tmpdir)
|
619
|
+
path = "#{tmpdir}/#{libname}/#{version}"
|
620
|
+
# 1st
|
621
|
+
sout, serr = capture_io() do
|
622
|
+
actual = CDNGet::Main.new().run(cdn_code, libname, version, tmpdir)
|
623
|
+
end
|
624
|
+
ok {serr} == ""
|
625
|
+
ok {sout} == expected
|
626
|
+
# 2nd
|
627
|
+
sout, serr = capture_io() do
|
628
|
+
actual = CDNGet::Main.new().run(cdn_code, libname, version, tmpdir)
|
629
|
+
end
|
630
|
+
ok {serr} == ""
|
631
|
+
ok {sout} == expected.gsub(/(\(Created\))?\n/) {
|
632
|
+
if $1
|
633
|
+
"(Already exists)\n"
|
634
|
+
else
|
635
|
+
" (Unchanged)\n"
|
364
636
|
end
|
637
|
+
}
|
638
|
+
ensure
|
639
|
+
FileUtils.rm_r(tmpdir)
|
640
|
+
end
|
641
|
+
|
642
|
+
it "(cdnjs) downloads files into dir." do
|
643
|
+
_do_download_test1("cdnjs", "jquery", "2.2.0") do |tmpdir, sout, serr|
|
365
644
|
ok {"#{tmpdir}/jquery/2.2.0/jquery.js" }.file_exist?
|
366
645
|
ok {"#{tmpdir}/jquery/2.2.0/jquery.min.js" }.file_exist?
|
367
646
|
ok {"#{tmpdir}/jquery/2.2.0/jquery.min.map"}.file_exist?
|
@@ -370,125 +649,397 @@ END
|
|
370
649
|
#{tmpdir}/jquery/2.2.0/jquery.min.js ... Done (85,589 byte)
|
371
650
|
#{tmpdir}/jquery/2.2.0/jquery.min.map ... Done (129,544 byte)
|
372
651
|
END
|
373
|
-
ensure
|
374
|
-
FileUtils.rm_r(tmpdir)
|
375
652
|
end
|
376
653
|
end
|
377
654
|
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
#{tmpdir}/jquery
|
383
|
-
#{tmpdir}/jquery-jcrop/0.9.12/css/jquery.Jcrop.css ... Done (3,280 byte)
|
384
|
-
#{tmpdir}/jquery-jcrop/0.9.12/css/jquery.Jcrop.min.css ... Done (2,102 byte)
|
385
|
-
#{tmpdir}/jquery-jcrop/0.9.12/js/jquery.color.js ... Done (16,142 byte)
|
386
|
-
#{tmpdir}/jquery-jcrop/0.9.12/js/jquery.color.min.js ... Done (6,845 byte)
|
387
|
-
#{tmpdir}/jquery-jcrop/0.9.12/js/jquery.Jcrop.js ... Done (42,434 byte)
|
388
|
-
#{tmpdir}/jquery-jcrop/0.9.12/js/jquery.Jcrop.min.js ... Done (15,892 byte)
|
389
|
-
#{tmpdir}/jquery-jcrop/0.9.12/js/jquery.min.js ... Done (93,068 byte)
|
655
|
+
it "(google) downloads files into dir." do
|
656
|
+
_do_download_test1("google", "jquery", "2.2.0") do |tmpdir, sout, serr|
|
657
|
+
ok {"#{tmpdir}/jquery/2.2.0/jquery.min.js" }.file_exist?
|
658
|
+
ok {sout} == <<END
|
659
|
+
#{tmpdir}/jquery/2.2.0/jquery.min.js ... Done (85,589 byte)
|
390
660
|
END
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
661
|
+
end
|
662
|
+
end
|
663
|
+
|
664
|
+
it "(jsdelivr) downloads files into dir." do
|
665
|
+
_do_download_test1("jsdelivr", "chibijs", "3.0.9") do |tmpdir, sout, serr|
|
666
|
+
ok {"#{tmpdir}/chibijs@3.0.9/.jshintrc" }.file_exist?
|
667
|
+
ok {"#{tmpdir}/chibijs@3.0.9/.npmignore" }.file_exist?
|
668
|
+
ok {"#{tmpdir}/chibijs@3.0.9/chibi.js" }.file_exist?
|
669
|
+
ok {"#{tmpdir}/chibijs@3.0.9/chibi-min.js" }.file_exist?
|
670
|
+
ok {"#{tmpdir}/chibijs@3.0.9/gulpfile.js" }.file_exist?
|
671
|
+
ok {"#{tmpdir}/chibijs@3.0.9/package.json" }.file_exist?
|
672
|
+
ok {"#{tmpdir}/chibijs@3.0.9/README.md" }.file_exist?
|
673
|
+
ok {"#{tmpdir}/chibijs@3.0.9/tests/runner.html"}.file_exist?
|
674
|
+
ok {sout} == <<END
|
675
|
+
#{tmpdir}/chibijs@3.0.9/.jshintrc ... Done (5,323 byte)
|
676
|
+
#{tmpdir}/chibijs@3.0.9/.npmignore ... Done (46 byte)
|
677
|
+
#{tmpdir}/chibijs@3.0.9/chibi.js ... Done (18,429 byte)
|
678
|
+
#{tmpdir}/chibijs@3.0.9/chibi-min.js ... Done (7,321 byte)
|
679
|
+
#{tmpdir}/chibijs@3.0.9/gulpfile.js ... Done (1,395 byte)
|
680
|
+
#{tmpdir}/chibijs@3.0.9/package.json ... Done (756 byte)
|
681
|
+
#{tmpdir}/chibijs@3.0.9/README.md ... Done (21,283 byte)
|
682
|
+
#{tmpdir}/chibijs@3.0.9/tests/runner.html ... Done (14,302 byte)
|
683
|
+
END
|
684
|
+
end
|
685
|
+
end
|
686
|
+
|
687
|
+
it "(unpkg) downloads files into dir." do
|
688
|
+
_do_download_test1("unpkg", "chibijs", "3.0.9") do |tmpdir, sout, serr|
|
689
|
+
ok {"#{tmpdir}/chibijs@3.0.9/.jshintrc" }.file_exist?
|
690
|
+
ok {"#{tmpdir}/chibijs@3.0.9/.npmignore" }.file_exist?
|
691
|
+
ok {"#{tmpdir}/chibijs@3.0.9/chibi.js" }.file_exist?
|
692
|
+
ok {"#{tmpdir}/chibijs@3.0.9/chibi-min.js" }.file_exist?
|
693
|
+
ok {"#{tmpdir}/chibijs@3.0.9/gulpfile.js" }.file_exist?
|
694
|
+
ok {"#{tmpdir}/chibijs@3.0.9/package.json" }.file_exist?
|
695
|
+
ok {"#{tmpdir}/chibijs@3.0.9/README.md" }.file_exist?
|
696
|
+
ok {"#{tmpdir}/chibijs@3.0.9/tests/runner.html"}.file_exist?
|
697
|
+
ok {sout} == <<END
|
698
|
+
#{tmpdir}/chibijs@3.0.9/.jshintrc ... Done (5,323 byte)
|
699
|
+
#{tmpdir}/chibijs@3.0.9/.npmignore ... Done (46 byte)
|
700
|
+
#{tmpdir}/chibijs@3.0.9/chibi.js ... Done (18,429 byte)
|
701
|
+
#{tmpdir}/chibijs@3.0.9/chibi-min.js ... Done (7,321 byte)
|
702
|
+
#{tmpdir}/chibijs@3.0.9/gulpfile.js ... Done (1,395 byte)
|
703
|
+
#{tmpdir}/chibijs@3.0.9/package.json ... Done (756 byte)
|
704
|
+
#{tmpdir}/chibijs@3.0.9/README.md ... Done (21,283 byte)
|
705
|
+
#{tmpdir}/chibijs@3.0.9/tests/runner.html ... Done (14,302 byte)
|
706
|
+
END
|
707
|
+
end
|
708
|
+
end
|
709
|
+
|
710
|
+
it "(cdnjs) downloads files (containing subdir) into dir." do
|
711
|
+
_do_download_test2("cdnjs", "jquery-jcrop", "0.9.12") do |tmpdir, sout, serr|
|
395
712
|
ok {"#{tmpdir}/jquery-jcrop/0.9.12/css/Jcrop.gif" }.file_exist?
|
396
713
|
ok {"#{tmpdir}/jquery-jcrop/0.9.12/css/jquery.Jcrop.css" }.file_exist?
|
397
714
|
ok {"#{tmpdir}/jquery-jcrop/0.9.12/css/jquery.Jcrop.min.css" }.file_exist?
|
398
|
-
ok {"#{tmpdir}/jquery-jcrop/0.9.12/js/jquery.color.js" }.file_exist?
|
399
|
-
ok {"#{tmpdir}/jquery-jcrop/0.9.12/js/jquery.color.min.js" }.file_exist?
|
400
715
|
ok {"#{tmpdir}/jquery-jcrop/0.9.12/js/jquery.Jcrop.js" }.file_exist?
|
401
716
|
ok {"#{tmpdir}/jquery-jcrop/0.9.12/js/jquery.Jcrop.min.js" }.file_exist?
|
717
|
+
ok {"#{tmpdir}/jquery-jcrop/0.9.12/js/jquery.color.js" }.file_exist?
|
718
|
+
ok {"#{tmpdir}/jquery-jcrop/0.9.12/js/jquery.color.min.js" }.file_exist?
|
402
719
|
ok {"#{tmpdir}/jquery-jcrop/0.9.12/js/jquery.min.js" }.file_exist?
|
403
|
-
ok {sout} ==
|
404
|
-
ensure
|
405
|
-
FileUtils.rm_r(tmpdir)
|
406
|
-
end
|
407
|
-
end
|
408
|
-
|
409
|
-
def _do_download_test3(cdn_code, libname)
|
410
|
-
tmpdir = "tmpdir1"
|
411
|
-
Dir.mkdir(tmpdir)
|
412
|
-
case libname
|
413
|
-
when "jquery"
|
414
|
-
version = "2.2.4"
|
415
|
-
if cdn_code == "google"
|
416
|
-
expected = <<END
|
417
|
-
#{tmpdir}/jquery/2.2.4/jquery.min.js ... Done (85,578 byte)
|
418
|
-
END
|
419
|
-
else
|
420
|
-
expected = <<END
|
421
|
-
#{tmpdir}/jquery/2.2.4/jquery.js ... Done (257,551 byte)
|
422
|
-
#{tmpdir}/jquery/2.2.4/jquery.min.js ... Done (85,578 byte)
|
423
|
-
#{tmpdir}/jquery/2.2.4/jquery.min.map ... Done (129,572 byte)
|
424
|
-
END
|
425
|
-
end
|
426
|
-
when "jquery-jcrop"
|
427
|
-
version = "0.9.12"
|
428
|
-
expected = <<END
|
720
|
+
ok {sout} == <<END
|
429
721
|
#{tmpdir}/jquery-jcrop/0.9.12/css/Jcrop.gif ... Done (329 byte)
|
430
722
|
#{tmpdir}/jquery-jcrop/0.9.12/css/jquery.Jcrop.css ... Done (3,280 byte)
|
431
723
|
#{tmpdir}/jquery-jcrop/0.9.12/css/jquery.Jcrop.min.css ... Done (2,102 byte)
|
432
|
-
#{tmpdir}/jquery-jcrop/0.9.12/js/jquery.color.js ... Done (16,142 byte)
|
433
|
-
#{tmpdir}/jquery-jcrop/0.9.12/js/jquery.color.min.js ... Done (6,845 byte)
|
434
724
|
#{tmpdir}/jquery-jcrop/0.9.12/js/jquery.Jcrop.js ... Done (42,434 byte)
|
435
725
|
#{tmpdir}/jquery-jcrop/0.9.12/js/jquery.Jcrop.min.js ... Done (15,892 byte)
|
726
|
+
#{tmpdir}/jquery-jcrop/0.9.12/js/jquery.color.js ... Done (16,142 byte)
|
727
|
+
#{tmpdir}/jquery-jcrop/0.9.12/js/jquery.color.min.js ... Done (6,845 byte)
|
436
728
|
#{tmpdir}/jquery-jcrop/0.9.12/js/jquery.min.js ... Done (93,068 byte)
|
437
729
|
END
|
438
730
|
end
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
731
|
+
end
|
732
|
+
|
733
|
+
it "(google) downloads files (containing subdir) into dir." do
|
734
|
+
skip("no libraries containing subdirectory")
|
735
|
+
end
|
736
|
+
|
737
|
+
it "(jsdelivr) downloads files (containing subdir) into dir." do
|
738
|
+
_do_download_test2("jsdelivr", "zepto", "1.2.0") do |tmpdir, sout, serr|
|
739
|
+
ok {"#{tmpdir}/zepto@1.2.0/dist/zepto.js" }.file_exist?
|
740
|
+
ok {"#{tmpdir}/zepto@1.2.0/dist/zepto.min.js"}.file_exist?
|
741
|
+
ok {"#{tmpdir}/zepto@1.2.0/MIT-LICENSE" }.file_exist?
|
742
|
+
ok {"#{tmpdir}/zepto@1.2.0/package.json" }.file_exist?
|
743
|
+
ok {"#{tmpdir}/zepto@1.2.0/README.md" }.file_exist?
|
744
|
+
ok {"#{tmpdir}/zepto@1.2.0/src/ajax.js" }.file_exist?
|
745
|
+
ok {"#{tmpdir}/zepto@1.2.0/src/assets.js" }.file_exist?
|
746
|
+
ok {"#{tmpdir}/zepto@1.2.0/src/callbacks.js" }.file_exist?
|
747
|
+
ok {"#{tmpdir}/zepto@1.2.0/src/data.js" }.file_exist?
|
748
|
+
ok {"#{tmpdir}/zepto@1.2.0/src/deferred.js" }.file_exist?
|
749
|
+
ok {"#{tmpdir}/zepto@1.2.0/src/detect.js" }.file_exist?
|
750
|
+
ok {"#{tmpdir}/zepto@1.2.0/src/event.js" }.file_exist?
|
751
|
+
ok {"#{tmpdir}/zepto@1.2.0/src/form.js" }.file_exist?
|
752
|
+
ok {"#{tmpdir}/zepto@1.2.0/src/fx.js" }.file_exist?
|
753
|
+
ok {"#{tmpdir}/zepto@1.2.0/src/fx_methods.js"}.file_exist?
|
754
|
+
ok {"#{tmpdir}/zepto@1.2.0/src/gesture.js" }.file_exist?
|
755
|
+
ok {"#{tmpdir}/zepto@1.2.0/src/ie.js" }.file_exist?
|
756
|
+
ok {"#{tmpdir}/zepto@1.2.0/src/ios3.js" }.file_exist?
|
757
|
+
ok {"#{tmpdir}/zepto@1.2.0/src/selector.js" }.file_exist?
|
758
|
+
ok {"#{tmpdir}/zepto@1.2.0/src/stack.js" }.file_exist?
|
759
|
+
ok {"#{tmpdir}/zepto@1.2.0/src/touch.js" }.file_exist?
|
760
|
+
ok {"#{tmpdir}/zepto@1.2.0/src/zepto.js" }.file_exist?
|
761
|
+
ok {sout} == <<END
|
762
|
+
#{tmpdir}/zepto@1.2.0/dist/zepto.js ... Done (58,707 byte)
|
763
|
+
#{tmpdir}/zepto@1.2.0/dist/zepto.min.js ... Done (26,386 byte)
|
764
|
+
#{tmpdir}/zepto@1.2.0/MIT-LICENSE ... Done (1,081 byte)
|
765
|
+
#{tmpdir}/zepto@1.2.0/package.json ... Done (435 byte)
|
766
|
+
#{tmpdir}/zepto@1.2.0/README.md ... Done (6,711 byte)
|
767
|
+
#{tmpdir}/zepto@1.2.0/src/ajax.js ... Done (13,843 byte)
|
768
|
+
#{tmpdir}/zepto@1.2.0/src/assets.js ... Done (581 byte)
|
769
|
+
#{tmpdir}/zepto@1.2.0/src/callbacks.js ... Done (4,208 byte)
|
770
|
+
#{tmpdir}/zepto@1.2.0/src/data.js ... Done (2,789 byte)
|
771
|
+
#{tmpdir}/zepto@1.2.0/src/deferred.js ... Done (3,846 byte)
|
772
|
+
#{tmpdir}/zepto@1.2.0/src/detect.js ... Done (3,754 byte)
|
773
|
+
#{tmpdir}/zepto@1.2.0/src/event.js ... Done (9,546 byte)
|
774
|
+
#{tmpdir}/zepto@1.2.0/src/form.js ... Done (1,253 byte)
|
775
|
+
#{tmpdir}/zepto@1.2.0/src/fx.js ... Done (4,843 byte)
|
776
|
+
#{tmpdir}/zepto@1.2.0/src/fx_methods.js ... Done (2,102 byte)
|
777
|
+
#{tmpdir}/zepto@1.2.0/src/gesture.js ... Done (1,138 byte)
|
778
|
+
#{tmpdir}/zepto@1.2.0/src/ie.js ... Done (530 byte)
|
779
|
+
#{tmpdir}/zepto@1.2.0/src/ios3.js ... Done (1,140 byte)
|
780
|
+
#{tmpdir}/zepto@1.2.0/src/selector.js ... Done (3,187 byte)
|
781
|
+
#{tmpdir}/zepto@1.2.0/src/stack.js ... Done (560 byte)
|
782
|
+
#{tmpdir}/zepto@1.2.0/src/touch.js ... Done (6,067 byte)
|
783
|
+
#{tmpdir}/zepto@1.2.0/src/zepto.js ... Done (33,889 byte)
|
784
|
+
END
|
785
|
+
end
|
786
|
+
end
|
787
|
+
|
788
|
+
it "(unpkg) downloads files (containing subdir) into dir." do
|
789
|
+
_do_download_test2("unpkg", "react", "17.0.2") do |tmpdir, sout, serr|
|
790
|
+
ok {"#{tmpdir}/react@17.0.2/build-info.json" }.file_exist?
|
791
|
+
ok {"#{tmpdir}/react@17.0.2/cjs/react.development.js" }.file_exist?
|
792
|
+
ok {"#{tmpdir}/react@17.0.2/cjs/react.production.min.js"}.file_exist?
|
793
|
+
ok {"#{tmpdir}/react@17.0.2/cjs/react-jsx-dev-runtime.development.js" }.file_exist?
|
794
|
+
ok {"#{tmpdir}/react@17.0.2/cjs/react-jsx-dev-runtime.production.min.js"}.file_exist?
|
795
|
+
ok {"#{tmpdir}/react@17.0.2/cjs/react-jsx-dev-runtime.profiling.min.js" }.file_exist?
|
796
|
+
ok {"#{tmpdir}/react@17.0.2/cjs/react-jsx-runtime.development.js" }.file_exist?
|
797
|
+
ok {"#{tmpdir}/react@17.0.2/cjs/react-jsx-runtime.production.min.js" }.file_exist?
|
798
|
+
ok {"#{tmpdir}/react@17.0.2/cjs/react-jsx-runtime.profiling.min.js" }.file_exist?
|
799
|
+
ok {"#{tmpdir}/react@17.0.2/index.js" }.file_exist?
|
800
|
+
ok {"#{tmpdir}/react@17.0.2/jsx-dev-runtime.js" }.file_exist?
|
801
|
+
ok {"#{tmpdir}/react@17.0.2/jsx-runtime.js" }.file_exist?
|
802
|
+
ok {"#{tmpdir}/react@17.0.2/LICENSE" }.file_exist?
|
803
|
+
ok {"#{tmpdir}/react@17.0.2/package.json" }.file_exist?
|
804
|
+
ok {"#{tmpdir}/react@17.0.2/README.md" }.file_exist?
|
805
|
+
ok {"#{tmpdir}/react@17.0.2/umd/react.development.js" }.file_exist?
|
806
|
+
ok {"#{tmpdir}/react@17.0.2/umd/react.production.min.js"}.file_exist?
|
807
|
+
ok {"#{tmpdir}/react@17.0.2/umd/react.profiling.min.js" }.file_exist?
|
808
|
+
expected = <<END
|
809
|
+
#{tmpdir}/react@17.0.2/build-info.json ... Done (167 byte)
|
810
|
+
#{tmpdir}/react@17.0.2/cjs/react.development.js ... Done (72,141 byte)
|
811
|
+
#{tmpdir}/react@17.0.2/cjs/react.production.min.js ... Done (6,450 byte)
|
812
|
+
#{tmpdir}/react@17.0.2/cjs/react-jsx-dev-runtime.development.js ... Done (37,753 byte)
|
813
|
+
#{tmpdir}/react@17.0.2/cjs/react-jsx-dev-runtime.production.min.js ... Done (456 byte)
|
814
|
+
#{tmpdir}/react@17.0.2/cjs/react-jsx-dev-runtime.profiling.min.js ... Done (455 byte)
|
815
|
+
#{tmpdir}/react@17.0.2/cjs/react-jsx-runtime.development.js ... Done (38,352 byte)
|
816
|
+
#{tmpdir}/react@17.0.2/cjs/react-jsx-runtime.production.min.js ... Done (962 byte)
|
817
|
+
#{tmpdir}/react@17.0.2/cjs/react-jsx-runtime.profiling.min.js ... Done (961 byte)
|
818
|
+
#{tmpdir}/react@17.0.2/index.js ... Done (190 byte)
|
819
|
+
#{tmpdir}/react@17.0.2/jsx-dev-runtime.js ... Done (222 byte)
|
820
|
+
#{tmpdir}/react@17.0.2/jsx-runtime.js ... Done (214 byte)
|
821
|
+
#{tmpdir}/react@17.0.2/LICENSE ... Done (1,086 byte)
|
822
|
+
#{tmpdir}/react@17.0.2/package.json ... Done (777 byte)
|
823
|
+
#{tmpdir}/react@17.0.2/README.md ... Done (737 byte)
|
824
|
+
#{tmpdir}/react@17.0.2/umd/react.development.js ... Done (105,096 byte)
|
825
|
+
#{tmpdir}/react@17.0.2/umd/react.production.min.js ... Done (11,440 byte)
|
826
|
+
#{tmpdir}/react@17.0.2/umd/react.profiling.min.js ... Done (13,668 byte)
|
827
|
+
END
|
446
828
|
ok {sout} == expected
|
447
|
-
# 2nd
|
448
|
-
sout, serr = capture_io() do
|
449
|
-
actual = CDNGet::Main.new().run(cdn_code, libname, version, tmpdir)
|
450
|
-
end
|
451
|
-
ok {serr} == ""
|
452
|
-
ok {sout} == expected.gsub(/\n/, " (Unchanged)\n")
|
453
|
-
ensure
|
454
|
-
FileUtils.rm_r(tmpdir)
|
455
829
|
end
|
456
830
|
end
|
457
831
|
|
458
|
-
it "(cdnjs)
|
459
|
-
|
832
|
+
it "(cdnjs) doesn't override existing files when they are identical to downloaded files." do
|
833
|
+
tmpdir = "tmpdir1"
|
834
|
+
expected = <<END
|
835
|
+
#{tmpdir}/jquery-jcrop/2.0.4/css/Jcrop.css ... Done (7,401 byte)
|
836
|
+
#{tmpdir}/jquery-jcrop/2.0.4/css/Jcrop.gif ... Done (329 byte)
|
837
|
+
#{tmpdir}/jquery-jcrop/2.0.4/css/Jcrop.min.css ... Done (5,281 byte)
|
838
|
+
#{tmpdir}/jquery-jcrop/2.0.4/js/Jcrop.js ... Done (75,652 byte)
|
839
|
+
#{tmpdir}/jquery-jcrop/2.0.4/js/Jcrop.min.js ... Done (38,379 byte)
|
840
|
+
END
|
841
|
+
_do_download_test3("cdnjs", "jquery-jcrop", "2.0.4", expected)
|
460
842
|
end
|
461
843
|
|
462
|
-
it "(google)
|
463
|
-
|
844
|
+
it "(google) doesn't override existing files when they are identical to downloaded files." do
|
845
|
+
tmpdir = "tmpdir1"
|
846
|
+
expected = <<END
|
847
|
+
#{tmpdir}/jquery/3.6.0/jquery.min.js ... Done (89,501 byte)
|
848
|
+
END
|
849
|
+
_do_download_test3("google", "jquery", "3.6.0", expected)
|
464
850
|
end
|
465
851
|
|
466
|
-
it "(jsdelivr)
|
467
|
-
|
852
|
+
it "(jsdelivr) doesn't override existing files when they are identical to downloaded files." do
|
853
|
+
tmpdir = "tmpdir1"
|
854
|
+
expected = <<END
|
855
|
+
#{tmpdir}/chibijs@3.0.9/.jshintrc ... Done (5,323 byte)
|
856
|
+
#{tmpdir}/chibijs@3.0.9/.npmignore ... Done (46 byte)
|
857
|
+
#{tmpdir}/chibijs@3.0.9/chibi.js ... Done (18,429 byte)
|
858
|
+
#{tmpdir}/chibijs@3.0.9/chibi-min.js ... Done (7,321 byte)
|
859
|
+
#{tmpdir}/chibijs@3.0.9/gulpfile.js ... Done (1,395 byte)
|
860
|
+
#{tmpdir}/chibijs@3.0.9/package.json ... Done (756 byte)
|
861
|
+
#{tmpdir}/chibijs@3.0.9/README.md ... Done (21,283 byte)
|
862
|
+
#{tmpdir}/chibijs@3.0.9/tests/runner.html ... Done (14,302 byte)
|
863
|
+
END
|
864
|
+
_do_download_test3("jsdelivr", "chibijs", "3.0.9", expected)
|
468
865
|
end
|
469
866
|
|
470
|
-
it "(
|
471
|
-
|
867
|
+
it "(unpkg) doesn't override existing files when they are identical to downloaded files." do
|
868
|
+
tmpdir = "tmpdir1"
|
869
|
+
expected = <<END
|
870
|
+
#{tmpdir}/chibijs@3.0.9/.jshintrc ... Done (5,323 byte)
|
871
|
+
#{tmpdir}/chibijs@3.0.9/.npmignore ... Done (46 byte)
|
872
|
+
#{tmpdir}/chibijs@3.0.9/chibi.js ... Done (18,429 byte)
|
873
|
+
#{tmpdir}/chibijs@3.0.9/chibi-min.js ... Done (7,321 byte)
|
874
|
+
#{tmpdir}/chibijs@3.0.9/gulpfile.js ... Done (1,395 byte)
|
875
|
+
#{tmpdir}/chibijs@3.0.9/package.json ... Done (756 byte)
|
876
|
+
#{tmpdir}/chibijs@3.0.9/README.md ... Done (21,283 byte)
|
877
|
+
#{tmpdir}/chibijs@3.0.9/tests/runner.html ... Done (14,302 byte)
|
878
|
+
END
|
879
|
+
_do_download_test3("unpkg", "chibijs", "3.0.9", expected)
|
472
880
|
end
|
473
881
|
|
474
|
-
|
475
|
-
|
882
|
+
end
|
883
|
+
|
884
|
+
|
885
|
+
describe "cdnget CDN swfobject latest" do
|
886
|
+
|
887
|
+
it "(cdnjs) shows latest version." do
|
888
|
+
actual = CDNGet::Main.new("cdnget").run("cdnjs", "swfobject", "latest")
|
889
|
+
ok {actual} == <<END
|
890
|
+
name: swfobject
|
891
|
+
version: 2.2
|
892
|
+
desc: SWFObject is an easy-to-use and standards-friendly method to embed Flash content, which utilizes one small JavaScript file
|
893
|
+
tags: swf, flash
|
894
|
+
site: http://code.google.com/p/swfobject/
|
895
|
+
info: https://cdnjs.com/libraries/swfobject/2.2
|
896
|
+
license: MIT
|
897
|
+
urls:
|
898
|
+
- https://cdnjs.cloudflare.com/ajax/libs/swfobject/2.2/swfobject.js
|
899
|
+
- https://cdnjs.cloudflare.com/ajax/libs/swfobject/2.2/swfobject.min.js
|
900
|
+
END
|
476
901
|
end
|
477
902
|
|
478
|
-
it "(
|
479
|
-
|
903
|
+
it "(google) shows latest version." do
|
904
|
+
actual = CDNGet::Main.new("cdnget").run("google", "swfobject", "latest")
|
905
|
+
ok {actual} == <<END
|
906
|
+
name: swfobject
|
907
|
+
version: 2.2
|
908
|
+
site: https://github.com/swfobject/swfobject
|
909
|
+
info: https://developers.google.com/speed/libraries/#swfobject
|
910
|
+
urls:
|
911
|
+
- https://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js
|
912
|
+
END
|
480
913
|
end
|
481
914
|
|
482
|
-
it "(
|
483
|
-
|
915
|
+
it "(jsdelivr) shows latest version." do
|
916
|
+
actual = CDNGet::Main.new("cdnget").run("jsdelivr", "swfobject", "latest")
|
917
|
+
ok {actual} == <<END
|
918
|
+
name: swfobject
|
919
|
+
version: 2.2.1
|
920
|
+
desc: SWFObject is an easy-to-use and standards-friendly method to embed Flash content, which utilizes one small JavaScript file
|
921
|
+
tags: SWFObject, swf, object, flash, embed, content
|
922
|
+
info: https://www.jsdelivr.com/package/npm/swfobject?version=2.2.1
|
923
|
+
npmpkg: https://registry.npmjs.org/swfobject/-/swfobject-2.2.1.tgz
|
924
|
+
default: /index.min.js
|
925
|
+
license: MIT
|
926
|
+
urls:
|
927
|
+
- https://cdn.jsdelivr.net/npm/swfobject@2.2.1/.npmignore
|
928
|
+
- https://cdn.jsdelivr.net/npm/swfobject@2.2.1/download.sh
|
929
|
+
- https://cdn.jsdelivr.net/npm/swfobject@2.2.1/expressInstall.swf
|
930
|
+
- https://cdn.jsdelivr.net/npm/swfobject@2.2.1/index.js
|
931
|
+
- https://cdn.jsdelivr.net/npm/swfobject@2.2.1/package.json
|
932
|
+
- https://cdn.jsdelivr.net/npm/swfobject@2.2.1/patch.js
|
933
|
+
- https://cdn.jsdelivr.net/npm/swfobject@2.2.1/README.md
|
934
|
+
END
|
484
935
|
end
|
485
936
|
|
486
|
-
it "(
|
487
|
-
|
937
|
+
it "(unpkg) shows latest version." do
|
938
|
+
actual = CDNGet::Main.new("cdnget").run("unpkg", "swfobject", "latest")
|
939
|
+
ok {actual} == <<END
|
940
|
+
name: swfobject
|
941
|
+
version: 2.2.1
|
942
|
+
desc: SWFObject is an easy-to-use and standards-friendly method to embed Flash content, which utilizes one small JavaScript file
|
943
|
+
tags: SWFObject, swf, object, flash, embed, content
|
944
|
+
site: https://github.com/unshiftio/swfobject
|
945
|
+
info: https://unpkg.com/browse/swfobject@2.2.1/
|
946
|
+
npmpkg: https://registry.npmjs.org/swfobject/-/swfobject-2.2.1.tgz
|
947
|
+
default: /index.min.js
|
948
|
+
license: MIT
|
949
|
+
urls:
|
950
|
+
- https://unpkg.com/swfobject@2.2.1/.npmignore
|
951
|
+
- https://unpkg.com/swfobject@2.2.1/download.sh
|
952
|
+
- https://unpkg.com/swfobject@2.2.1/expressInstall.swf
|
953
|
+
- https://unpkg.com/swfobject@2.2.1/index.js
|
954
|
+
- https://unpkg.com/swfobject@2.2.1/package.json
|
955
|
+
- https://unpkg.com/swfobject@2.2.1/patch.js
|
956
|
+
- https://unpkg.com/swfobject@2.2.1/README.md
|
957
|
+
END
|
488
958
|
end
|
489
959
|
|
490
|
-
|
491
|
-
|
960
|
+
end
|
961
|
+
|
962
|
+
|
963
|
+
describe "cdnget CDN swfobject latest dir" do
|
964
|
+
|
965
|
+
before do
|
966
|
+
@tmpdir = "tmpdir1"
|
967
|
+
Dir.mkdir @tmpdir
|
968
|
+
end
|
969
|
+
|
970
|
+
after do
|
971
|
+
FileUtils.rm_rf @tmpdir
|
972
|
+
end
|
973
|
+
|
974
|
+
it "(cdnjs) downlaods latest version." do
|
975
|
+
sout, serr = capture_io do()
|
976
|
+
CDNGet::Main.new("cdnget").run("cdnjs", "swfobject", "latest", @tmpdir)
|
977
|
+
end
|
978
|
+
ok {sout} == <<"END"
|
979
|
+
#{@tmpdir}/swfobject/2.2/swfobject.js ... Done (10,220 byte)
|
980
|
+
#{@tmpdir}/swfobject/2.2/swfobject.min.js ... Done (9,211 byte)
|
981
|
+
END
|
982
|
+
end
|
983
|
+
|
984
|
+
it "(google) downlaods latest version." do
|
985
|
+
sout, serr = capture_io do()
|
986
|
+
CDNGet::Main.new("cdnget").run("google", "swfobject", "latest", @tmpdir)
|
987
|
+
end
|
988
|
+
ok {sout} == <<"END"
|
989
|
+
#{@tmpdir}/swfobject/2.2/swfobject.js ... Done (10,220 byte)
|
990
|
+
END
|
991
|
+
end
|
992
|
+
|
993
|
+
it "(jsdelivr) downlaods latest version." do
|
994
|
+
sout, serr = capture_io do()
|
995
|
+
CDNGet::Main.new("cdnget").run("jsdelivr", "swfobject", "latest", @tmpdir)
|
996
|
+
end
|
997
|
+
ok {sout} == <<"END"
|
998
|
+
#{@tmpdir}/swfobject@2.2.1/.npmignore ... Done (13 byte)
|
999
|
+
#{@tmpdir}/swfobject@2.2.1/download.sh ... Done (517 byte)
|
1000
|
+
#{@tmpdir}/swfobject@2.2.1/expressInstall.swf ... Done (727 byte)
|
1001
|
+
#{@tmpdir}/swfobject@2.2.1/index.js ... Done (10,331 byte)
|
1002
|
+
#{@tmpdir}/swfobject@2.2.1/package.json ... Done (524 byte)
|
1003
|
+
#{@tmpdir}/swfobject@2.2.1/patch.js ... Done (277 byte)
|
1004
|
+
#{@tmpdir}/swfobject@2.2.1/README.md ... Done (764 byte)
|
1005
|
+
END
|
1006
|
+
end
|
1007
|
+
|
1008
|
+
it "(unpkg) downlaods latest version." do
|
1009
|
+
sout, serr = capture_io do()
|
1010
|
+
CDNGet::Main.new("cdnget").run("unpkg", "swfobject", "latest", @tmpdir)
|
1011
|
+
end
|
1012
|
+
ok {sout} == <<"END"
|
1013
|
+
#{@tmpdir}/swfobject@2.2.1/.npmignore ... Done (13 byte)
|
1014
|
+
#{@tmpdir}/swfobject@2.2.1/download.sh ... Done (517 byte)
|
1015
|
+
#{@tmpdir}/swfobject@2.2.1/expressInstall.swf ... Done (727 byte)
|
1016
|
+
#{@tmpdir}/swfobject@2.2.1/index.js ... Done (10,331 byte)
|
1017
|
+
#{@tmpdir}/swfobject@2.2.1/package.json ... Done (524 byte)
|
1018
|
+
#{@tmpdir}/swfobject@2.2.1/patch.js ... Done (277 byte)
|
1019
|
+
#{@tmpdir}/swfobject@2.2.1/README.md ... Done (764 byte)
|
1020
|
+
END
|
1021
|
+
end
|
1022
|
+
|
1023
|
+
end
|
1024
|
+
|
1025
|
+
|
1026
|
+
describe "cdnget CDN bulma 0.9.3 dir" do
|
1027
|
+
|
1028
|
+
before do
|
1029
|
+
@tmpdir = "tmpdir1"
|
1030
|
+
Dir.mkdir @tmpdir
|
1031
|
+
end
|
1032
|
+
|
1033
|
+
after do
|
1034
|
+
FileUtils.rm_rf @tmpdir
|
1035
|
+
end
|
1036
|
+
|
1037
|
+
it "(unpkg) skips '.DS_Store' files." do
|
1038
|
+
sout, serr = capture_io do()
|
1039
|
+
CDNGet::Main.new("cdnget").run("unpkg", "bulma", "0.9.3", @tmpdir)
|
1040
|
+
end
|
1041
|
+
ok {sout}.include?("#{@tmpdir}/bulma@0.9.3/sass/.DS_Store ... Skipped\n")
|
1042
|
+
ok {sout}.include?("#{@tmpdir}/bulma@0.9.3/sass/base/.DS_Store ... Skipped\n")
|
492
1043
|
end
|
493
1044
|
|
494
1045
|
end
|