reapack-index 1.1 → 1.2rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/reapack/index.rb +6 -2
- data/lib/reapack/index/cli/options.rb +4 -0
- data/lib/reapack/index/gem_version.rb +1 -1
- data/lib/reapack/index/git.rb +2 -1
- data/lib/reapack/index/scanner.rb +10 -2
- data/lib/reapack/index/source.rb +9 -1
- data/test/index/test_provides.rb +25 -1
- data/test/index/test_scan.rb +96 -0
- data/test/test_cli.rb +10 -0
- data/test/test_git.rb +4 -0
- data/test/test_index.rb +14 -10
- data/test/test_provides.rb +6 -1
- data/test/test_source.rb +18 -9
- metadata +5 -8
- data/setup/.gitignore +0 -1
- data/setup/StrRep.nsh +0 -59
- data/setup/reapack-index.nsi +0 -189
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db912d74637f26faf3747b1efa0018a0f7c1bd17
|
4
|
+
data.tar.gz: da3003e1d50cc3020bd3d4dc74abcb4c23ca5a97
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce3c8c51d057eaed233bb2bdeff53db11895c8e13ee9a526d69730484967db1fd00d42386defc64d55c2f56dadc9db94ad5bc13ee2151567bb37056da81dfab8
|
7
|
+
data.tar.gz: af451fe2ec7c69a9d50d78e8d460c08064837bd25acff3cc3755e1050ee6f8e940646c8164a73537560b9093b0c100eabdcfbe8bfb9f8c02edcc925ab72e2961
|
data/lib/reapack/index.rb
CHANGED
@@ -39,12 +39,16 @@ class ReaPack::Index
|
|
39
39
|
theme: %w{theme},
|
40
40
|
langpack: %w{reaperlangpack},
|
41
41
|
webinterface: %w{www},
|
42
|
+
projecttpl: %w{rpp},
|
43
|
+
tracktpl: %w{rtracktemplate},
|
44
|
+
midinotenames: %w{txt},
|
45
|
+
autoitem: %w{reaperautoitem},
|
42
46
|
}.freeze
|
43
47
|
|
44
48
|
FS_ROOT = File.expand_path('/').freeze
|
45
49
|
|
46
|
-
NAME_REGEX = /\A[^*\\:<>?\/|"[:cntrl:]]
|
47
|
-
NAME_INVALID = /\A(:?[\.\x20]
|
50
|
+
NAME_REGEX = /\A[^*\\:<>?\/|"[:cntrl:]]+\Z/.freeze
|
51
|
+
NAME_INVALID = /\A(:?[\.\x20].*|.+[\.\x20]|CLOCK\$|COM\d|LPT\d)\Z/i.freeze
|
48
52
|
|
49
53
|
attr_reader :path, :url_template, :cdetector
|
50
54
|
attr_accessor :amend, :commit, :files, :time, :strict
|
@@ -191,6 +191,10 @@ class ReaPack::Index::CLI
|
|
191
191
|
end
|
192
192
|
end.parse! args
|
193
193
|
|
194
|
+
if basepath && !args.empty?
|
195
|
+
raise OptionParser::InvalidOption, "#{args.first}"
|
196
|
+
end
|
197
|
+
|
194
198
|
opts
|
195
199
|
rescue OptionParser::ParseError => e
|
196
200
|
$stderr.puts "#{PROGRAM_NAME}: #{e.message}"
|
data/lib/reapack/index/git.rb
CHANGED
@@ -68,9 +68,10 @@ class ReaPack::Index
|
|
68
68
|
return unless remote
|
69
69
|
|
70
70
|
uri = Gitable::URI.parse remote.url
|
71
|
-
return unless uri.path =~ /\A\/?(?<user>[^\/]+)\/(?<repo>[^\/]+)(\.git)?\Z/
|
71
|
+
return unless uri.path =~ /\A\/?(?<user>[^\/]+)\/(?<repo>[^\/]+)(\.git|\/)?\Z/
|
72
72
|
|
73
73
|
tpl = uri.to_web_uri
|
74
|
+
tpl.path.chomp! '/'
|
74
75
|
tpl.path += '/raw/$commit/$path'
|
75
76
|
|
76
77
|
tpl.to_s
|
@@ -40,6 +40,7 @@ class ReaPack::Index
|
|
40
40
|
:extension_name, :langpack_name, :webinterface_name,
|
41
41
|
:desc, :name] => :description,
|
42
42
|
[:links, :website] => :link,
|
43
|
+
:donate => :donation,
|
43
44
|
:screenshots => :screenshot,
|
44
45
|
}.freeze
|
45
46
|
|
@@ -145,8 +146,15 @@ class ReaPack::Index
|
|
145
146
|
|
146
147
|
files.map {|file|
|
147
148
|
if line.target
|
148
|
-
|
149
|
-
|
149
|
+
if line.target =~ /[\/\\\.]+\z/
|
150
|
+
new_dir = ReaPack::Index.expand line.target, ''
|
151
|
+
base_file = File.basename file
|
152
|
+
target = new_dir.empty? ? base_file : File.join(new_dir, base_file)
|
153
|
+
else
|
154
|
+
target = line.target
|
155
|
+
end
|
156
|
+
|
157
|
+
expanded = ReaPack::Index.expand target, @pkg.category
|
150
158
|
else
|
151
159
|
target = file
|
152
160
|
end
|
data/lib/reapack/index/source.rb
CHANGED
@@ -10,10 +10,12 @@ class ReaPack::Index
|
|
10
10
|
all: nil,
|
11
11
|
windows: :all, win32: :windows, win64: :windows,
|
12
12
|
darwin: :all, darwin32: :darwin, darwin64: :darwin,
|
13
|
+
linux: :all, linux32: :linux, linux64: :linux,
|
13
14
|
}.freeze
|
14
15
|
|
15
16
|
SECTIONS = [
|
16
|
-
:main, :midi_editor
|
17
|
+
:main, :midi_editor, :midi_inlineeditor, :midi_eventlisteditor,
|
18
|
+
:mediaexplorer
|
17
19
|
].freeze
|
18
20
|
|
19
21
|
class << self
|
@@ -59,6 +61,12 @@ class ReaPack::Index
|
|
59
61
|
case pkg.topdir.downcase
|
60
62
|
when 'midi editor'
|
61
63
|
:midi_editor
|
64
|
+
when 'midi inline editor'
|
65
|
+
:midi_inlineeditor
|
66
|
+
when 'midi event list editor'
|
67
|
+
:midi_eventlisteditor
|
68
|
+
when 'media explorer'
|
69
|
+
:mediaexplorer
|
62
70
|
else
|
63
71
|
:main
|
64
72
|
end
|
data/test/index/test_provides.rb
CHANGED
@@ -363,7 +363,9 @@ class TestIndex::Provides < MiniTest::Test
|
|
363
363
|
|
364
364
|
def test_rename_target
|
365
365
|
index = ReaPack::Index.new @dummy_path
|
366
|
-
index.files = ['Category/source.lua', 'Category/source.png'
|
366
|
+
index.files = ['Category/source.lua', 'Category/source.png',
|
367
|
+
'Category/source1.jpg', 'Category/source2.jpg',
|
368
|
+
'Category/sub/source.txt']
|
367
369
|
index.url_template = 'http://host/$path'
|
368
370
|
|
369
371
|
index.scan index.files.first, <<-IN
|
@@ -371,6 +373,8 @@ class TestIndex::Provides < MiniTest::Test
|
|
371
373
|
@provides
|
372
374
|
source.lua > target.lua
|
373
375
|
source.png > target.png
|
376
|
+
source*.jpg > target_dir/
|
377
|
+
sub/source.txt > .
|
374
378
|
IN
|
375
379
|
|
376
380
|
index.write!
|
@@ -379,6 +383,9 @@ class TestIndex::Provides < MiniTest::Test
|
|
379
383
|
|
380
384
|
assert_match 'file="target.lua"', xml
|
381
385
|
assert_match 'file="target.png"', xml
|
386
|
+
assert_match 'file="target_dir/source1.jpg"', xml
|
387
|
+
assert_match 'file="target_dir/source2.jpg"', xml
|
388
|
+
assert_match 'file="source.txt"', xml
|
382
389
|
refute_match 'file="source.png"', xml
|
383
390
|
|
384
391
|
assert_equal 1,
|
@@ -386,6 +393,23 @@ class TestIndex::Provides < MiniTest::Test
|
|
386
393
|
assert_match 'http://host/Category/source.png', xml
|
387
394
|
end
|
388
395
|
|
396
|
+
def test_rename_target_conflict
|
397
|
+
index = ReaPack::Index.new @dummy_path
|
398
|
+
|
399
|
+
# target.lua is not in the same directory
|
400
|
+
index.files = ['Category/target.lua', 'Category/sub/target.lua']
|
401
|
+
index.url_template = 'http://host/$path'
|
402
|
+
|
403
|
+
error = assert_raises ReaPack::Index::Error do
|
404
|
+
index.scan index.files.first, <<-IN
|
405
|
+
@version 1.0
|
406
|
+
@provides . > target.lua
|
407
|
+
@provides sub/target.lua > ./
|
408
|
+
IN
|
409
|
+
end
|
410
|
+
assert_equal "duplicate file 'Category/target.lua'", error.message
|
411
|
+
end
|
412
|
+
|
389
413
|
def test_rename_target_no_wrong_conflict
|
390
414
|
index = ReaPack::Index.new @dummy_path
|
391
415
|
|
data/test/index/test_scan.rb
CHANGED
@@ -279,4 +279,100 @@ class TestIndex::Scan < MiniTest::Test
|
|
279
279
|
index.write!
|
280
280
|
assert_equal expected, File.read(index.path)
|
281
281
|
end
|
282
|
+
|
283
|
+
def test_projecttpl
|
284
|
+
index = ReaPack::Index.new @dummy_path
|
285
|
+
index.url_template = 'http://host/$path'
|
286
|
+
index.files = ['Cat/test.RPP']
|
287
|
+
|
288
|
+
index.scan index.files.first, '@version 1.0'
|
289
|
+
|
290
|
+
expected = <<-XML
|
291
|
+
<?xml version="1.0" encoding="utf-8"?>
|
292
|
+
<index version="1">
|
293
|
+
<category name="Cat">
|
294
|
+
<reapack name="test.RPP" type="projecttpl">
|
295
|
+
<version name="1.0">
|
296
|
+
<source>http://host/Cat/test.RPP</source>
|
297
|
+
</version>
|
298
|
+
</reapack>
|
299
|
+
</category>
|
300
|
+
</index>
|
301
|
+
XML
|
302
|
+
|
303
|
+
index.write!
|
304
|
+
assert_equal expected, File.read(index.path)
|
305
|
+
end
|
306
|
+
|
307
|
+
def test_tracktpl
|
308
|
+
index = ReaPack::Index.new @dummy_path
|
309
|
+
index.url_template = 'http://host/$path'
|
310
|
+
index.files = ['Cat/test.RTrackTemplate']
|
311
|
+
|
312
|
+
index.scan index.files.first, '@version 1.0'
|
313
|
+
|
314
|
+
expected = <<-XML
|
315
|
+
<?xml version="1.0" encoding="utf-8"?>
|
316
|
+
<index version="1">
|
317
|
+
<category name="Cat">
|
318
|
+
<reapack name="test.RTrackTemplate" type="tracktpl">
|
319
|
+
<version name="1.0">
|
320
|
+
<source>http://host/Cat/test.RTrackTemplate</source>
|
321
|
+
</version>
|
322
|
+
</reapack>
|
323
|
+
</category>
|
324
|
+
</index>
|
325
|
+
XML
|
326
|
+
|
327
|
+
index.write!
|
328
|
+
assert_equal expected, File.read(index.path)
|
329
|
+
end
|
330
|
+
|
331
|
+
def test_midinotenames
|
332
|
+
index = ReaPack::Index.new @dummy_path
|
333
|
+
index.url_template = 'http://host/$path'
|
334
|
+
index.files = ['Cat/test.txt']
|
335
|
+
|
336
|
+
index.scan index.files.first, '@version 1.0'
|
337
|
+
|
338
|
+
expected = <<-XML
|
339
|
+
<?xml version="1.0" encoding="utf-8"?>
|
340
|
+
<index version="1">
|
341
|
+
<category name="Cat">
|
342
|
+
<reapack name="test.txt" type="midinotenames">
|
343
|
+
<version name="1.0">
|
344
|
+
<source>http://host/Cat/test.txt</source>
|
345
|
+
</version>
|
346
|
+
</reapack>
|
347
|
+
</category>
|
348
|
+
</index>
|
349
|
+
XML
|
350
|
+
|
351
|
+
index.write!
|
352
|
+
assert_equal expected, File.read(index.path)
|
353
|
+
end
|
354
|
+
|
355
|
+
def test_autoitem
|
356
|
+
index = ReaPack::Index.new @dummy_path
|
357
|
+
index.url_template = 'http://host/$path'
|
358
|
+
index.files = ['Cat/test.ReaperAutoItem']
|
359
|
+
|
360
|
+
index.scan index.files.first, '@version 1.0'
|
361
|
+
|
362
|
+
expected = <<-XML
|
363
|
+
<?xml version="1.0" encoding="utf-8"?>
|
364
|
+
<index version="1">
|
365
|
+
<category name="Cat">
|
366
|
+
<reapack name="test.ReaperAutoItem" type="autoitem">
|
367
|
+
<version name="1.0">
|
368
|
+
<source>http://host/Cat/test.ReaperAutoItem</source>
|
369
|
+
</version>
|
370
|
+
</reapack>
|
371
|
+
</category>
|
372
|
+
</index>
|
373
|
+
XML
|
374
|
+
|
375
|
+
index.write!
|
376
|
+
assert_equal expected, File.read(index.path)
|
377
|
+
end
|
282
378
|
end
|
data/test/test_cli.rb
CHANGED
@@ -170,6 +170,16 @@ class TestCLI < MiniTest::Test
|
|
170
170
|
end
|
171
171
|
end
|
172
172
|
|
173
|
+
def test_config_garbage
|
174
|
+
assert_output '', /invalid option: not$/ do
|
175
|
+
catch :stop do
|
176
|
+
wrapper [], setup: proc {
|
177
|
+
mkfile '.reapack-index.conf', "not an option"
|
178
|
+
}
|
179
|
+
end
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
173
183
|
def test_working_directory_with_options
|
174
184
|
wrapper do
|
175
185
|
@git.create_commit 'initial commit',
|
data/test/test_git.rb
CHANGED
@@ -37,6 +37,10 @@ class TestGit < MiniTest::Test
|
|
37
37
|
assert_match "https://github.com/User/Repo/raw/$commit/$path",
|
38
38
|
@git.guess_url_template
|
39
39
|
|
40
|
+
@repo.remotes.set_url 'origin', 'https://github.com/User/Repo/'
|
41
|
+
assert_match "https://github.com/User/Repo/raw/$commit/$path",
|
42
|
+
@git.guess_url_template
|
43
|
+
|
40
44
|
@repo.remotes.set_url 'origin', 'scp://weird/url'
|
41
45
|
assert_nil @git.guess_url_template
|
42
46
|
end
|
data/test/test_index.rb
CHANGED
@@ -16,16 +16,20 @@ class TestIndex < MiniTest::Test
|
|
16
16
|
].each {|fn| assert_nil ReaPack::Index.type_of(fn) }
|
17
17
|
|
18
18
|
{
|
19
|
-
'Cat/test.lua'
|
20
|
-
'Cat/test.eel'
|
21
|
-
'Cat/test.py'
|
22
|
-
'Cat/test.ext'
|
23
|
-
'Cat/test.jsfx'
|
24
|
-
'Cat/test.data'
|
25
|
-
'Cat/test.theme'
|
26
|
-
'Cat/test.reaperlangpack'
|
27
|
-
'Cat/test.ReaperLangPack'
|
28
|
-
'Cat/test.www'
|
19
|
+
'Cat/test.lua' => :script,
|
20
|
+
'Cat/test.eel' => :script,
|
21
|
+
'Cat/test.py' => :script,
|
22
|
+
'Cat/test.ext' => :extension,
|
23
|
+
'Cat/test.jsfx' => :effect,
|
24
|
+
'Cat/test.data' => :data,
|
25
|
+
'Cat/test.theme' => :theme,
|
26
|
+
'Cat/test.reaperlangpack' => :langpack,
|
27
|
+
'Cat/test.ReaperLangPack' => :langpack,
|
28
|
+
'Cat/test.www' => :webinterface,
|
29
|
+
'Cat/test.RPP' => :projecttpl,
|
30
|
+
'Cat/test.RTrackTemplate' => :tracktpl,
|
31
|
+
'Cate/test.txt' => :midinotenames,
|
32
|
+
'Cate/test.ReaperAutoItem' => :autoitem,
|
29
33
|
}.each {|fn, type|
|
30
34
|
actual = ReaPack::Index.type_of fn
|
31
35
|
assert_equal type, actual,
|
data/test/test_provides.rb
CHANGED
@@ -33,7 +33,9 @@ class TestProvides < MiniTest::Test
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def test_platforms
|
36
|
-
assert_equal [:windows, :win32, :win64,
|
36
|
+
assert_equal [:windows, :win32, :win64,
|
37
|
+
:darwin, :darwin32, :darwin64,
|
38
|
+
:linux, :linux32, :linux64],
|
37
39
|
[
|
38
40
|
'[windows] file',
|
39
41
|
'[win32] file',
|
@@ -41,6 +43,9 @@ class TestProvides < MiniTest::Test
|
|
41
43
|
'[Darwin]file',
|
42
44
|
' [ darwin32 ] file',
|
43
45
|
'[win32 darwin64] file',
|
46
|
+
'[linux] file',
|
47
|
+
'[linux32] file',
|
48
|
+
'[linux64] file',
|
44
49
|
].map {|l| ReaPack::Index::Provides.parse(l).platform }
|
45
50
|
end
|
46
51
|
|
data/test/test_source.rb
CHANGED
@@ -135,14 +135,16 @@ class TestSource < MiniTest::Test
|
|
135
135
|
before = make_node '<version name="1.0"/>'
|
136
136
|
after = <<-XML
|
137
137
|
<version name="1.0">
|
138
|
-
<source main="main midi_editor">http://host/</source>
|
138
|
+
<source main="main mediaexplorer midi_eventlisteditor midi_inlineeditor midi_editor">http://host/</source>
|
139
139
|
</version>
|
140
140
|
XML
|
141
141
|
|
142
142
|
src = ReaPack::Index::Source.new 'http://host/'
|
143
143
|
assert_empty src.sections
|
144
|
-
src.sections = [:midi_editor, :main
|
145
|
-
|
144
|
+
src.sections = [:midi_editor, :main, :midi_inlineeditor,
|
145
|
+
:midi_eventlisteditor, :mediaexplorer]
|
146
|
+
assert_equal [:main, :mediaexplorer, :midi_eventlisteditor,
|
147
|
+
:midi_inlineeditor, :midi_editor], src.sections
|
146
148
|
|
147
149
|
assert_raises ReaPack::Index::Error do
|
148
150
|
src.sections = [:abc]
|
@@ -179,14 +181,21 @@ class TestSource < MiniTest::Test
|
|
179
181
|
|
180
182
|
def test_auto_main_midi_editor
|
181
183
|
pkg = MiniTest::Mock.new
|
182
|
-
pkg.expect :type, :script
|
183
|
-
pkg.expect :topdir, 'MIDI Editor'
|
184
|
-
|
185
184
|
src = ReaPack::Index::Source.new 'http://host/'
|
186
|
-
src.detect_sections pkg
|
187
|
-
assert_equal [:midi_editor], src.sections
|
188
185
|
|
189
|
-
|
186
|
+
{
|
187
|
+
'MIDI Editor' => :midi_editor,
|
188
|
+
'midi editor' => :midi_editor,
|
189
|
+
'midi inline editor' => :midi_inlineeditor,
|
190
|
+
'midi event list editor' => :midi_eventlisteditor,
|
191
|
+
'media explorer' => :mediaexplorer,
|
192
|
+
}.each {|dir, section|
|
193
|
+
pkg.expect :type, :script
|
194
|
+
pkg.expect :topdir, dir
|
195
|
+
src.detect_sections pkg
|
196
|
+
assert_equal [section], src.sections
|
197
|
+
pkg.verify
|
198
|
+
}
|
190
199
|
end
|
191
200
|
|
192
201
|
def test_is_platform
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: reapack-index
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.2rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- cfillion
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-09-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -222,9 +222,6 @@ files:
|
|
222
222
|
- lib/reapack/index/source.rb
|
223
223
|
- lib/reapack/index/version.rb
|
224
224
|
- reapack-index.gemspec
|
225
|
-
- setup/.gitignore
|
226
|
-
- setup/StrRep.nsh
|
227
|
-
- setup/reapack-index.nsi
|
228
225
|
- test/cli/test_check.rb
|
229
226
|
- test/cli/test_metadata.rb
|
230
227
|
- test/cli/test_scan.rb
|
@@ -263,12 +260,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
263
260
|
version: '2.3'
|
264
261
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
265
262
|
requirements:
|
266
|
-
- - "
|
263
|
+
- - ">"
|
267
264
|
- !ruby/object:Gem::Version
|
268
|
-
version:
|
265
|
+
version: 1.3.1
|
269
266
|
requirements: []
|
270
267
|
rubyforge_project:
|
271
|
-
rubygems_version: 2.6.
|
268
|
+
rubygems_version: 2.6.13
|
272
269
|
signing_key:
|
273
270
|
specification_version: 4
|
274
271
|
summary: Package indexer for git-based ReaPack repositories
|
data/setup/.gitignore
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
*.exe
|
data/setup/StrRep.nsh
DELETED
@@ -1,59 +0,0 @@
|
|
1
|
-
; Source: http://nsis.sourceforge.net/StrRep
|
2
|
-
|
3
|
-
!macro StrRep output string old new
|
4
|
-
Push `${string}`
|
5
|
-
Push `${old}`
|
6
|
-
Push `${new}`
|
7
|
-
Call StrRep
|
8
|
-
Pop ${output}
|
9
|
-
!macroend
|
10
|
-
|
11
|
-
Function StrRep
|
12
|
-
Exch $R2 ;new
|
13
|
-
Exch 1
|
14
|
-
Exch $R1 ;old
|
15
|
-
Exch 2
|
16
|
-
Exch $R0 ;string
|
17
|
-
Push $R3
|
18
|
-
Push $R4
|
19
|
-
Push $R5
|
20
|
-
Push $R6
|
21
|
-
Push $R7
|
22
|
-
Push $R8
|
23
|
-
Push $R9
|
24
|
-
|
25
|
-
StrCpy $R3 0
|
26
|
-
StrLen $R4 $R1
|
27
|
-
StrLen $R6 $R0
|
28
|
-
StrLen $R9 $R2
|
29
|
-
loop:
|
30
|
-
StrCpy $R5 $R0 $R4 $R3
|
31
|
-
StrCmp $R5 $R1 found
|
32
|
-
StrCmp $R3 $R6 done
|
33
|
-
IntOp $R3 $R3 + 1 ;move offset by 1 to check the next character
|
34
|
-
Goto loop
|
35
|
-
found:
|
36
|
-
StrCpy $R5 $R0 $R3
|
37
|
-
IntOp $R8 $R3 + $R4
|
38
|
-
StrCpy $R7 $R0 "" $R8
|
39
|
-
StrCpy $R0 $R5$R2$R7
|
40
|
-
StrLen $R6 $R0
|
41
|
-
IntOp $R3 $R3 + $R9 ;move offset by length of the replacement string
|
42
|
-
Goto loop
|
43
|
-
done:
|
44
|
-
|
45
|
-
Pop $R9
|
46
|
-
Pop $R8
|
47
|
-
Pop $R7
|
48
|
-
Pop $R6
|
49
|
-
Pop $R5
|
50
|
-
Pop $R4
|
51
|
-
Pop $R3
|
52
|
-
Push $R0
|
53
|
-
Push $R1
|
54
|
-
Pop $R0
|
55
|
-
Pop $R1
|
56
|
-
Pop $R0
|
57
|
-
Pop $R2
|
58
|
-
Exch $R1
|
59
|
-
FunctionEnd
|
data/setup/reapack-index.nsi
DELETED
@@ -1,189 +0,0 @@
|
|
1
|
-
Unicode true
|
2
|
-
|
3
|
-
!include MUI2.nsh
|
4
|
-
!include Sections.nsh
|
5
|
-
!include StrRep.nsh
|
6
|
-
|
7
|
-
!define VERSION "1.1"
|
8
|
-
!define NAME "reapack-index ${VERSION}"
|
9
|
-
!define LONG_VERSION "0.1.0.0"
|
10
|
-
|
11
|
-
!define RUBY_VERSION "2.3.3"
|
12
|
-
!define RUBYINSTALLER_FILE "rubyinstaller-${RUBY_VERSION}.exe"
|
13
|
-
!define RUBYINSTALLER_URL \
|
14
|
-
"http://dl.bintray.com/oneclick/rubyinstaller/${RUBYINSTALLER_FILE}"
|
15
|
-
|
16
|
-
!define PANDOC_VERSION "1.19.1"
|
17
|
-
!define PANDOC_FILE "pandoc-${PANDOC_VERSION}-windows.msi"
|
18
|
-
!define PANDOC_URL \
|
19
|
-
"https://github.com/jgm/pandoc/releases/download/${PANDOC_VERSION}/${PANDOC_FILE}"
|
20
|
-
|
21
|
-
!define RUGGED_VERSION "0.25.1"
|
22
|
-
!define RUGGED_FILE "rugged-${RUGGED_VERSION}-%PLATFORM%.gem"
|
23
|
-
!define RUGGED_URL \
|
24
|
-
"https://github.com/cfillion/reapack-index/releases/download/v1.1/${RUGGED_FILE}"
|
25
|
-
|
26
|
-
Name "${NAME}"
|
27
|
-
OutFile "reapack-index-${VERSION}.exe"
|
28
|
-
ShowInstDetails show
|
29
|
-
XPStyle on
|
30
|
-
RequestExecutionLevel user
|
31
|
-
SpaceTexts none
|
32
|
-
|
33
|
-
VIProductVersion "${LONG_VERSION}"
|
34
|
-
VIAddVersionKey "ProductName" "${NAME}"
|
35
|
-
VIAddVersionKey "ProductVersion" "${LONG_VERSION}"
|
36
|
-
VIAddVersionKey "FileDescription" "${NAME} Setup"
|
37
|
-
VIAddVersionKey "FileVersion" "${LONG_VERSION}"
|
38
|
-
VIAddVersionKey "LegalCopyright" "Copyright (C) 2015-2017 Christian Fillion"
|
39
|
-
|
40
|
-
!define ABORT_MSG "Installation aborted."
|
41
|
-
|
42
|
-
!insertmacro MUI_PAGE_WELCOME
|
43
|
-
!insertmacro MUI_PAGE_COMPONENTS
|
44
|
-
!insertmacro MUI_PAGE_INSTFILES
|
45
|
-
!insertmacro MUI_PAGE_FINISH
|
46
|
-
|
47
|
-
!insertmacro MUI_LANGUAGE "English"
|
48
|
-
|
49
|
-
!macro DOWNLOAD url file
|
50
|
-
inetc::get /CONNECTTIMEOUT=30000 "${url}" "${file}" /END
|
51
|
-
Pop $0
|
52
|
-
StrCmp $0 "OK" +4
|
53
|
-
DetailPrint "Error while downloading ${url} to ${file}:"
|
54
|
-
DetailPrint " $0"
|
55
|
-
Abort "${ABORT_MSG}"
|
56
|
-
!macroend
|
57
|
-
|
58
|
-
!macro EXEC_GUI cmd basename
|
59
|
-
ExecWait '${cmd}' $0
|
60
|
-
StrCmp $0 "0" +3
|
61
|
-
DetailPrint "${basename} failed with exit code $0"
|
62
|
-
Abort "${ABORT_MSG}"
|
63
|
-
!macroend
|
64
|
-
|
65
|
-
!macro EXEC_CLI cmd basename
|
66
|
-
DetailPrint 'Execute: ${basename}'
|
67
|
-
nsExec::ExecToStack '${cmd}'
|
68
|
-
Pop $0
|
69
|
-
StrCmp $0 "0" +5
|
70
|
-
Pop $1
|
71
|
-
DetailPrint $1
|
72
|
-
DetailPrint "`${basename}` failed with exit code $0"
|
73
|
-
Abort "${ABORT_MSG}"
|
74
|
-
!macroend
|
75
|
-
|
76
|
-
!macro RELOAD_PATH
|
77
|
-
; reload the path to use the one freshly set by the ruby installer
|
78
|
-
ReadRegStr $R1 HKCU "Environment" "Path"
|
79
|
-
System::Call 'Kernel32::SetEnvironmentVariable(t, t) i("Path", R1).r2'
|
80
|
-
!macroend
|
81
|
-
|
82
|
-
Section /o "Ruby for Windows" InstallRuby
|
83
|
-
InitPluginsDir
|
84
|
-
StrCpy $R0 "$PLUGINSDIR\${RUBYINSTALLER_FILE}"
|
85
|
-
!insertmacro DOWNLOAD "${RUBYINSTALLER_URL}" $R0
|
86
|
-
|
87
|
-
DetailPrint "Installing Ruby ${RUBY_VERSION}..."
|
88
|
-
!insertmacro EXEC_GUI '"$R0" /VERYSILENT /TASKS=MODPATH' ${RUBYINSTALLER_FILE}
|
89
|
-
|
90
|
-
!insertmacro RELOAD_PATH
|
91
|
-
|
92
|
-
nsExec::ExecToStack 'ruby -v'
|
93
|
-
Pop $0
|
94
|
-
|
95
|
-
StrCmp $0 "error" 0 +6 ; failed to launch ruby
|
96
|
-
MessageBox MB_YESNO|MB_ICONQUESTION "This computer need to be rebooted \
|
97
|
-
in order to complete the installation process. Reboot now?" IDNO +3
|
98
|
-
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\RunOnce" \
|
99
|
-
"reapack-index installer" "$EXEPATH"
|
100
|
-
Reboot
|
101
|
-
|
102
|
-
DetailPrint "Relaunch reapack-index installer after rebooting your computer."
|
103
|
-
Abort
|
104
|
-
SectionEnd
|
105
|
-
|
106
|
-
Section /o "Rugged (libgit2)" InstallRugged
|
107
|
-
nsExec::ExecToStack '"ruby" -e "print Gem::Platform.local"'
|
108
|
-
Pop $0
|
109
|
-
Pop $1
|
110
|
-
!insertmacro StrRep $R2 "${RUGGED_FILE}" "%PLATFORM%" $1
|
111
|
-
!insertmacro StrRep $R3 "${RUGGED_URL}" "%PLATFORM%" $1
|
112
|
-
|
113
|
-
InitPluginsDir
|
114
|
-
StrCpy $R0 "$PLUGINSDIR\$R2"
|
115
|
-
!insertmacro DOWNLOAD "$R3" $R0
|
116
|
-
|
117
|
-
DetailPrint "Installing rugged/libgit2 with pre-built C extensions..."
|
118
|
-
!insertmacro EXEC_CLI '"cmd" /C gem install $R0' "gem install $R2"
|
119
|
-
SectionEnd
|
120
|
-
|
121
|
-
Section /o "Pandoc" InstallPandoc
|
122
|
-
InitPluginsDir
|
123
|
-
StrCpy $R0 "$PLUGINSDIR\${PANDOC_FILE}"
|
124
|
-
!insertmacro DOWNLOAD "${PANDOC_URL}" $R0
|
125
|
-
|
126
|
-
DetailPrint "Installing Pandoc..."
|
127
|
-
!insertmacro EXEC_GUI '"msiexec" /i $R0 /passive' ${PANDOC_FILE}
|
128
|
-
SectionEnd
|
129
|
-
|
130
|
-
Section "reapack-index" InstallMain
|
131
|
-
SectionIn RO
|
132
|
-
|
133
|
-
DetailPrint "Installing reapack-index... (this can take a while)"
|
134
|
-
|
135
|
-
StrCpy $R0 "gem install reapack-index --version=${VERSION}"
|
136
|
-
!insertmacro EXEC_CLI '"cmd" /C $R0' "$R0"
|
137
|
-
SectionEnd
|
138
|
-
|
139
|
-
Function .onInit
|
140
|
-
!insertmacro RELOAD_PATH
|
141
|
-
nsExec::ExecToStack '"ruby" -e " \
|
142
|
-
rubyver = Gem::Version.new(RUBY_VERSION); \
|
143
|
-
exit 2 unless rubyver >= Gem::Version.new(\"${RUBY_VERSION}\"); \
|
144
|
-
; \
|
145
|
-
spec = Gem::Specification.find_all_by_name(\"rugged\").first; \
|
146
|
-
req = Gem::Requirement.new(\"~> ${RUGGED_VERSION}\"); \
|
147
|
-
exit 3 unless spec && req =~ spec.version'
|
148
|
-
Pop $0
|
149
|
-
|
150
|
-
StrCmp $0 "2" +2 0 ; ruby out of date
|
151
|
-
StrCmp $0 "error" 0 +6 ; failed to launch ruby
|
152
|
-
SectionGetFlags ${InstallRuby} $1
|
153
|
-
IntOp $1 $1 | ${SF_SELECTED}
|
154
|
-
IntOp $1 $1 | ${SF_RO}
|
155
|
-
SectionSetFlags ${InstallRuby} $1
|
156
|
-
Goto +2 ; also install rugged
|
157
|
-
|
158
|
-
StrCmp $0 "3" 0 +5 ; rugged missing/out of date
|
159
|
-
SectionGetFlags ${InstallRugged} $1
|
160
|
-
IntOp $1 $1 | ${SF_SELECTED}
|
161
|
-
IntOp $1 $1 | ${SF_RO}
|
162
|
-
SectionSetFlags ${InstallRugged} $1
|
163
|
-
|
164
|
-
nsExec::ExecToStack '"pandoc" --version'
|
165
|
-
Pop $0
|
166
|
-
|
167
|
-
StrCmp $0 "error" 0 +4 ; failed to launch pandoc
|
168
|
-
SectionGetFlags ${InstallPandoc} $1
|
169
|
-
IntOp $1 $1 | ${SF_SELECTED}
|
170
|
-
SectionSetFlags ${InstallPandoc} $1
|
171
|
-
|
172
|
-
SectionGetFlags ${InstallMain} $1
|
173
|
-
IntOp $1 $1 | ${SF_PSELECTED}
|
174
|
-
SectionSetFlags ${InstallMain} $1
|
175
|
-
FunctionEnd
|
176
|
-
|
177
|
-
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
|
178
|
-
!insertmacro MUI_DESCRIPTION_TEXT ${InstallRuby} \
|
179
|
-
"Download and install Ruby v${RUBY_VERSION} for Windows on your computer."
|
180
|
-
|
181
|
-
!insertmacro MUI_DESCRIPTION_TEXT ${InstallRugged} \
|
182
|
-
"Install a pre-built version of rugged, a Ruby bindings to the libgit2 C library."
|
183
|
-
|
184
|
-
!insertmacro MUI_DESCRIPTION_TEXT ${InstallPandoc} \
|
185
|
-
"Install Pandoc to enable automatic conversion from various document formats into RTF."
|
186
|
-
|
187
|
-
!insertmacro MUI_DESCRIPTION_TEXT ${InstallMain} \
|
188
|
-
"Install Package indexer for git-based ReaPack repositories v${VERSION} on your computer."
|
189
|
-
!insertmacro MUI_FUNCTION_DESCRIPTION_END
|