reapack-index 1.0beta2 → 1.0beta3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/COPYING +674 -0
- data/README.md +8 -4
- data/Rakefile +1 -0
- data/lib/reapack/index.rb +84 -71
- data/lib/reapack/index/cli.rb +75 -154
- data/lib/reapack/index/cli/options.rb +157 -0
- data/lib/reapack/index/gem_version.rb +1 -1
- data/lib/reapack/index/metadata.rb +8 -2
- data/lib/reapack/index/parsers.rb +10 -13
- data/lib/reapack/index/version.rb +1 -1
- data/reapack-index.gemspec +12 -10
- data/setup/StrRep.nsh +59 -0
- data/setup/reapack-index.nsi +52 -29
- data/test/test_cli.rb +250 -84
- data/test/test_index.rb +177 -101
- data/test/test_metadata.rb +1 -4
- data/test/test_package.rb +1 -1
- data/test/test_parsers.rb +32 -1
- metadata +45 -14
data/test/test_index.rb
CHANGED
@@ -9,7 +9,7 @@ class TestIndex < MiniTest::Test
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def teardown
|
12
|
-
File.delete @dummy_path if File.
|
12
|
+
File.delete @dummy_path if File.exist? @dummy_path
|
13
13
|
end
|
14
14
|
|
15
15
|
def test_type_of
|
@@ -19,14 +19,43 @@ class TestIndex < MiniTest::Test
|
|
19
19
|
assert_equal :script, ReaPack::Index.type_of('Track/instrument_track.eel')
|
20
20
|
end
|
21
21
|
|
22
|
-
def
|
23
|
-
|
22
|
+
def test_url_template
|
23
|
+
index = ReaPack::Index.new @dummy_path
|
24
|
+
assert_nil index.url_template
|
25
|
+
|
26
|
+
index.url_template = 'https://get.cfillion.tk/?v=$version&f=$path'
|
27
|
+
assert_equal 'https://get.cfillion.tk/?v=$version&f=$path', index.url_template
|
28
|
+
|
29
|
+
index.url_template = 'https://google.com/$path'
|
30
|
+
assert_equal 'https://google.com/$path', index.url_template
|
31
|
+
|
32
|
+
error = assert_raises ReaPack::Index::Error do
|
33
|
+
index.url_template = 'no path placeholder!'
|
34
|
+
end
|
24
35
|
|
25
|
-
|
26
|
-
|
36
|
+
assert_match '$path', error.message
|
37
|
+
assert_equal 'https://google.com/$path', index.url_template
|
27
38
|
|
28
|
-
|
29
|
-
|
39
|
+
index.url_template = nil
|
40
|
+
assert_nil index.url_template
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_url_template_unsupported_scheme
|
44
|
+
index = ReaPack::Index.new @dummy_path
|
45
|
+
|
46
|
+
error = assert_raises ReaPack::Index::Error do
|
47
|
+
index.url_template = 'scp://cfillion.tk/$path'
|
48
|
+
end
|
49
|
+
|
50
|
+
assert_match /invalid url/i, error.message
|
51
|
+
end
|
52
|
+
|
53
|
+
def test_files
|
54
|
+
index = ReaPack::Index.new @dummy_path
|
55
|
+
assert_empty index.files
|
56
|
+
|
57
|
+
index.files = ['a', 'b/c']
|
58
|
+
assert_equal ['a', 'b/c'], index.files
|
30
59
|
end
|
31
60
|
|
32
61
|
def test_validate_standalone
|
@@ -98,10 +127,9 @@ class TestIndex < MiniTest::Test
|
|
98
127
|
|
99
128
|
def test_new_package
|
100
129
|
index = ReaPack::Index.new @dummy_path
|
101
|
-
assert_empty index.files
|
102
|
-
|
103
130
|
index.files = ['Category/Path/Instrument Track.lua']
|
104
|
-
index.
|
131
|
+
index.url_template = 'http://host/$path'
|
132
|
+
|
105
133
|
index.scan index.files.first, <<-IN
|
106
134
|
@version 1.0
|
107
135
|
@changelog Hello World
|
@@ -122,7 +150,7 @@ class TestIndex < MiniTest::Test
|
|
122
150
|
<reapack name="Instrument Track.lua" type="script">
|
123
151
|
<version name="1.0">
|
124
152
|
<changelog><![CDATA[Hello World]]></changelog>
|
125
|
-
<source platform="all">Category/Path/Instrument%20Track.lua</source>
|
153
|
+
<source platform="all">http://host/Category/Path/Instrument%20Track.lua</source>
|
126
154
|
</version>
|
127
155
|
</reapack>
|
128
156
|
</category>
|
@@ -134,10 +162,9 @@ class TestIndex < MiniTest::Test
|
|
134
162
|
|
135
163
|
def test_default_category
|
136
164
|
index = ReaPack::Index.new @dummy_path
|
137
|
-
assert_empty index.files
|
138
|
-
|
139
165
|
index.files = ['script.lua', 'Hello/World']
|
140
|
-
index.
|
166
|
+
index.url_template = 'http://host/$path'
|
167
|
+
|
141
168
|
index.scan index.files.first, <<-IN
|
142
169
|
@version 1.0
|
143
170
|
@provides Hello/World
|
@@ -149,8 +176,8 @@ class TestIndex < MiniTest::Test
|
|
149
176
|
<category name="Other">
|
150
177
|
<reapack name="script.lua" type="script">
|
151
178
|
<version name="1.0">
|
152
|
-
<source platform="all">script.lua</source>
|
153
|
-
<source platform="all" file="Hello/World">Hello/World</source>
|
179
|
+
<source platform="all">http://host/script.lua</source>
|
180
|
+
<source platform="all" file="Hello/World">http://host/Hello/World</source>
|
154
181
|
</version>
|
155
182
|
</reapack>
|
156
183
|
</category>
|
@@ -164,9 +191,10 @@ class TestIndex < MiniTest::Test
|
|
164
191
|
def test_edit_version_amend_off
|
165
192
|
index = ReaPack::Index.new @real_path
|
166
193
|
assert_equal false, index.amend
|
167
|
-
index.source_pattern = 'http://google.com/$path'
|
168
194
|
|
195
|
+
index.url_template = 'http://google.com/$path'
|
169
196
|
index.files = ['Category Name/Hello World.lua']
|
197
|
+
|
170
198
|
index.scan index.files.first, <<-IN
|
171
199
|
@version 1.0
|
172
200
|
@changelog New Changelog!
|
@@ -181,8 +209,9 @@ class TestIndex < MiniTest::Test
|
|
181
209
|
index.amend = true
|
182
210
|
assert_equal true, index.amend
|
183
211
|
|
184
|
-
index.
|
212
|
+
index.url_template = 'http://google.com/$path'
|
185
213
|
index.files = ['Category Name/Hello World.lua']
|
214
|
+
|
186
215
|
index.scan index.files.first, <<-IN
|
187
216
|
@version 1.0
|
188
217
|
@changelog New Changelog!
|
@@ -212,9 +241,10 @@ class TestIndex < MiniTest::Test
|
|
212
241
|
def test_edit_version_amend_unmodified
|
213
242
|
index = ReaPack::Index.new @real_path
|
214
243
|
index.amend = true
|
215
|
-
index.source_pattern = 'https://google.com/$path'
|
216
244
|
|
245
|
+
index.url_template = 'https://google.com/$path'
|
217
246
|
index.files = ['Category Name/Hello World.lua']
|
247
|
+
|
218
248
|
index.scan index.files.first, <<-IN
|
219
249
|
@version 1.0
|
220
250
|
@author cfillion
|
@@ -227,12 +257,10 @@ class TestIndex < MiniTest::Test
|
|
227
257
|
|
228
258
|
def test_file_unlisted
|
229
259
|
index = ReaPack::Index.new @dummy_path
|
230
|
-
index.
|
260
|
+
index.url_template = 'http://google.com/$path'
|
231
261
|
|
232
262
|
error = assert_raises ReaPack::Index::Error do
|
233
|
-
index.scan 'unlisted.lua',
|
234
|
-
@version 1.0
|
235
|
-
IN
|
263
|
+
index.scan 'unlisted.lua', '@version 1.0'
|
236
264
|
end
|
237
265
|
|
238
266
|
assert_equal 'unlisted.lua: No such file or directory', error.message
|
@@ -246,38 +274,25 @@ class TestIndex < MiniTest::Test
|
|
246
274
|
assert_equal expected, File.read(index.path)
|
247
275
|
end
|
248
276
|
|
249
|
-
def
|
277
|
+
def test_make_url_without_template
|
250
278
|
index = ReaPack::Index.new @dummy_path
|
251
279
|
index.files = ['script.lua']
|
252
280
|
|
253
281
|
error = assert_raises ReaPack::Index::Error do
|
254
|
-
index.scan index.files.first,
|
255
|
-
@version 1.0
|
256
|
-
IN
|
282
|
+
index.scan index.files.first, '@version 1.0'
|
257
283
|
end
|
258
284
|
|
259
|
-
assert_match /
|
260
|
-
end
|
261
|
-
|
262
|
-
def test_source_pattern_no_path
|
263
|
-
index = ReaPack::Index.new @dummy_path
|
264
|
-
index.files = ['script.lua']
|
265
|
-
|
266
|
-
assert_raises ArgumentError do
|
267
|
-
index.source_pattern = 'no path variable here'
|
268
|
-
end
|
285
|
+
assert_match /url template is unset/i, error.message
|
269
286
|
end
|
270
287
|
|
271
|
-
def
|
288
|
+
def test_make_url_defaut_branch
|
272
289
|
index = ReaPack::Index.new @dummy_path
|
273
290
|
index.files = ['Category/script.lua']
|
274
|
-
index.
|
291
|
+
index.url_template = 'http://host/$commit/$path'
|
275
292
|
|
276
293
|
index.commit = nil
|
277
294
|
|
278
|
-
index.scan index.files.first,
|
279
|
-
@version 1.0
|
280
|
-
IN
|
295
|
+
index.scan index.files.first, '@version 1.0'
|
281
296
|
|
282
297
|
expected = <<-XML
|
283
298
|
<?xml version="1.0" encoding="utf-8"?>
|
@@ -285,7 +300,7 @@ class TestIndex < MiniTest::Test
|
|
285
300
|
<category name="Category">
|
286
301
|
<reapack name="script.lua" type="script">
|
287
302
|
<version name="1.0">
|
288
|
-
<source platform="all">master/Category/script.lua</source>
|
303
|
+
<source platform="all">http://host/master/Category/script.lua</source>
|
289
304
|
</version>
|
290
305
|
</reapack>
|
291
306
|
</category>
|
@@ -296,16 +311,14 @@ class TestIndex < MiniTest::Test
|
|
296
311
|
assert_equal expected, File.read(@dummy_path)
|
297
312
|
end
|
298
313
|
|
299
|
-
def
|
314
|
+
def test_make_url_commit
|
300
315
|
index = ReaPack::Index.new @dummy_path
|
301
316
|
index.files = ['Category/script.lua']
|
302
|
-
index.
|
317
|
+
index.url_template = 'http://host/$commit/$path'
|
303
318
|
|
304
319
|
index.commit = @commit
|
305
320
|
|
306
|
-
index.scan index.files.first,
|
307
|
-
@version 1.0
|
308
|
-
IN
|
321
|
+
index.scan index.files.first, '@version 1.0'
|
309
322
|
|
310
323
|
expected = <<-XML
|
311
324
|
<?xml version="1.0" encoding="utf-8"?>
|
@@ -313,7 +326,7 @@ class TestIndex < MiniTest::Test
|
|
313
326
|
<category name="Category">
|
314
327
|
<reapack name="script.lua" type="script">
|
315
328
|
<version name="1.0">
|
316
|
-
<source platform="all"
|
329
|
+
<source platform="all">http://host/#{@commit}/Category/script.lua</source>
|
317
330
|
</version>
|
318
331
|
</reapack>
|
319
332
|
</category>
|
@@ -324,17 +337,9 @@ class TestIndex < MiniTest::Test
|
|
324
337
|
assert_equal expected, File.read(@dummy_path)
|
325
338
|
end
|
326
339
|
|
327
|
-
def test_nil_source_pattern
|
328
|
-
index = ReaPack::Index.new @dummy_path
|
329
|
-
|
330
|
-
error = assert_raises ArgumentError do
|
331
|
-
index.source_pattern = nil
|
332
|
-
end
|
333
|
-
end
|
334
|
-
|
335
340
|
def test_missing_version
|
336
341
|
index = ReaPack::Index.new @dummy_path
|
337
|
-
index.
|
342
|
+
index.url_template = 'http://host/$path'
|
338
343
|
index.files = ['test.lua']
|
339
344
|
|
340
345
|
error = assert_raises ReaPack::Index::Error do
|
@@ -346,7 +351,7 @@ class TestIndex < MiniTest::Test
|
|
346
351
|
|
347
352
|
def test_changelog_boolean
|
348
353
|
index = ReaPack::Index.new @dummy_path
|
349
|
-
index.
|
354
|
+
index.url_template = 'http://host/$path'
|
350
355
|
index.files = ['test.lua']
|
351
356
|
|
352
357
|
error = assert_raises ReaPack::Index::Error do
|
@@ -361,7 +366,7 @@ class TestIndex < MiniTest::Test
|
|
361
366
|
|
362
367
|
def test_author
|
363
368
|
index = ReaPack::Index.new @dummy_path
|
364
|
-
index.
|
369
|
+
index.url_template = 'http://host/$path'
|
365
370
|
index.files = ['Category/script.lua']
|
366
371
|
|
367
372
|
index.scan index.files.first, <<-IN
|
@@ -375,7 +380,7 @@ class TestIndex < MiniTest::Test
|
|
375
380
|
<category name="Category">
|
376
381
|
<reapack name="script.lua" type="script">
|
377
382
|
<version name="1.0" author="cfillion">
|
378
|
-
<source platform="all">Category/script.lua</source>
|
383
|
+
<source platform="all">http://host/Category/script.lua</source>
|
379
384
|
</version>
|
380
385
|
</reapack>
|
381
386
|
</category>
|
@@ -388,7 +393,7 @@ class TestIndex < MiniTest::Test
|
|
388
393
|
|
389
394
|
def test_author_boolean
|
390
395
|
index = ReaPack::Index.new @dummy_path
|
391
|
-
index.
|
396
|
+
index.url_template = 'http://host/$path'
|
392
397
|
index.files = ['test.lua']
|
393
398
|
|
394
399
|
error = assert_raises ReaPack::Index::Error do
|
@@ -403,7 +408,7 @@ class TestIndex < MiniTest::Test
|
|
403
408
|
|
404
409
|
def test_author_multiline
|
405
410
|
index = ReaPack::Index.new @dummy_path
|
406
|
-
index.
|
411
|
+
index.url_template = 'http://host/$path'
|
407
412
|
index.files = ['test.lua']
|
408
413
|
|
409
414
|
error = assert_raises ReaPack::Index::Error do
|
@@ -420,7 +425,7 @@ class TestIndex < MiniTest::Test
|
|
420
425
|
|
421
426
|
def test_provides
|
422
427
|
index = ReaPack::Index.new @dummy_path
|
423
|
-
index.
|
428
|
+
index.url_template = 'http://host/$path'
|
424
429
|
|
425
430
|
index.files = [
|
426
431
|
'Category/script.lua',
|
@@ -441,9 +446,9 @@ class TestIndex < MiniTest::Test
|
|
441
446
|
<category name="Category">
|
442
447
|
<reapack name="script.lua" type="script">
|
443
448
|
<version name="1.0">
|
444
|
-
<source platform="all">Category/script.lua</source>
|
445
|
-
<source platform="all" file="../Resources/unicode.dat">Resources/unicode.dat</source>
|
446
|
-
<source platform="all" file="test.png">Category/test.png</source>
|
449
|
+
<source platform="all">http://host/Category/script.lua</source>
|
450
|
+
<source platform="all" file="../Resources/unicode.dat">http://host/Resources/unicode.dat</source>
|
451
|
+
<source platform="all" file="test.png">http://host/Category/test.png</source>
|
447
452
|
</version>
|
448
453
|
</reapack>
|
449
454
|
</category>
|
@@ -456,8 +461,7 @@ class TestIndex < MiniTest::Test
|
|
456
461
|
|
457
462
|
def test_provides_unlisted
|
458
463
|
index = ReaPack::Index.new @dummy_path
|
459
|
-
index.
|
460
|
-
|
464
|
+
index.url_template = 'http://host/$path'
|
461
465
|
index.files = ['Category/script.lua']
|
462
466
|
|
463
467
|
error = assert_raises ReaPack::Index::Error do
|
@@ -473,7 +477,7 @@ class TestIndex < MiniTest::Test
|
|
473
477
|
|
474
478
|
def test_provides_duplicate
|
475
479
|
index = ReaPack::Index.new @dummy_path
|
476
|
-
index.
|
480
|
+
index.url_template = 'http://host/$path'
|
477
481
|
|
478
482
|
error = assert_raises ReaPack::Index::Error do
|
479
483
|
index.scan 'script.lua', <<-IN
|
@@ -490,7 +494,7 @@ class TestIndex < MiniTest::Test
|
|
490
494
|
|
491
495
|
def test_provides_duplicate_platforms
|
492
496
|
index = ReaPack::Index.new @dummy_path
|
493
|
-
index.
|
497
|
+
index.url_template = 'http://host/$path'
|
494
498
|
index.files = ['script.lua', 'test.png', 'test.png']
|
495
499
|
|
496
500
|
index.scan index.files.first, <<-IN
|
@@ -503,7 +507,7 @@ class TestIndex < MiniTest::Test
|
|
503
507
|
|
504
508
|
def test_invalid_platform
|
505
509
|
index = ReaPack::Index.new @dummy_path
|
506
|
-
index.
|
510
|
+
index.url_template = 'http://host/$path'
|
507
511
|
|
508
512
|
error = assert_raises ReaPack::Index::Error do
|
509
513
|
index.scan 'test.lua', <<-IN
|
@@ -519,7 +523,7 @@ class TestIndex < MiniTest::Test
|
|
519
523
|
|
520
524
|
def test_provides_platform
|
521
525
|
index = ReaPack::Index.new @dummy_path
|
522
|
-
index.
|
526
|
+
index.url_template = 'http://host/$path'
|
523
527
|
|
524
528
|
index.files = [
|
525
529
|
'Category/script.lua',
|
@@ -548,13 +552,13 @@ class TestIndex < MiniTest::Test
|
|
548
552
|
<category name="Category">
|
549
553
|
<reapack name="script.lua" type="script">
|
550
554
|
<version name="1.0">
|
551
|
-
<source platform="all">Category/script.lua</source>
|
552
|
-
<source platform="windows" file="winall.png">Category/winall.png</source>
|
553
|
-
<source platform="win32" file="win32bit.png">Category/win32bit.png</source>
|
554
|
-
<source platform="win64" file="win64bit.png">Category/win64bit.png</source>
|
555
|
-
<source platform="darwin" file="osxall.png">Category/osxall.png</source>
|
556
|
-
<source platform="darwin32" file="osx32bit.png">Category/osx32bit.png</source>
|
557
|
-
<source platform="darwin64" file="osx64bit.png">Category/osx64bit.png</source>
|
555
|
+
<source platform="all">http://host/Category/script.lua</source>
|
556
|
+
<source platform="windows" file="winall.png">http://host/Category/winall.png</source>
|
557
|
+
<source platform="win32" file="win32bit.png">http://host/Category/win32bit.png</source>
|
558
|
+
<source platform="win64" file="win64bit.png">http://host/Category/win64bit.png</source>
|
559
|
+
<source platform="darwin" file="osxall.png">http://host/Category/osxall.png</source>
|
560
|
+
<source platform="darwin32" file="osx32bit.png">http://host/Category/osx32bit.png</source>
|
561
|
+
<source platform="darwin64" file="osx64bit.png">http://host/Category/osx64bit.png</source>
|
558
562
|
</version>
|
559
563
|
</reapack>
|
560
564
|
</category>
|
@@ -567,11 +571,8 @@ class TestIndex < MiniTest::Test
|
|
567
571
|
|
568
572
|
def test_main_platform
|
569
573
|
index = ReaPack::Index.new @dummy_path
|
570
|
-
index.
|
571
|
-
|
572
|
-
index.files = [
|
573
|
-
'Category/script.lua',
|
574
|
-
]
|
574
|
+
index.url_template = 'http://host/$path'
|
575
|
+
index.files = ['Category/script.lua']
|
575
576
|
|
576
577
|
index.scan index.files.first, <<-IN
|
577
578
|
@version 1.0
|
@@ -586,8 +587,8 @@ class TestIndex < MiniTest::Test
|
|
586
587
|
<category name="Category">
|
587
588
|
<reapack name="script.lua" type="script">
|
588
589
|
<version name="1.0">
|
589
|
-
<source platform="darwin">Category/script.lua</source>
|
590
|
-
<source platform="win64">Category/script.lua</source>
|
590
|
+
<source platform="darwin">http://host/Category/script.lua</source>
|
591
|
+
<source platform="win64">http://host/Category/script.lua</source>
|
591
592
|
</version>
|
592
593
|
</reapack>
|
593
594
|
</category>
|
@@ -598,12 +599,9 @@ class TestIndex < MiniTest::Test
|
|
598
599
|
assert_equal expected, File.read(@dummy_path)
|
599
600
|
end
|
600
601
|
|
601
|
-
def
|
602
|
+
def test_provides_custom_url
|
602
603
|
index = ReaPack::Index.new @dummy_path
|
603
|
-
|
604
|
-
index.files = [
|
605
|
-
'Category/script.lua',
|
606
|
-
]
|
604
|
+
index.files = ['Category/script.lua']
|
607
605
|
|
608
606
|
index.scan index.files.first, <<-IN
|
609
607
|
@version 1.0
|
@@ -681,14 +679,12 @@ class TestIndex < MiniTest::Test
|
|
681
679
|
|
682
680
|
def test_version_time
|
683
681
|
index = ReaPack::Index.new @dummy_path
|
684
|
-
index.
|
682
|
+
index.url_template = 'http://host/$path'
|
685
683
|
index.files = ['Category/script.lua']
|
686
684
|
|
687
685
|
index.time = Time.new 2016, 2, 11, 20, 16, 40, -5 * 3600
|
688
686
|
|
689
|
-
index.scan index.files.first,
|
690
|
-
@version 1.0
|
691
|
-
IN
|
687
|
+
index.scan index.files.first, '@version 1.0'
|
692
688
|
|
693
689
|
expected = <<-XML
|
694
690
|
<?xml version="1.0" encoding="utf-8"?>
|
@@ -696,7 +692,7 @@ class TestIndex < MiniTest::Test
|
|
696
692
|
<category name="Category">
|
697
693
|
<reapack name="script.lua" type="script">
|
698
694
|
<version name="1.0" time="2016-02-12T01:16:40Z">
|
699
|
-
<source platform="all">Category/script.lua</source>
|
695
|
+
<source platform="all">http://host/Category/script.lua</source>
|
700
696
|
</version>
|
701
697
|
</reapack>
|
702
698
|
</category>
|
@@ -787,10 +783,7 @@ class TestIndex < MiniTest::Test
|
|
787
783
|
|
788
784
|
def test_extension
|
789
785
|
index = ReaPack::Index.new @dummy_path
|
790
|
-
|
791
|
-
index.files = [
|
792
|
-
'Extensions/reapack.ext',
|
793
|
-
]
|
786
|
+
index.files = ['Extensions/reapack.ext']
|
794
787
|
|
795
788
|
index.scan index.files.first, <<-IN
|
796
789
|
@version 1.0
|
@@ -814,4 +807,87 @@ class TestIndex < MiniTest::Test
|
|
814
807
|
index.write!
|
815
808
|
assert_equal expected, File.read(@dummy_path)
|
816
809
|
end
|
810
|
+
|
811
|
+
def test_effect
|
812
|
+
index = ReaPack::Index.new @dummy_path
|
813
|
+
index.url_template = 'http://host/$path'
|
814
|
+
index.files = ['Dynamics/super_compressor.jsfx']
|
815
|
+
|
816
|
+
index.scan index.files.first, '@version 1.0'
|
817
|
+
|
818
|
+
expected = <<-XML
|
819
|
+
<?xml version="1.0" encoding="utf-8"?>
|
820
|
+
<index version="1">
|
821
|
+
<category name="Dynamics">
|
822
|
+
<reapack name="super_compressor.jsfx" type="effect">
|
823
|
+
<version name="1.0">
|
824
|
+
<source platform="all">http://host/Dynamics/super_compressor.jsfx</source>
|
825
|
+
</version>
|
826
|
+
</reapack>
|
827
|
+
</category>
|
828
|
+
</index>
|
829
|
+
XML
|
830
|
+
|
831
|
+
index.write!
|
832
|
+
assert_equal expected, File.read(@dummy_path)
|
833
|
+
end
|
834
|
+
|
835
|
+
def test_sort_tags
|
836
|
+
index = ReaPack::Index.new @dummy_path
|
837
|
+
index.url_template = 'http://host/$path'
|
838
|
+
index.files = ['Hello/world.lua']
|
839
|
+
|
840
|
+
index.description = 'hello'
|
841
|
+
|
842
|
+
index.scan index.files.first, '@version 1.0'
|
843
|
+
|
844
|
+
index.write!
|
845
|
+
assert_match /<category.+<metadata>/m, File.read(@dummy_path)
|
846
|
+
end
|
847
|
+
|
848
|
+
def test_sort_categories
|
849
|
+
index = ReaPack::Index.new @dummy_path
|
850
|
+
index.url_template = 'http://host/$path'
|
851
|
+
index.files = ['zebra/agent.lua', 'bee/agent.lua']
|
852
|
+
|
853
|
+
index.scan index.files.first, '@version 1.0'
|
854
|
+
index.scan index.files.last, '@version 1.0'
|
855
|
+
|
856
|
+
index.write!
|
857
|
+
assert_match /bee.+zebra/m, File.read(@dummy_path)
|
858
|
+
end
|
859
|
+
|
860
|
+
def test_sort_packages
|
861
|
+
index = ReaPack::Index.new @dummy_path
|
862
|
+
index.url_template = 'http://host/$path'
|
863
|
+
index.files = ['zebra.lua', 'bee.lua']
|
864
|
+
|
865
|
+
index.scan index.files.first, '@version 1.0'
|
866
|
+
index.scan index.files.last, '@version 1.0'
|
867
|
+
|
868
|
+
index.write!
|
869
|
+
assert_match /bee.+zebra/m, File.read(@dummy_path)
|
870
|
+
end
|
871
|
+
|
872
|
+
def test_name
|
873
|
+
index = ReaPack::Index.new @dummy_path
|
874
|
+
assert_empty index.name
|
875
|
+
|
876
|
+
index.name = 'Hello World'
|
877
|
+
assert_equal '1 modified metadata, empty index', index.changelog
|
878
|
+
|
879
|
+
error = assert_raises ReaPack::Index::Error do index.name = '.'; end
|
880
|
+
assert_raises ReaPack::Index::Error do index.name = 'hello/world'; end
|
881
|
+
assert_equal "Invalid name: '.'", error.message
|
882
|
+
|
883
|
+
assert_equal 'Hello World', index.name
|
884
|
+
|
885
|
+
expected = <<-XML
|
886
|
+
<?xml version="1.0" encoding="utf-8"?>
|
887
|
+
<index version="1" name="Hello World"/>
|
888
|
+
XML
|
889
|
+
|
890
|
+
index.write!
|
891
|
+
assert_equal expected, File.read(@dummy_path)
|
892
|
+
end
|
817
893
|
end
|