reapack-index 1.0rc2 → 1.0rc3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/lib/reapack/index.rb +10 -5
- data/lib/reapack/index/cli.rb +9 -6
- data/lib/reapack/index/gem_version.rb +1 -1
- data/lib/reapack/index/git.rb +7 -2
- data/lib/reapack/index/scanner.rb +7 -5
- data/reapack-index.gemspec +2 -2
- data/setup/reapack-index.nsi +3 -3
- data/test/cli/test_scan.rb +48 -3
- data/test/index/test_metadata.rb +3 -2
- data/test/index/test_scan.rb +10 -2
- data/test/test_scanner.rb +5 -2
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 67af92b88949837fe5d43e305412534584ec85bc
|
4
|
+
data.tar.gz: a03bb75c38a4fe47fdad9dbf355a8fa1df0dc151
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 14b4b985db8bdb301b460745a63d8016998fd35348be92ce04bc4c9d0839c1d0d992d059c0adf56a4e9c4ebf50121837dfd56fef21c437f654e1fbd582c4a6ec
|
7
|
+
data.tar.gz: 4f5096ef94d75eee24eccc12b7fbd78fbd4477b921d2e5f2458dced3a7541652392c8e7c2f3419a8f5d9096f09d8ad3893137717e083372aa5181f5a2ffa31ed
|
data/README.md
CHANGED
@@ -7,6 +7,7 @@ Subproject: [https://github.com/cfillion/metaheader](https://github.com/cfillion
|
|
7
7
|
[![Build Status](https://travis-ci.org/cfillion/reapack-index.svg?branch=master)](https://travis-ci.org/cfillion/reapack-index)
|
8
8
|
[![Dependency Status](https://gemnasium.com/cfillion/reapack-index.svg)](https://gemnasium.com/cfillion/reapack-index)
|
9
9
|
[![Coverage Status](https://coveralls.io/repos/cfillion/reapack-index/badge.svg?branch=master&service=github)](https://coveralls.io/github/cfillion/reapack-index?branch=master)
|
10
|
+
[![Donate](https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_74x21.png)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=T3DEWBQJAV7WL&lc=CA&item_name=reapack-index%3a%20Package%20indexer%20for%20git-based%20ReaPack%20repositories&no_note=0&cn=Custom%20message&no_shipping=1¤cy_code=CAD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted)
|
10
11
|
|
11
12
|
### Installation
|
12
13
|
|
data/lib/reapack/index.rb
CHANGED
@@ -106,7 +106,7 @@ class ReaPack::Index
|
|
106
106
|
type = self.class.type_of path
|
107
107
|
return unless type
|
108
108
|
|
109
|
-
mh = MetaHeader.
|
109
|
+
mh = MetaHeader.parse contents
|
110
110
|
|
111
111
|
if mh[:noindex]
|
112
112
|
remove path
|
@@ -164,14 +164,19 @@ class ReaPack::Index
|
|
164
164
|
@metadata.links type
|
165
165
|
end
|
166
166
|
|
167
|
-
def eval_link(type,
|
168
|
-
if
|
169
|
-
@metadata.remove_link type,
|
167
|
+
def eval_link(type, input)
|
168
|
+
if input.index('-') == 0
|
169
|
+
@metadata.remove_link type, input[1..-1]
|
170
170
|
log_change "removed #{type} link"
|
171
171
|
return
|
172
172
|
end
|
173
173
|
|
174
|
-
|
174
|
+
separator = input.index('=')
|
175
|
+
if separator&.< input.index('://')
|
176
|
+
input = [input[0...separator], input[separator+1..-1]]
|
177
|
+
end
|
178
|
+
|
179
|
+
link = @metadata.push_link type, *input
|
175
180
|
|
176
181
|
if link.is_new?
|
177
182
|
log_change "new #{type} link"
|
data/lib/reapack/index/cli.rb
CHANGED
@@ -109,23 +109,26 @@ private
|
|
109
109
|
@index.files = commit.filelist
|
110
110
|
|
111
111
|
commit.each_diff
|
112
|
-
.
|
112
|
+
.select {|diff|
|
113
|
+
(not ignored? expand_path(diff.file)) &&
|
114
|
+
ReaPack::Index.type_of(diff.file)
|
115
|
+
}
|
116
|
+
.sort_by {|diff|
|
117
|
+
diff.status == :deleted || diff.new_header[:noindex] ? 0 : 1
|
118
|
+
}
|
113
119
|
.each {|diff| process_diff diff }
|
114
120
|
ensure
|
115
121
|
bump_progress
|
116
122
|
end
|
117
123
|
|
118
124
|
def process_diff(diff)
|
119
|
-
return if ignored? expand_path(diff.file)
|
120
|
-
return unless ReaPack::Index.type_of diff.file
|
121
|
-
|
122
125
|
log "-> indexing #{diff.status} file #{diff.file}"
|
123
126
|
|
124
127
|
if diff.status == :deleted
|
125
128
|
@index.remove diff.file
|
126
129
|
else
|
127
130
|
begin
|
128
|
-
@index.scan diff.file, diff.
|
131
|
+
@index.scan diff.file, diff.new_header
|
129
132
|
rescue ReaPack::Index::Error => e
|
130
133
|
warn "#{diff.file}:\n#{indent e.message}"
|
131
134
|
end
|
@@ -210,7 +213,7 @@ private
|
|
210
213
|
# reiterate over the pkg list after registering every file
|
211
214
|
pkgs.each_pair {|abs, rel|
|
212
215
|
begin
|
213
|
-
@index.scan rel,
|
216
|
+
@index.scan rel, MetaHeader.from_file(abs)
|
214
217
|
|
215
218
|
if @opts[:verbose]
|
216
219
|
$stderr.puts '%s: passed' % rel
|
data/lib/reapack/index/git.rb
CHANGED
@@ -182,12 +182,17 @@ class ReaPack::Index
|
|
182
182
|
attr_reader :status
|
183
183
|
|
184
184
|
def file
|
185
|
-
@file[:path].force_encoding(Encoding::UTF_8)
|
185
|
+
@path ||= @file[:path].force_encoding(Encoding::UTF_8)
|
186
186
|
end
|
187
187
|
|
188
188
|
def new_content
|
189
189
|
return if status == :deleted
|
190
|
-
@
|
190
|
+
@new_content ||=
|
191
|
+
@repo.lookup(@file[:oid]).content.force_encoding(Encoding::UTF_8)
|
192
|
+
end
|
193
|
+
|
194
|
+
def new_header
|
195
|
+
@new_header ||= MetaHeader.new @new_content if new_content
|
191
196
|
end
|
192
197
|
end
|
193
198
|
end
|
@@ -11,7 +11,7 @@ class ReaPack::Index
|
|
11
11
|
HEADER_RULES = {
|
12
12
|
# package-wide tags
|
13
13
|
:version => [
|
14
|
-
MetaHeader::REQUIRED, MetaHeader::VALUE, MetaHeader::SINGLELINE, /\d/],
|
14
|
+
MetaHeader::REQUIRED, MetaHeader::VALUE, MetaHeader::SINGLELINE, /\A\d/],
|
15
15
|
|
16
16
|
# version-specific tags
|
17
17
|
:author => [MetaHeader::VALUE, MetaHeader::SINGLELINE],
|
@@ -21,11 +21,13 @@ class ReaPack::Index
|
|
21
21
|
:metapackage => [MetaHeader::BOOLEAN],
|
22
22
|
}.freeze
|
23
23
|
|
24
|
-
|
24
|
+
META_TYPES = [:extension, :data].freeze
|
25
25
|
|
26
26
|
def initialize(cat, pkg, mh, index)
|
27
27
|
@cat, @pkg, @mh, @index = cat, pkg, mh, index
|
28
|
-
|
28
|
+
|
29
|
+
@mh[:metapackage] = META_TYPES.include?(pkg.type) if mh[:metapackage].nil?
|
30
|
+
|
29
31
|
@cselector = @index.cdetector[pkg.path]
|
30
32
|
end
|
31
33
|
|
@@ -47,7 +49,7 @@ class ReaPack::Index
|
|
47
49
|
@cselector.clear
|
48
50
|
sources = parse_provides @mh[:provides]
|
49
51
|
|
50
|
-
if
|
52
|
+
if !@mh[:metapackage] && sources.none? {|src| src.file.nil? }
|
51
53
|
# add the package itself as a main source
|
52
54
|
src = Source.new make_url(@pkg.path), true
|
53
55
|
sources.unshift src
|
@@ -112,7 +114,7 @@ class ReaPack::Index
|
|
112
114
|
line.url_template ? expanded : file
|
113
115
|
|
114
116
|
if file == @pkg.path
|
115
|
-
src.main =
|
117
|
+
src.main = !@mh[:metapackage] if line.main.nil?
|
116
118
|
else
|
117
119
|
if line.url_template
|
118
120
|
src.file = file
|
data/reapack-index.gemspec
CHANGED
@@ -29,8 +29,8 @@ Gem::Specification.new do |spec|
|
|
29
29
|
spec.add_runtime_dependency 'addressable', '~> 2.4'
|
30
30
|
spec.add_runtime_dependency 'colorize', '~> 0.7'
|
31
31
|
spec.add_runtime_dependency 'gitable', '~> 0.3'
|
32
|
-
spec.add_runtime_dependency 'metaheader', '~> 1.2'
|
33
|
-
spec.add_runtime_dependency 'nokogiri', '~> 1.6.8
|
32
|
+
spec.add_runtime_dependency 'metaheader', '~> 1.2.1'
|
33
|
+
spec.add_runtime_dependency 'nokogiri', '~> 1.6.8'
|
34
34
|
spec.add_runtime_dependency 'pandoc-ruby', '~> 2.0'
|
35
35
|
spec.add_runtime_dependency 'rugged', '~> 0.24'
|
36
36
|
spec.add_runtime_dependency 'stable_sort', '~> 1.1'
|
data/setup/reapack-index.nsi
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
!include Sections.nsh
|
3
3
|
!include StrRep.nsh
|
4
4
|
|
5
|
-
!define VERSION "1.
|
5
|
+
!define VERSION "1.0rc3"
|
6
6
|
!define NAME "ReaPack Index ${VERSION}"
|
7
7
|
!define LONG_VERSION "0.1.0.0"
|
8
8
|
|
@@ -11,8 +11,8 @@
|
|
11
11
|
!define RUBYINSTALLER_URL \
|
12
12
|
"http://dl.bintray.com/oneclick/rubyinstaller/${RUBYINSTALLER_FILE}"
|
13
13
|
|
14
|
-
!define PANDOC_VERSION "1.17.
|
15
|
-
!define PANDOC_FILE "pandoc-${PANDOC_VERSION}-windows.msi"
|
14
|
+
!define PANDOC_VERSION "1.17.1"
|
15
|
+
!define PANDOC_FILE "pandoc-${PANDOC_VERSION}-1-windows.msi"
|
16
16
|
!define PANDOC_URL \
|
17
17
|
"https://github.com/jgm/pandoc/releases/download/${PANDOC_VERSION}/${PANDOC_FILE}"
|
18
18
|
|
data/test/cli/test_scan.rb
CHANGED
@@ -52,7 +52,7 @@ class TestCLI::Scan < MiniTest::Test
|
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
55
|
-
def
|
55
|
+
def test_workingdir_is_subdirectory
|
56
56
|
wrapper do
|
57
57
|
@git.create_commit 'initial commit',
|
58
58
|
[mkfile('cat/test1.lua', '@version 1.0')]
|
@@ -193,8 +193,8 @@ processing [a-f0-9]{7}: third commit
|
|
193
193
|
wrapper ['--ignore=Hello', '--ignore=Chunky/Bacon.lua',
|
194
194
|
'--ignore=test2.lua'], setup: setup do
|
195
195
|
@git.create_commit 'initial commit', [
|
196
|
-
mkfile('Hello/World.lua', '
|
197
|
-
mkfile('Chunky/Bacon.lua', '
|
196
|
+
mkfile('Hello/World.lua', '@version 1.0'),
|
197
|
+
mkfile('Chunky/Bacon.lua', '@version 1.0'),
|
198
198
|
mkfile('Directory/test2.lua', '@version 1.0'),
|
199
199
|
]
|
200
200
|
|
@@ -224,6 +224,51 @@ processing [a-f0-9]{7}: third commit
|
|
224
224
|
end
|
225
225
|
end
|
226
226
|
|
227
|
+
def test_remove_before_scan
|
228
|
+
wrapper do
|
229
|
+
contents = "@version 1.0\n@provides file"
|
230
|
+
|
231
|
+
@git.create_commit 'initial commit', [
|
232
|
+
mkfile('cat/testz.lua', contents),
|
233
|
+
mkfile('cat/file'),
|
234
|
+
]
|
235
|
+
|
236
|
+
File.delete mkpath('cat/testz.lua')
|
237
|
+
@git.create_commit 'second commit', [
|
238
|
+
mkpath('cat/testz.lua'),
|
239
|
+
mkfile('cat/testa.lua', contents),
|
240
|
+
]
|
241
|
+
|
242
|
+
_, stderr = capture_io do
|
243
|
+
assert_equal true, @cli.run
|
244
|
+
end
|
245
|
+
|
246
|
+
refute_match 'conflict', stderr
|
247
|
+
end
|
248
|
+
end
|
249
|
+
|
250
|
+
def test_noindex_before_scan
|
251
|
+
wrapper do
|
252
|
+
contents = "@version 1.0\n@provides file"
|
253
|
+
|
254
|
+
@git.create_commit 'initial commit', [
|
255
|
+
mkfile('cat/testz.lua', contents),
|
256
|
+
mkfile('cat/file'),
|
257
|
+
]
|
258
|
+
|
259
|
+
@git.create_commit 'second commit', [
|
260
|
+
mkfile('cat/testz.lua', contents .. "\n@noindex"),
|
261
|
+
mkfile('cat/testa.lua', contents),
|
262
|
+
]
|
263
|
+
|
264
|
+
_, stderr = capture_io do
|
265
|
+
assert_equal true, @cli.run
|
266
|
+
end
|
267
|
+
|
268
|
+
refute_match 'conflict', stderr
|
269
|
+
end
|
270
|
+
end
|
271
|
+
|
227
272
|
def test_specify_commit
|
228
273
|
# --progress is enabled to check for FloatDomainError: Infinity errors
|
229
274
|
options = ['--progress', '--scan']
|
data/test/index/test_metadata.rb
CHANGED
@@ -10,9 +10,10 @@ class TestIndex::Metadata < MiniTest::Test
|
|
10
10
|
|
11
11
|
assert_equal 0, index.links(:website).size
|
12
12
|
index.eval_link :website, 'http://test.com'
|
13
|
-
|
13
|
+
index.eval_link :website, 'http://test.com?query=string'
|
14
|
+
assert_equal 2, index.links(:website).size
|
14
15
|
|
15
|
-
assert_equal '
|
16
|
+
assert_equal '2 new website links, empty index', index.changelog
|
16
17
|
|
17
18
|
index.write!
|
18
19
|
end
|
data/test/index/test_scan.rb
CHANGED
@@ -171,10 +171,10 @@ class TestIndex::Scan < MiniTest::Test
|
|
171
171
|
refute_match '<category', contents
|
172
172
|
end
|
173
173
|
|
174
|
-
def
|
174
|
+
def test_metapackage_on
|
175
175
|
index = ReaPack::Index.new @dummy_path
|
176
176
|
index.url_template = 'http://host/$path'
|
177
|
-
index.files = ['Category/script.lua'
|
177
|
+
index.files = ['Category/script.lua']
|
178
178
|
|
179
179
|
error = assert_raises ReaPack::Index::Error do
|
180
180
|
index.scan index.files.first, "@version 1.0\n@metapackage"
|
@@ -183,6 +183,14 @@ class TestIndex::Scan < MiniTest::Test
|
|
183
183
|
assert_equal 'no files provided', error.message
|
184
184
|
end
|
185
185
|
|
186
|
+
def test_metapackage_off
|
187
|
+
index = ReaPack::Index.new @dummy_path
|
188
|
+
index.url_template = 'http://host/$path'
|
189
|
+
index.files = ['Category/extension.ext']
|
190
|
+
|
191
|
+
index.scan index.files.first, "@version 1.0\n@metapackage false"
|
192
|
+
end
|
193
|
+
|
186
194
|
def test_version_time
|
187
195
|
index = ReaPack::Index.new @dummy_path
|
188
196
|
index.url_template = 'http://host/$path'
|
data/test/test_scanner.rb
CHANGED
@@ -6,7 +6,6 @@ class TestScanner < MiniTest::Test
|
|
6
6
|
@cat = MiniTest::Mock.new
|
7
7
|
|
8
8
|
@pkg = MiniTest::Mock.new
|
9
|
-
@pkg.expect :type, :script
|
10
9
|
@pkg.expect :path, 'Hello/World.lua'
|
11
10
|
@pkg.expect :path, 'Hello/World.lua'
|
12
11
|
|
@@ -14,7 +13,7 @@ class TestScanner < MiniTest::Test
|
|
14
13
|
@ver.expect :name, '1.0'
|
15
14
|
|
16
15
|
@mh = MiniTest::Mock.new
|
17
|
-
@mh.expect :[],
|
16
|
+
@mh.expect :[], true, [:metapackage]
|
18
17
|
|
19
18
|
@cdetector = MiniTest::Mock.new
|
20
19
|
@cdetector.expect :[], nil, ['Hello/World.lua']
|
@@ -140,6 +139,10 @@ class TestScanner < MiniTest::Test
|
|
140
139
|
error = assert_raises(ReaPack::Index::Error) { @scanner.run }
|
141
140
|
assert_equal "invalid value for tag 'version'", error.message
|
142
141
|
|
142
|
+
@mh[:version] = 'v1.0'
|
143
|
+
error = assert_raises(ReaPack::Index::Error) { @scanner.run }
|
144
|
+
assert_equal "invalid value for tag 'version'", error.message
|
145
|
+
|
143
146
|
@mh[:version] = true
|
144
147
|
error = assert_raises(ReaPack::Index::Error) { @scanner.run }
|
145
148
|
assert_equal "missing value for tag 'version'", error.message
|
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: 1.
|
4
|
+
version: 1.0rc3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- cfillion
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-06-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -128,28 +128,28 @@ dependencies:
|
|
128
128
|
requirements:
|
129
129
|
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version:
|
131
|
+
version: 1.2.1
|
132
132
|
type: :runtime
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version:
|
138
|
+
version: 1.2.1
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: nokogiri
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
143
|
- - "~>"
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version: 1.6.8
|
145
|
+
version: 1.6.8
|
146
146
|
type: :runtime
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
150
|
- - "~>"
|
151
151
|
- !ruby/object:Gem::Version
|
152
|
-
version: 1.6.8
|
152
|
+
version: 1.6.8
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: pandoc-ruby
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|