reapack-index 1.2.2 → 1.2.3rc1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3f9b62d7bee0df16d8de2903900ac49696ea2a3ee34ff698ac4160cde78588dc
4
- data.tar.gz: 4e2285d7499f6f84b2ecf04fea0853e3e739c4e9d6e4cc8ce11226828122c64e
3
+ metadata.gz: 5326de32c33b763e737211b02a854e59c12fcd29982d3b835ae80d2c797d46c3
4
+ data.tar.gz: 20ee6a02cc538a3bcf6ffff3a0cae3f7e50f98252efcd89dbcef5ff054a86adc
5
5
  SHA512:
6
- metadata.gz: ef43516204243d62b88d8f358c5fabc30a4bc66151fe167de54490ab39e0ac37373d7835226d436e6605bfbb6de6672a49614d6220bd5908a0a6fdbb4341caa7
7
- data.tar.gz: aa8170e5582c87c1705bb42772014b75c4bc930e72f6d8519c996d2415ba0fc33740882c5f3e0b5245203ee428c38eb1538705a5cde296874dc3cc9f2cf0a887
6
+ metadata.gz: 7a2421af8f16e88a29cd7c86f5becfd96c5e22d04e344214e4fff22ef3821023d2e54cdb7bba54c4eeb4053b82f3724c98765e1674748ea4d3cd409957608cd4
7
+ data.tar.gz: f2668253f9110713cb107b779ca9adc52b36ca5449075e493f61f1881343de6f16bad76fda0cb7d6d6008622e6bd65c8e6a53fd5ea46c92f892a3ff26cf3a429
data/.travis.yml CHANGED
@@ -4,8 +4,9 @@ rvm:
4
4
  - 2.4
5
5
  - 2.5
6
6
  - 2.6
7
+ - 2.7
7
8
  before_install:
8
9
  - gem update bundler
9
- - wget https://github.com/jgm/pandoc/releases/download/2.7.2/pandoc-2.7.2-1-amd64.deb -O pandoc.deb
10
+ - wget https://github.com/jgm/pandoc/releases/download/2.9.2/pandoc-2.9.2-1-amd64.deb -O pandoc.deb
10
11
  - sudo dpkg -i pandoc.deb
11
12
  cache: bundler
