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_cli.rb
CHANGED
@@ -21,24 +21,28 @@ module CLIUtils
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def wrapper(args = [], options = {})
|
24
|
-
Dir.mktmpdir
|
25
|
-
|
26
|
-
@git.config('user.name', 'John Doe')
|
27
|
-
@git.config('user.email', 'john@doe.com')
|
24
|
+
path = Dir.mktmpdir 'test-repository'
|
25
|
+
old_pwd = Dir.pwd
|
28
26
|
|
29
|
-
|
30
|
-
|
31
|
-
|
27
|
+
@git = Git.init path
|
28
|
+
@git.config('user.name', 'John Doe')
|
29
|
+
@git.config('user.email', 'john@doe.com')
|
32
30
|
|
33
|
-
|
31
|
+
if options[:remote] != false
|
32
|
+
options[:remote] ||= 'git@github.com:cfillion/test-repository.git'
|
33
|
+
@git.add_remote 'origin', options[:remote]
|
34
|
+
end
|
34
35
|
|
35
|
-
|
36
|
-
['--no-progress', '--no-commit'] + args + ['--', path]
|
36
|
+
options[:setup].call if options.has_key? :setup
|
37
37
|
|
38
|
-
|
39
|
-
|
38
|
+
@indexer = ReaPack::Index::CLI.new \
|
39
|
+
['--no-progress', '--no-commit'] + args + ['--', path]
|
40
|
+
|
41
|
+
yield if block_given?
|
40
42
|
ensure
|
41
43
|
@git = @indexer = nil
|
44
|
+
Dir.chdir old_pwd
|
45
|
+
FileUtils.rm_r path
|
42
46
|
end
|
43
47
|
|
44
48
|
def mkfile(file, content = String.new)
|
@@ -56,11 +60,6 @@ end
|
|
56
60
|
class TestCLI < MiniTest::Test
|
57
61
|
include CLIUtils
|
58
62
|
|
59
|
-
def teardown
|
60
|
-
# who is changing the working directory without restoring it?!
|
61
|
-
Dir.chdir File.dirname(__FILE__)
|
62
|
-
end
|
63
|
-
|
64
63
|
def test_help
|
65
64
|
assert_output /--help/, '' do
|
66
65
|
i = ReaPack::Index::CLI.new ['--help']
|
@@ -75,10 +74,26 @@ class TestCLI < MiniTest::Test
|
|
75
74
|
end
|
76
75
|
end
|
77
76
|
|
77
|
+
def test_help_version
|
78
|
+
stdout, _ = capture_io do
|
79
|
+
i = ReaPack::Index::CLI.new ['--help', '--version']
|
80
|
+
assert_equal true, i.run # does nothing
|
81
|
+
end
|
82
|
+
|
83
|
+
refute_match ReaPack::Index::VERSION.to_s, stdout
|
84
|
+
end
|
85
|
+
|
78
86
|
def test_invalid_option
|
79
|
-
assert_output '', /reapack-
|
87
|
+
assert_output '', /reapack-index: invalid option: --hello-world/i do
|
80
88
|
i = ReaPack::Index::CLI.new ['--hello-world']
|
81
|
-
assert_equal false, i.run
|
89
|
+
assert_equal false, i.run
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
def test_ambiguous_option
|
94
|
+
assert_output '', /reapack-index: ambiguous option: --c/i do
|
95
|
+
i = ReaPack::Index::CLI.new ['--c']
|
96
|
+
assert_equal false, i.run
|
82
97
|
end
|
83
98
|
end
|
84
99
|
|
@@ -90,25 +105,26 @@ class TestCLI < MiniTest::Test
|
|
90
105
|
end
|
91
106
|
end
|
92
107
|
|
93
|
-
def
|
108
|
+
def test_scan_initial_commit
|
94
109
|
wrapper do
|
95
110
|
@git.add mkfile('test1.lua', '@version 1.0')
|
96
111
|
@git.add mkfile('Category/test2.lua', '@version 1.0')
|
97
112
|
@git.add mkfile('Category/Sub/test3.lua', '@version 1.0')
|
98
113
|
@git.commit 'initial commit'
|
99
114
|
|
100
|
-
assert_output /3 new packages
|
115
|
+
assert_output /3 new packages/ do
|
101
116
|
assert_equal true, @indexer.run
|
102
117
|
end
|
103
118
|
|
104
119
|
assert_match 'Category/test2.lua', read_index
|
105
120
|
assert_match "raw/#{@git.log(1).last.sha}/test1.lua", read_index
|
121
|
+
assert_match 'https://github.com/cfillion/test-repository/raw', read_index
|
106
122
|
|
107
123
|
assert_match @git.log(1).last.date.utc.iso8601, read_index
|
108
124
|
end
|
109
125
|
end
|
110
126
|
|
111
|
-
def
|
127
|
+
def test_scan_normal_commit
|
112
128
|
wrapper do
|
113
129
|
@git.add mkfile('README.md', '# Hello World')
|
114
130
|
@git.commit 'initial commit'
|
@@ -118,7 +134,7 @@ class TestCLI < MiniTest::Test
|
|
118
134
|
@git.add mkfile('Category/Sub/test3.lua', '@version 1.0')
|
119
135
|
@git.commit 'second commit'
|
120
136
|
|
121
|
-
assert_output "3 new categories, 3 new packages, 3 new versions\n"
|
137
|
+
assert_output "3 new categories, 3 new packages, 3 new versions\n" do
|
122
138
|
assert_equal true, @indexer.run
|
123
139
|
end
|
124
140
|
|
@@ -135,7 +151,7 @@ class TestCLI < MiniTest::Test
|
|
135
151
|
Dir.mkdir pwd
|
136
152
|
Dir.chdir pwd
|
137
153
|
|
138
|
-
assert_output /1 new package
|
154
|
+
assert_output /1 new package/ do
|
139
155
|
assert_equal true, @indexer.run
|
140
156
|
end
|
141
157
|
|
@@ -191,7 +207,7 @@ class TestCLI < MiniTest::Test
|
|
191
207
|
@git.add mkfile('test.lua', 'no version tag in this script!')
|
192
208
|
@git.commit 'initial commit'
|
193
209
|
|
194
|
-
|
210
|
+
_, stderr = capture_io do
|
195
211
|
assert_equal true, @indexer.run
|
196
212
|
end
|
197
213
|
|
@@ -217,7 +233,7 @@ class TestCLI < MiniTest::Test
|
|
217
233
|
|
218
234
|
mkfile 'index.xml', <<-XML
|
219
235
|
<?xml version="1.0" encoding="utf-8"?>
|
220
|
-
<index version="1" commit="#{@git.log(1).last.sha}"/>
|
236
|
+
<index version="1" name="hello" commit="#{@git.log(1).last.sha}"/>
|
221
237
|
XML
|
222
238
|
}
|
223
239
|
|
@@ -241,31 +257,7 @@ class TestCLI < MiniTest::Test
|
|
241
257
|
|
242
258
|
mkfile 'index.xml', <<-XML
|
243
259
|
<?xml version="1.0" encoding="utf-8"?>
|
244
|
-
<index version="1" commit="hello world"/>
|
245
|
-
XML
|
246
|
-
}
|
247
|
-
|
248
|
-
wrapper [], setup: setup do
|
249
|
-
@git.add mkfile('test2.lua', '@version 1.0')
|
250
|
-
@git.commit 'second commit'
|
251
|
-
|
252
|
-
assert_output nil, '' do
|
253
|
-
assert_equal true, @indexer.run
|
254
|
-
end
|
255
|
-
|
256
|
-
assert_match 'test1.lua', read_index
|
257
|
-
assert_match 'test2.lua', read_index
|
258
|
-
end
|
259
|
-
end
|
260
|
-
|
261
|
-
def test_index_from_invalid
|
262
|
-
setup = proc {
|
263
|
-
@git.add mkfile('test1.lua', '@version 1.0')
|
264
|
-
@git.commit 'initial commit'
|
265
|
-
|
266
|
-
mkfile 'index.xml', <<-XML
|
267
|
-
<?xml version="1.0" encoding="utf-8"?>
|
268
|
-
<index version="1" commit="hello world"/>
|
260
|
+
<index version="1" name="hello" commit="hello world"/>
|
269
261
|
XML
|
270
262
|
}
|
271
263
|
|
@@ -354,7 +346,7 @@ class TestCLI < MiniTest::Test
|
|
354
346
|
|
355
347
|
mkfile 'index.xml', <<-XML
|
356
348
|
<?xml version="1.0" encoding="utf-8"?>
|
357
|
-
<index version="1" commit="#{@git.log(1).last.sha}">
|
349
|
+
<index version="1" name="hello" commit="#{@git.log(1).last.sha}">
|
358
350
|
<category name="Test">
|
359
351
|
<reapack name="test.lua" type="script">
|
360
352
|
<version name="1.0"/>
|
@@ -386,7 +378,7 @@ class TestCLI < MiniTest::Test
|
|
386
378
|
@git.remove script
|
387
379
|
@git.commit 'second commit'
|
388
380
|
|
389
|
-
assert_output /1 removed package/i
|
381
|
+
assert_output /1 removed package/i do
|
390
382
|
assert_equal true, @indexer.run
|
391
383
|
end
|
392
384
|
|
@@ -399,7 +391,7 @@ class TestCLI < MiniTest::Test
|
|
399
391
|
@git.add mkfile('test.lua', '@version 1.0')
|
400
392
|
@git.commit 'initial commit'
|
401
393
|
|
402
|
-
|
394
|
+
capture_io do
|
403
395
|
assert_equal true, @indexer.run
|
404
396
|
end
|
405
397
|
|
@@ -445,7 +437,10 @@ class TestCLI < MiniTest::Test
|
|
445
437
|
@git.add mkfile('.gitkeep')
|
446
438
|
@git.commit 'initial commit'
|
447
439
|
|
448
|
-
|
440
|
+
mkfile 'ignored1'
|
441
|
+
@git.add mkfile('ignored2')
|
442
|
+
|
443
|
+
assert_output("empty index\n", /commit created\n/) { @indexer.run }
|
449
444
|
|
450
445
|
commit = @git.log(1).last
|
451
446
|
assert_equal 'index: empty index', commit.message
|
@@ -453,6 +448,19 @@ class TestCLI < MiniTest::Test
|
|
453
448
|
end
|
454
449
|
end
|
455
450
|
|
451
|
+
def test_create_initial_commit
|
452
|
+
wrapper ['--commit'] do
|
453
|
+
mkfile 'ignored1'
|
454
|
+
@git.add mkfile('ignored2')
|
455
|
+
|
456
|
+
assert_output("empty index\n", /commit created\n/) { @indexer.run }
|
457
|
+
|
458
|
+
commit = @git.log(1).last
|
459
|
+
assert_equal 'index: empty index', commit.message
|
460
|
+
assert_equal ['index.xml'], commit.gtree.files.keys
|
461
|
+
end
|
462
|
+
end
|
463
|
+
|
456
464
|
def test_create_commit_accept
|
457
465
|
wrapper ['--prompt-commit'] do
|
458
466
|
@git.add mkfile('.gitkeep')
|
@@ -460,7 +468,7 @@ class TestCLI < MiniTest::Test
|
|
460
468
|
|
461
469
|
fake_input do |fio|
|
462
470
|
fio.getch = 'y'
|
463
|
-
|
471
|
+
_, stderr = capture_io { @indexer.run }
|
464
472
|
assert_match /commit created/i, stderr
|
465
473
|
end
|
466
474
|
|
@@ -477,7 +485,7 @@ class TestCLI < MiniTest::Test
|
|
477
485
|
|
478
486
|
fake_input do |fio|
|
479
487
|
fio.getch = 'n'
|
480
|
-
|
488
|
+
_, stderr = capture_io { @indexer.run }
|
481
489
|
refute_match /commit created/i, stderr
|
482
490
|
end
|
483
491
|
|
@@ -496,7 +504,7 @@ class TestCLI < MiniTest::Test
|
|
496
504
|
end
|
497
505
|
|
498
506
|
def test_no_config
|
499
|
-
stdout,
|
507
|
+
stdout, _ = capture_io do
|
500
508
|
wrapper ['--no-config'], setup: proc {
|
501
509
|
mkfile '.reapack-index.conf', '--help'
|
502
510
|
}
|
@@ -510,7 +518,7 @@ class TestCLI < MiniTest::Test
|
|
510
518
|
mkfile '.reapack-index.conf', "--verbose\n--no-warnings"
|
511
519
|
}
|
512
520
|
|
513
|
-
|
521
|
+
_, stderr = capture_io do
|
514
522
|
wrapper ['--warnings'], setup: setup do
|
515
523
|
@git.add mkfile('test.lua', 'no version tag in this script!')
|
516
524
|
@git.commit 'initial commit'
|
@@ -524,8 +532,6 @@ class TestCLI < MiniTest::Test
|
|
524
532
|
end
|
525
533
|
|
526
534
|
def test_config_subdirectory
|
527
|
-
pwd = Dir.pwd
|
528
|
-
|
529
535
|
wrapper do
|
530
536
|
mkfile '.reapack-index.conf', '--help'
|
531
537
|
mkfile 'Category/.gitkeep'
|
@@ -536,8 +542,6 @@ class TestCLI < MiniTest::Test
|
|
536
542
|
ReaPack::Index::CLI.new
|
537
543
|
end
|
538
544
|
end
|
539
|
-
ensure
|
540
|
-
Dir.chdir pwd
|
541
545
|
end
|
542
546
|
|
543
547
|
def test_working_directory_with_options
|
@@ -545,22 +549,23 @@ class TestCLI < MiniTest::Test
|
|
545
549
|
@git.add mkfile('README.md', '# Hello World')
|
546
550
|
@git.commit 'initial commit'
|
547
551
|
|
548
|
-
|
549
|
-
pwd = Dir.pwd
|
550
|
-
Dir.chdir @git.dir.to_s
|
552
|
+
Dir.chdir @git.dir.to_s
|
551
553
|
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
end
|
556
|
-
ensure
|
557
|
-
Dir.chdir pwd
|
554
|
+
assert_output '', '' do
|
555
|
+
i2 = ReaPack::Index::CLI.new ['--no-commit', '--quiet']
|
556
|
+
i2.run
|
558
557
|
end
|
559
558
|
end
|
560
559
|
end
|
561
560
|
|
562
561
|
def test_no_such_repository
|
563
|
-
|
562
|
+
no_such_file = if RUBY_PLATFORM =~ /mingw32/
|
563
|
+
/cannot find the path specified/i
|
564
|
+
else
|
565
|
+
/no such file or directory/i
|
566
|
+
end
|
567
|
+
|
568
|
+
assert_output '', no_such_file do
|
564
569
|
i = ReaPack::Index::CLI.new ['/hello/world']
|
565
570
|
assert_equal false, i.run
|
566
571
|
end
|
@@ -598,7 +603,7 @@ class TestCLI < MiniTest::Test
|
|
598
603
|
}
|
599
604
|
|
600
605
|
wrapper ['--progress'], setup: setup do
|
601
|
-
assert_output '',
|
606
|
+
assert_output '', /Nothing to do!\n/ do
|
602
607
|
@indexer.run
|
603
608
|
end
|
604
609
|
end
|
@@ -628,7 +633,7 @@ class TestCLI < MiniTest::Test
|
|
628
633
|
|
629
634
|
def test_website_link
|
630
635
|
wrapper ['-l http://cfillion.tk'] do
|
631
|
-
assert_output "1 new website link, empty index\n"
|
636
|
+
assert_output "1 new website link, empty index\n" do
|
632
637
|
assert_equal true, @indexer.run
|
633
638
|
end
|
634
639
|
|
@@ -636,7 +641,7 @@ class TestCLI < MiniTest::Test
|
|
636
641
|
end
|
637
642
|
end
|
638
643
|
|
639
|
-
def
|
644
|
+
def test_donation_link
|
640
645
|
wrapper ['--donation-link', 'Link Label=http://cfillion.tk'] do
|
641
646
|
assert_output "1 new donation link, empty index\n" do
|
642
647
|
assert_equal true, @indexer.run
|
@@ -648,12 +653,15 @@ class TestCLI < MiniTest::Test
|
|
648
653
|
end
|
649
654
|
|
650
655
|
def test_invalid_link
|
651
|
-
wrapper ['--link', 'shinsekai yori', '--link', '
|
652
|
-
|
653
|
-
|
656
|
+
wrapper ['--link', 'shinsekai yori', '--donation-link', 'hello world',
|
657
|
+
'--link', 'http://cfillion.tk'] do
|
658
|
+
stdout, stderr = capture_io do
|
654
659
|
assert_equal true, @indexer.run
|
655
660
|
end
|
656
661
|
|
662
|
+
assert_equal "1 new website link, empty index\n", stdout
|
663
|
+
assert_match /warning: --link: invalid link: shinsekai yori/i, stderr
|
664
|
+
assert_match /warning: --donation-link: invalid link: hello world/i, stderr
|
657
665
|
assert_match 'rel="website">http://cfillion.tk</link>', read_index
|
658
666
|
end
|
659
667
|
end
|
@@ -697,17 +705,73 @@ class TestCLI < MiniTest::Test
|
|
697
705
|
end
|
698
706
|
|
699
707
|
def test_no_git_remote
|
700
|
-
wrapper [], remote:
|
708
|
+
wrapper [], remote: '*' do
|
709
|
+
# no crash :)
|
701
710
|
assert_output { @indexer.run }
|
702
711
|
end
|
703
712
|
end
|
704
713
|
|
714
|
+
def test_weird_git_remote_url
|
715
|
+
wrapper [], remote: 'scp://hello.world/$path' do
|
716
|
+
_, stderr = capture_io { @indexer.run }
|
717
|
+
refute_match /invalid url/i, stderr
|
718
|
+
refute_match '$path', stderr
|
719
|
+
end
|
720
|
+
end
|
721
|
+
|
722
|
+
def test_auto_url_template_ssh
|
723
|
+
wrapper [], remote: 'git@github.com:User/Repo.git' do
|
724
|
+
@git.add mkfile('hello.lua', '@version 1.0')
|
725
|
+
@git.commit 'initial commit'
|
726
|
+
|
727
|
+
assert_output { @indexer.run }
|
728
|
+
assert_match "https://github.com/User/Repo/raw/#{@git.log(1).last.sha}/hello.lua", read_index
|
729
|
+
end
|
730
|
+
end
|
731
|
+
|
732
|
+
def test_auto_url_template_https
|
733
|
+
wrapper [], remote: 'https://github.com/User/Repo.git' do
|
734
|
+
@git.add mkfile('hello.lua', '@version 1.0')
|
735
|
+
@git.commit 'initial commit'
|
736
|
+
|
737
|
+
assert_output { @indexer.run }
|
738
|
+
assert_match "https://github.com/User/Repo/raw/#{@git.log(1).last.sha}/hello.lua", read_index
|
739
|
+
end
|
740
|
+
end
|
741
|
+
|
742
|
+
def test_url_template
|
743
|
+
wrapper ['--url-template=http://host/$path'], remote: false do
|
744
|
+
@git.add mkfile('hello.lua', '@version 1.0')
|
745
|
+
@git.commit 'initial commit'
|
746
|
+
|
747
|
+
assert_output { @indexer.run }
|
748
|
+
assert_match 'http://host/hello.lua', read_index
|
749
|
+
end
|
750
|
+
end
|
751
|
+
|
752
|
+
def test_url_template_override_git
|
753
|
+
wrapper ['--url-template=http://host/$path'] do
|
754
|
+
@git.add mkfile('hello.lua', '@version 1.0')
|
755
|
+
@git.commit 'initial commit'
|
756
|
+
|
757
|
+
assert_output { @indexer.run }
|
758
|
+
assert_match 'http://host/hello.lua', read_index
|
759
|
+
end
|
760
|
+
end
|
761
|
+
|
762
|
+
def test_url_template_invalid
|
763
|
+
wrapper ['--url-template=minoshiro'] do
|
764
|
+
@git.add mkfile('hello.lua', '@version 1.0')
|
765
|
+
@git.commit 'initial commit'
|
766
|
+
|
767
|
+
_, stderr = capture_io { @indexer.run }
|
768
|
+
assert_match /--url-template: \$path placeholder is missing/i, stderr
|
769
|
+
end
|
770
|
+
end
|
771
|
+
|
705
772
|
def test_about
|
706
773
|
opts = ['--about']
|
707
|
-
|
708
|
-
setup = proc {
|
709
|
-
opts << mkfile('README.md', '# Hello World')
|
710
|
-
}
|
774
|
+
setup = proc { opts << mkfile('README.md', '# Hello World') }
|
711
775
|
|
712
776
|
wrapper opts, setup: setup do
|
713
777
|
assert_output "1 modified metadata, empty index\n" do
|
@@ -843,4 +907,106 @@ test2.lua contains invalid metadata:
|
|
843
907
|
end
|
844
908
|
end
|
845
909
|
end
|
910
|
+
|
911
|
+
def test_check_ignore
|
912
|
+
setup = proc { Dir.chdir @git.dir.to_s }
|
913
|
+
|
914
|
+
expected = <<-STDERR
|
915
|
+
.
|
916
|
+
|
917
|
+
Finished checks for 1 package with 0 failures
|
918
|
+
STDERR
|
919
|
+
|
920
|
+
wrapper ['--check', '--ignore=Hello',
|
921
|
+
'--ignore=Chunky/Bacon.lua', '--ignore=test2.lua'], setup: setup do
|
922
|
+
mkfile 'Hello/World.lua', 'konnichiwa'
|
923
|
+
mkfile 'Chunky/Bacon.lua', 'konnichiwa'
|
924
|
+
mkfile 'Directory/test2.lua', '@version 1.0'
|
925
|
+
|
926
|
+
assert_output nil, expected do
|
927
|
+
@indexer.run
|
928
|
+
end
|
929
|
+
end
|
930
|
+
end
|
931
|
+
|
932
|
+
def test_ignore_config
|
933
|
+
expected = <<-STDERR
|
934
|
+
.
|
935
|
+
|
936
|
+
Finished checks for 1 package with 0 failures
|
937
|
+
STDERR
|
938
|
+
|
939
|
+
setup = proc {
|
940
|
+
mkfile '.reapack-index.conf', <<-CONFIG
|
941
|
+
--ignore=Hello
|
942
|
+
--ignore=Chunky/Bacon.lua
|
943
|
+
--ignore=test2.lua
|
944
|
+
CONFIG
|
945
|
+
}
|
946
|
+
|
947
|
+
wrapper ['--check'], setup: setup do
|
948
|
+
mkfile 'Hello/World.lua', 'konnichiwa'
|
949
|
+
mkfile 'Chunky/Bacon.lua', 'konnichiwa'
|
950
|
+
mkfile 'Directory/test2.lua', '@version 1.0'
|
951
|
+
|
952
|
+
assert_output nil, expected do
|
953
|
+
@indexer.run
|
954
|
+
end
|
955
|
+
end
|
956
|
+
end
|
957
|
+
|
958
|
+
def test_scan_ignore
|
959
|
+
setup = proc { Dir.chdir @git.dir.to_s }
|
960
|
+
|
961
|
+
wrapper ['--ignore=Hello', '--ignore=Chunky/Bacon.lua',
|
962
|
+
'--ignore=test2.lua'], setup: setup do
|
963
|
+
@git.add mkfile('README.md', '# Hello World')
|
964
|
+
@git.commit 'initial commit'
|
965
|
+
|
966
|
+
@git.add mkfile('Hello/World.lua', 'konnichiwa')
|
967
|
+
@git.add mkfile('Chunky/Bacon.lua', 'konnichiwa')
|
968
|
+
@git.add mkfile('Directory/test2.lua', '@version 1.0')
|
969
|
+
@git.commit 'second commit'
|
970
|
+
|
971
|
+
assert_output "1 new category, 1 new package, 1 new version\n" do
|
972
|
+
assert_equal true, @indexer.run
|
973
|
+
end
|
974
|
+
|
975
|
+
refute_match 'Hello/World.lua', read_index
|
976
|
+
refute_match 'Chunky/Bacon.lua', read_index
|
977
|
+
assert_match 'Directory/test2.lua', read_index
|
978
|
+
end
|
979
|
+
end
|
980
|
+
|
981
|
+
def test_noname
|
982
|
+
wrapper do
|
983
|
+
assert_output nil, /The name of this index is unset/i do
|
984
|
+
assert_equal true, @indexer.run
|
985
|
+
end
|
986
|
+
|
987
|
+
refute_match 'name', read_index
|
988
|
+
end
|
989
|
+
end
|
990
|
+
|
991
|
+
def test_set_name
|
992
|
+
wrapper ['--name=Hello World'] do
|
993
|
+
_, stderr = capture_io do
|
994
|
+
assert_equal true, @indexer.run
|
995
|
+
end
|
996
|
+
|
997
|
+
refute_match /The name of this index is unset/i, stderr
|
998
|
+
assert_match 'name="Hello World"', read_index
|
999
|
+
end
|
1000
|
+
end
|
1001
|
+
|
1002
|
+
def test_set_name_invalid
|
1003
|
+
wrapper ['--name=Hello/World'] do
|
1004
|
+
_, stderr = capture_io do
|
1005
|
+
assert_equal true, @indexer.run
|
1006
|
+
end
|
1007
|
+
|
1008
|
+
refute_match /The name of this index is unset/i, stderr
|
1009
|
+
assert_match /invalid name: 'Hello\/World'/i, stderr
|
1010
|
+
end
|
1011
|
+
end
|
846
1012
|
end
|