data/README.md CHANGED
@@ -5,7 +5,6 @@ Subproject: [https://github.com/cfillion/metaheader](https://github.com/cfillion
5
5
 
6
6
  [![Gem Version](https://badge.fury.io/rb/reapack-index.svg)](http://badge.fury.io/rb/reapack-index)
7
7
  [![Build Status](https://travis-ci.org/cfillion/reapack-index.svg?branch=master)](https://travis-ci.org/cfillion/reapack-index)
8
- [![Dependency Status](https://gemnasium.com/cfillion/reapack-index.svg)](https://gemnasium.com/cfillion/reapack-index)
9
8
  [![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
9
  [![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&currency_code=CAD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted)
11
10
 
data/lib/reapack/index.rb CHANGED
@@ -120,8 +120,16 @@ class ReaPack::Index
120
120
  type = self.class.type_of path
121
121
  return unless type
122
122
 
123
- mh = MetaHeader.parse contents
124
- mh.strict = @strict
123
+ mh = if contents.is_a? MetaHeader
124
+ contents
125
+ else
126
+ mh = MetaHeader.parse contents
127
+ unless mh.has? :changelog
128
+ wp = WordpressChangelog.new mh
129
+ wp.parse contents
130
+ end
131
+ mh
132
+ end
125
133
 
126
134
  if mh[:noindex]
127
135
  remove path
@@ -139,7 +147,7 @@ class ReaPack::Index
139
147
  scanner = Scanner.new cat, pkg, mh, self
140
148
 
141
149
  begin
142
- scanner.run
150
+ scanner.run @strict
143
151
  rescue Error
144
152
  backups.each {|var, value| instance_variable_set var, value }
145
153
  raise
@@ -1,5 +1,5 @@
1
1
  module ReaPack
2
2
  class Index
3
- VERSION = '1.2.2'
3
+ VERSION = '1.2.3rc1'
4
4
  end
5
5
  end
@@ -232,7 +232,7 @@ class ReaPack::Index
232
232
  end
233
233
 
234
234
  def new_header
235
- @new_header ||= MetaHeader.new @new_content if new_content
235
+ @new_header ||= MetaHeader.parse @new_content if new_content
236
236
  end
237
237
  end
238
238
  end
@@ -1,4 +1,4 @@
1
- class WordpressChangelog < MetaHeader::Parser
1
+ class WordpressChangelog
2
2
  CHANGELOG = /
3
3
  Changelog\s*:\n
4
4
  (.+?)\n\s*
@@ -7,11 +7,14 @@ class WordpressChangelog < MetaHeader::Parser
7
7
 
8
8
  VERSION = /\A[\s\*]*v([\d\.]+)(?:\s+(.+))?\Z/.freeze
9
9
 
10
+ def initialize(mh)
11
+ @header = mh
12
+ end
13
+
10
14
  def parse(input)
11
- input = input.read
12
15
  input.encode! Encoding::UTF_8, invalid: :replace
13
16
 
14
- ver, changes = header[:version], header[:changelog]
17
+ ver, changes = @header[:version], @header[:changelog]
15
18
  return if ver.nil? || changes || CHANGELOG.match(input).nil?
16
19
 
17
20
  $1.lines.each {|line| read line.lstrip }
@@ -19,15 +22,15 @@ class WordpressChangelog < MetaHeader::Parser
19
22
 
20
23
  def read(line)
21
24
  if line =~ VERSION
22
- @current = $1 == header[:version]
25
+ @current = $1 == @header[:version]
23
26
  elsif @current
24
- if header[:changelog]
25
- header[:changelog] += "\n"
27
+ if @header[:changelog]
28
+ @header[:changelog] += "\n"
26
29
  else
27
- header[:changelog] = String.new
30
+ @header[:changelog] = String.new
28
31
  end
29
32
 
30
- header[:changelog] += line.chomp
33
+ @header[:changelog] += line.chomp
31
34
  end
32
35
  end
33
36
  end
@@ -52,10 +52,12 @@ class ReaPack::Index
52
52
  @self_overriden = false
53
53
  end
54
54
 
55
- def run
55
+ def run(strict = false)
56
56
  @mh.alias HEADER_ALIASES
57
57
 
58
- if errors = @mh.validate(HEADER_RULES)
58
+ errors = @mh.validate(HEADER_RULES, strict)
59
+
60
+ unless errors.empty?
59
61
  raise Error, errors.join("\n")
60
62
  end
61
63
 
@@ -108,11 +110,23 @@ class ReaPack::Index
108
110
  end
109
111
  end
110
112
 
111
- template
112
- .gsub('$path', URI::encode(path))
113
- .gsub('$commit', @index.commit || 'master')
114
- .gsub('$version', @ver.name)
115
- .gsub('$package', @pkg.path)
113
+ substitutions = {
114
+ '$path' => path,
115
+ '$commit' => @index.commit || 'master',
116
+ '$version' => @ver.name,
117
+ '$package' => @pkg.path,
118
+ }
119
+
120
+ uri = Addressable::URI.parse template
121
+ [:host, :path, :query].each {|segment|
122
+ value = uri.send segment
123
+
124
+ if value
125
+ value.gsub! /\$\w+/, substitutions
126
+ uri.send "#{segment}=", value
127
+ end
128
+ }
129
+ uri.normalize.to_s
116
130
  end
117
131
 
118
132
  def parse_provides(provides)
@@ -182,7 +196,7 @@ class ReaPack::Index
182
196
  src.detect_sections @pkg
183
197
  end
184
198
 
185
- src.file = target if line.target
199
+ src.file = target if line.target && expanded != file
186
200
  @self_overriden = true
187
201
  else
188
202
  if line.url_template
@@ -11,6 +11,7 @@ class ReaPack::Index
11
11
  windows: :all, win32: :windows, win64: :windows,
12
12
  darwin: :all, darwin32: :darwin, darwin64: :darwin,
13
13
  linux: :all, linux32: :linux, linux64: :linux,
14
+ 'linux-armv7l': :linux, 'linux-aarch64': :linux
14
15
  }.freeze
15
16
 
16
17
  SECTIONS = [
@@ -8,7 +8,7 @@ Gem::Specification.new do |spec|
8
8
  spec.name = 'reapack-index'
9
9
  spec.version = ReaPack::Index::VERSION
10
10
  spec.authors = ['cfillion']
11
- spec.email = ['reapack-index@cfillion.tk']
11
+ spec.email = ['reapack-index@cfillion.ca']
12
12
  spec.summary = 'Package indexer for git-based ReaPack repositories'
13
13
  spec.homepage = 'https://github.com/cfillion/reapack-index'
14
14
  spec.license = 'GPL-3.0+'
@@ -29,7 +29,7 @@ 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.3'
32
+ spec.add_runtime_dependency 'metaheader', '~> 2.0'
33
33
  spec.add_runtime_dependency 'nokogiri', '~> 1.7'
34
34
  spec.add_runtime_dependency 'pandoc-ruby', '~> 2.0'
35
35
  spec.add_runtime_dependency 'rugged', '~> 0.25'
@@ -427,4 +427,18 @@ class TestIndex::Provides < MiniTest::Test
427
427
  @provides ../target.lua
428
428
  IN
429
429
  end
430
+
431
+ def test_rename_target_same_name
432
+ index = ReaPack::Index.new @dummy_path
433
+ index.files = ['Category/script.lua']
434
+ index.url_template = 'http://host/$path'
435
+
436
+ index.scan index.files.first, <<-IN
437
+ @version 1.0
438
+ @provides . > script.lua
439
+ IN
440
+
441
+ index.write!
442
+ refute_match 'file=', File.read(index.path)
443
+ end
430
444
  end
@@ -93,10 +93,10 @@ class TestScanner::TestMakeUrl < MiniTest::Test
93
93
 
94
94
  def test_repeat
95
95
  @index.expect :files, ['Category/script.lua']
96
- @index.expect :url_template, '$path $path'
96
+ @index.expect :url_template, '$path$path'
97
97
  @index.expect :commit, 'C0FF33'
98
98
 
99
- assert_equal 'Category/script.lua Category/script.lua',
99
+ assert_equal 'Category/script.luaCategory/script.lua',
100
100
  @scanner.make_url('Category/script.lua')
101
101
  end
102
102
  end
@@ -8,7 +8,7 @@ class TestScanner::TestValidation < MiniTest::Test
8
8
  @pkg.expect :type, :script
9
9
  @pkg.expect :path, 'cat/test'
10
10
 
11
- @mh = MetaHeader.new String.new
11
+ @mh = MetaHeader.new
12
12
  @mh[:version] = '1.0'
13
13
 
14
14
  @index = MiniTest::Mock.new
@@ -20,7 +20,7 @@ class TestScanner::TestValidation < MiniTest::Test
20
20
  def test_validation
21
21
  mh_mock = MiniTest::Mock.new
22
22
  mh_mock.expect :alias, nil, [Hash]
23
- mh_mock.expect :validate, ['first', 'second'], [Hash]
23
+ mh_mock.expect :validate, ['first', 'second'], [Hash, false]
24
24
 
25
25
  @scanner.instance_variable_set :@mh, mh_mock
26
26
 
data/test/test_parsers.rb CHANGED
@@ -2,7 +2,7 @@ require File.expand_path '../helper', __FILE__
2
2
 
3
3
  class TestParsers < MiniTest::Test
4
4
  def test_wordpress
5
- mh = MetaHeader.new <<-IN
5
+ input = <<-IN
6
6
  /**
7
7
  * Version: 1.1
8
8
  */
@@ -23,12 +23,17 @@ class TestParsers < MiniTest::Test
23
23
  Test\x97
24
24
  IN
25
25
 
26
+ mh = MetaHeader.parse input
26
27
  assert_equal '1.1', mh[:version]
28
+ refute mh.has?(:changelog)
29
+
30
+ parser = WordpressChangelog.new mh
31
+ parser.parse input
27
32
  assert_equal "+ Line 3\n+ Line 4", mh[:changelog]
28
33
  end
29
34
 
30
35
  def test_wordpress_no_date
31
- mh = MetaHeader.new <<-IN
36
+ input = <<-IN
32
37
  /**
33
38
  * Version: 1.1
34
39
  */
@@ -49,12 +54,14 @@ class TestParsers < MiniTest::Test
49
54
  Test\x97
50
55
  IN
51
56
 
52
- assert_equal '1.1', mh[:version]
57
+ mh = MetaHeader.parse input
58
+ parser = WordpressChangelog.new mh
59
+ parser.parse input
53
60
  assert_equal "+ Line 3\n+ Line 4", mh[:changelog]
54
61
  end
55
62
 
56
63
  def test_wordpress_noprefix
57
- mh = MetaHeader.new <<-IN
64
+ input = <<-IN
58
65
  --[[
59
66
  Version: 1.1
60
67
  --]]
@@ -76,7 +83,9 @@ v1.0 (2012-01-01)
76
83
  Test\x97
77
84
  IN
78
85
 
79
- assert_equal '1.1', mh[:version]
86
+ mh = MetaHeader.parse input
87
+ parser = WordpressChangelog.new mh
88
+ parser.parse input
80
89
  assert_equal "+ Line 3\n+ Line 4", mh[:changelog]
81
90
  end
82
91
  end
@@ -35,7 +35,7 @@ class TestProvides < MiniTest::Test
35
35
  def test_platforms
36
36
  assert_equal [:windows, :win32, :win64,
37
37
  :darwin, :darwin32, :darwin64,
38
- :linux, :linux32, :linux64],
38
+ :linux, :linux32, :linux64, :'linux-armv7l', :'linux-aarch64'],
39
39
  [
40
40
  '[windows] file',
41
41
  '[win32] file',
@@ -46,6 +46,8 @@ class TestProvides < MiniTest::Test
46
46
  '[linux] file',
47
47
  '[linux32] file',
48
48
  '[linux64] file',
49
+ '[linux-armv7l] file',
50
+ '[linux-aarch64] file',
49
51
  ].map {|l| ReaPack::Index::Provides.parse(l).platform }
50
52
  end
51
53
 
data/test/test_scanner.rb CHANGED
@@ -6,7 +6,7 @@ class TestScanner < MiniTest::Test
6
6
  def setup
7
7
  @mock = MiniTest::Mock.new
8
8
 
9
- @mh = MetaHeader.new String.new
9
+ @mh = MetaHeader.new
10
10
  @mh[:version] = '1.0'
11
11
 
12
12
  @doc = Nokogiri::XML <<-XML
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.2.2
4
+ version: 1.2.3rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - cfillion
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-06-06 00:00:00.000000000 Z
11
+ date: 2020-02-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -128,14 +128,14 @@ dependencies:
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: '1.3'
131
+ version: '2.0'
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: '1.3'
138
+ version: '2.0'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: nokogiri
141
141
  requirement: !ruby/object:Gem::Requirement
@@ -194,7 +194,7 @@ dependencies:
194
194
  version: '1.1'
195
195
  description:
196
196
  email:
197
- - reapack-index@cfillion.tk
197
+ - reapack-index@cfillion.ca
198
198
  executables:
199
199
  - reapack-index
200
200
  extensions: []
@@ -260,9 +260,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
260
260
  version: '2.3'
261
261
  required_rubygems_version: !ruby/object:Gem::Requirement
262
262
  requirements:
263
- - - ">="
263
+ - - ">"
264
264
  - !ruby/object:Gem::Version
265
- version: '0'
265
+ version: 1.3.1
266
266
  requirements: []
267
267
  rubygems_version: 3.0.2
268
268
  signing_key: