mini_portile2 2.2.0.rc1 → 2.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.github/FUNDING.yml +1 -0
- data/.github/workflows/ci.yml +62 -0
- data/.gitignore +3 -3
- data/CHANGELOG.md +43 -2
- data/README.md +58 -3
- data/Rakefile +2 -2
- data/SECURITY.md +13 -0
- data/lib/mini_portile2/mini_portile.rb +107 -37
- data/lib/mini_portile2/mini_portile_cmake.rb +12 -11
- data/lib/mini_portile2/version.rb +1 -1
- data/mini_portile2.gemspec +25 -20
- data/test/assets/gpg-fixtures/data +1 -0
- data/test/assets/gpg-fixtures/data.asc +9 -0
- data/test/assets/gpg-fixtures/data.invalid.asc +9 -0
- data/test/test_cmake.rb +9 -13
- data/test/test_cook.rb +49 -3
- data/test/test_digest.rb +145 -0
- data/test/test_download.rb +11 -9
- data/test/test_execute.rb +39 -0
- data/test/test_proxy.rb +2 -2
- metadata +44 -23
- data/.concourse.yml +0 -83
- data/.travis.yml +0 -12
- data/appveyor.yml +0 -24
|
@@ -6,8 +6,10 @@ class MiniPortileCMake < MiniPortile
|
|
|
6
6
|
end
|
|
7
7
|
|
|
8
8
|
def configure_defaults
|
|
9
|
-
if MiniPortile.
|
|
10
|
-
['-G
|
|
9
|
+
if MiniPortile.mswin?
|
|
10
|
+
['-G', 'NMake Makefiles']
|
|
11
|
+
elsif MiniPortile.mingw?
|
|
12
|
+
['-G', 'MSYS Makefiles']
|
|
11
13
|
else
|
|
12
14
|
[]
|
|
13
15
|
end
|
|
@@ -16,9 +18,8 @@ class MiniPortileCMake < MiniPortile
|
|
|
16
18
|
def configure
|
|
17
19
|
return if configured?
|
|
18
20
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
File.open(md5_file, "w") { |f| f.write digest }
|
|
21
|
+
cache_file = File.join(tmp_path, 'configure.options_cache')
|
|
22
|
+
File.open(cache_file, "w") { |f| f.write computed_options.to_s }
|
|
22
23
|
|
|
23
24
|
execute('configure', %w(cmake) + computed_options + ["."])
|
|
24
25
|
end
|
|
@@ -26,16 +27,16 @@ class MiniPortileCMake < MiniPortile
|
|
|
26
27
|
def configured?
|
|
27
28
|
configure = File.join(work_path, 'configure')
|
|
28
29
|
makefile = File.join(work_path, 'CMakefile')
|
|
29
|
-
|
|
30
|
+
cache_file = File.join(tmp_path, 'configure.options_cache')
|
|
30
31
|
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
stored_options = File.exist?(cache_file) ? File.read(cache_file) : ""
|
|
33
|
+
current_options = computed_options.to_s
|
|
33
34
|
|
|
34
|
-
(
|
|
35
|
+
(current_options == stored_options) && newer?(makefile, configure)
|
|
35
36
|
end
|
|
36
37
|
|
|
37
38
|
def make_cmd
|
|
38
|
-
return "nmake" if MiniPortile.
|
|
39
|
+
return "nmake" if MiniPortile.mswin?
|
|
39
40
|
super
|
|
40
41
|
end
|
|
41
|
-
end
|
|
42
|
+
end
|
data/mini_portile2.gemspec
CHANGED
|
@@ -1,37 +1,42 @@
|
|
|
1
1
|
# coding: utf-8
|
|
2
|
-
lib = File.expand_path(
|
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
-
require
|
|
4
|
+
require "mini_portile2/version"
|
|
5
5
|
|
|
6
6
|
Gem::Specification.new do |spec|
|
|
7
|
-
spec.name
|
|
8
|
-
spec.version
|
|
7
|
+
spec.name = "mini_portile2"
|
|
8
|
+
spec.version = MiniPortile::VERSION
|
|
9
9
|
|
|
10
|
-
spec.authors
|
|
11
|
-
spec.email
|
|
10
|
+
spec.authors = ["Luis Lavena", "Mike Dalessio", "Lars Kanis"]
|
|
11
|
+
spec.email = "mike.dalessio@gmail.com"
|
|
12
12
|
|
|
13
|
-
spec.summary
|
|
14
|
-
spec.description
|
|
13
|
+
spec.summary = "Simplistic port-like solution for developers"
|
|
14
|
+
spec.description = "Simplistic port-like solution for developers. It provides a standard and simplified way to compile against dependency libraries without messing up your system."
|
|
15
15
|
|
|
16
|
-
spec.homepage
|
|
17
|
-
spec.licenses
|
|
16
|
+
spec.homepage = "https://github.com/flavorjones/mini_portile"
|
|
17
|
+
spec.licenses = ["MIT"]
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
begin
|
|
20
|
+
spec.files = `git ls-files -z`.split("\x0")
|
|
21
|
+
rescue Exception => e
|
|
22
|
+
warn "WARNING: could not set spec.files: #{e.class}: #{e}"
|
|
23
|
+
end
|
|
20
24
|
|
|
21
25
|
# omit the `examples` directory from the gem, because it's large and
|
|
22
26
|
# not necessary to be packaged in the gem.
|
|
23
|
-
example_files
|
|
27
|
+
example_files = spec.files.grep(%r{^examples/})
|
|
24
28
|
spec.files -= example_files
|
|
25
29
|
|
|
26
|
-
spec.executables
|
|
27
|
-
spec.test_files
|
|
30
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
31
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features|examples)/})
|
|
28
32
|
spec.require_paths = ["lib"]
|
|
29
33
|
|
|
30
|
-
spec.add_development_dependency "bundler", "~> 1
|
|
31
|
-
spec.add_development_dependency "
|
|
32
|
-
spec.add_development_dependency "minitest", "~> 5.
|
|
33
|
-
spec.add_development_dependency "minitest-hooks", "~> 1.
|
|
34
|
-
spec.add_development_dependency "
|
|
34
|
+
spec.add_development_dependency "bundler", "~> 2.1"
|
|
35
|
+
spec.add_development_dependency "minitar", "~> 0.7"
|
|
36
|
+
spec.add_development_dependency "minitest", "~> 5.11"
|
|
37
|
+
spec.add_development_dependency "minitest-hooks", "~> 1.5.0"
|
|
38
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
|
39
|
+
spec.add_development_dependency "webrick", "~> 1.0"
|
|
35
40
|
|
|
36
|
-
spec.required_ruby_version = ">=
|
|
41
|
+
spec.required_ruby_version = ">= 2.3.0"
|
|
37
42
|
end
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
test
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
-----BEGIN PGP SIGNATURE-----
|
|
2
|
+
Version: GnuPG v1
|
|
3
|
+
|
|
4
|
+
iJwEAAECAAYFAlcFOD8ACgkQZeg+SWTDcLNIswP/XvVRoJ+eQ2u2v+WjXdBBKBSW
|
|
5
|
+
pzM216aJPRBxPl98xNUUKjqga+tjKmIHJn5T4CIxHqis1toPxtE5tKnc6cVO1aqY
|
|
6
|
+
bCUfkWyt/A3qRHQuniRUWSBKZWdk+j3AopTpd3i/r/s0pDj3bMHJ7bDOTsEskNcM
|
|
7
|
+
KpgFfNM1ieFRQmIWPWg=
|
|
8
|
+
=kbKc
|
|
9
|
+
-----END PGP SIGNATURE-----
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
-----BEGIN PGP SIGNATURE-----
|
|
2
|
+
Version: GnuPG v1
|
|
3
|
+
|
|
4
|
+
iJwEAQECAAYFAlcFLEgACgkQZeg+SWTDcLPVwgQAg8KTI91Ryx38YplzgWV9tUPj
|
|
5
|
+
o7J7IEzb8faE7m2mgtq8m62DvA4h/PJzmbh1EJJ4VkO+A4O2LVh/bTgnyYXv+kMu
|
|
6
|
+
sEmvK35PnAC8r7pv98VSbMEXyV/rK3+uGhTvnXZYkULvMVYkN/EHIh2bCQJ3R14X
|
|
7
|
+
MY8El95QST8/dR/yBkw=
|
|
8
|
+
=qbod
|
|
9
|
+
-----END PGP SIGNATURE-----
|
data/test/test_cmake.rb
CHANGED
|
@@ -5,8 +5,6 @@ class TestCMake < TestCase
|
|
|
5
5
|
|
|
6
6
|
def before_all
|
|
7
7
|
super
|
|
8
|
-
return if MiniPortile.windows?
|
|
9
|
-
|
|
10
8
|
@assets_path = File.expand_path("../assets", __FILE__)
|
|
11
9
|
@tar_path = File.expand_path("../../tmp/test-cmake-1.0.tar.gz", __FILE__)
|
|
12
10
|
|
|
@@ -19,7 +17,6 @@ class TestCMake < TestCase
|
|
|
19
17
|
@recipe = MiniPortileCMake.new("test-cmake", "1.0").tap do |recipe|
|
|
20
18
|
recipe.files << "http://localhost:#{HTTP_PORT}/#{ERB::Util.url_encode(File.basename(@tar_path))}"
|
|
21
19
|
recipe.patch_files << File.join(@assets_path, "patch 1.diff")
|
|
22
|
-
recipe.configure_options << "--option=\"path with 'space'\""
|
|
23
20
|
git_dir = File.join(@assets_path, "git")
|
|
24
21
|
with_custom_git_dir(git_dir) do
|
|
25
22
|
recipe.cook
|
|
@@ -29,19 +26,22 @@ class TestCMake < TestCase
|
|
|
29
26
|
|
|
30
27
|
def after_all
|
|
31
28
|
super
|
|
32
|
-
return if MiniPortile.windows?
|
|
33
|
-
|
|
34
29
|
stop_webrick
|
|
35
30
|
# leave test files for inspection
|
|
36
31
|
end
|
|
37
32
|
|
|
33
|
+
def exe_name
|
|
34
|
+
case
|
|
35
|
+
when MiniPortile.windows? then "hello.exe"
|
|
36
|
+
else "hello"
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
38
40
|
def test_cmake_inherits_from_base
|
|
39
41
|
assert(MiniPortileCMake <= MiniPortile)
|
|
40
42
|
end
|
|
41
43
|
|
|
42
44
|
def test_configure
|
|
43
|
-
skip if MiniPortile.windows?
|
|
44
|
-
|
|
45
45
|
cmakecache = File.join(work_dir, "CMakeCache.txt")
|
|
46
46
|
assert File.exist?(cmakecache), cmakecache
|
|
47
47
|
|
|
@@ -49,16 +49,12 @@ class TestCMake < TestCase
|
|
|
49
49
|
end
|
|
50
50
|
|
|
51
51
|
def test_compile
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
binary = File.join(work_dir, "hello")
|
|
52
|
+
binary = File.join(work_dir, exe_name)
|
|
55
53
|
assert File.exist?(binary), binary
|
|
56
54
|
end
|
|
57
55
|
|
|
58
56
|
def test_install
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
binary = File.join(recipe.path, "bin", "hello")
|
|
57
|
+
binary = File.join(recipe.path, "bin", exe_name)
|
|
62
58
|
assert File.exist?(binary), binary
|
|
63
59
|
end
|
|
64
60
|
end
|
data/test/test_cook.rb
CHANGED
|
@@ -8,8 +8,7 @@ class TestCook < TestCase
|
|
|
8
8
|
@assets_path = File.expand_path("../assets", __FILE__)
|
|
9
9
|
@tar_path = File.expand_path("../../tmp/test mini portile-1.0.0.tar.gz", __FILE__)
|
|
10
10
|
|
|
11
|
-
# remove any previous test files
|
|
12
|
-
FileUtils.rm_rf("tmp")
|
|
11
|
+
FileUtils.rm_rf("tmp") # remove any previous test files
|
|
13
12
|
|
|
14
13
|
create_tar(@tar_path, @assets_path, "test mini portile-1.0.0")
|
|
15
14
|
start_webrick(File.dirname(@tar_path))
|
|
@@ -28,7 +27,7 @@ class TestCook < TestCase
|
|
|
28
27
|
def after_all
|
|
29
28
|
super
|
|
30
29
|
stop_webrick
|
|
31
|
-
#
|
|
30
|
+
FileUtils.rm_rf("tmp") # remove test files
|
|
32
31
|
end
|
|
33
32
|
|
|
34
33
|
def test_download
|
|
@@ -67,3 +66,50 @@ class TestCook < TestCase
|
|
|
67
66
|
assert_equal( ["install"].inspect, IO.read(txt).chomp )
|
|
68
67
|
end
|
|
69
68
|
end
|
|
69
|
+
|
|
70
|
+
class TestCookWithBrokenGitDir < TestCase
|
|
71
|
+
#
|
|
72
|
+
# this is a test for #69
|
|
73
|
+
# https://github.com/flavorjones/mini_portile/issues/69
|
|
74
|
+
#
|
|
75
|
+
attr_accessor :assets_path, :tar_path, :recipe
|
|
76
|
+
|
|
77
|
+
def before_all
|
|
78
|
+
super
|
|
79
|
+
@assets_path = File.expand_path("../assets", __FILE__)
|
|
80
|
+
@tar_path = File.expand_path("../../tmp/test-mini-portile-1.0.0.tar.gz", __FILE__)
|
|
81
|
+
|
|
82
|
+
@git_dir = File.join(@assets_path, "git-broken")
|
|
83
|
+
FileUtils.rm_rf @git_dir
|
|
84
|
+
FileUtils.mkdir_p @git_dir
|
|
85
|
+
Dir.chdir(@git_dir) do
|
|
86
|
+
File.open ".git", "w" do |f|
|
|
87
|
+
f.write "gitdir: /nonexistent"
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
create_tar(@tar_path, @assets_path, "test mini portile-1.0.0")
|
|
92
|
+
|
|
93
|
+
@recipe = MiniPortile.new("test mini portile", "1.0.0").tap do |recipe|
|
|
94
|
+
recipe.files << "file://#{@tar_path}"
|
|
95
|
+
recipe.patch_files << File.join(@assets_path, "patch 1.diff")
|
|
96
|
+
recipe.configure_options << "--option=\"path with 'space'\""
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
Dir.chdir(@git_dir) do
|
|
100
|
+
@recipe.cook
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
def after_all
|
|
105
|
+
FileUtils.rm_rf @git_dir
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
def test_patch
|
|
109
|
+
Dir.chdir(@git_dir) do
|
|
110
|
+
patch1 = File.join(work_dir, "patch 1.txt")
|
|
111
|
+
assert File.exist?(patch1), patch1
|
|
112
|
+
assert_match( /^\tchange 1/, IO.read(patch1) )
|
|
113
|
+
end
|
|
114
|
+
end
|
|
115
|
+
end
|
data/test/test_digest.rb
CHANGED
|
@@ -66,5 +66,150 @@ class TestDigest < TestCase
|
|
|
66
66
|
def test_wrong_md5
|
|
67
67
|
download_with_wrong_digest(:md5)
|
|
68
68
|
end
|
|
69
|
+
|
|
70
|
+
def public_key
|
|
71
|
+
<<-KEY
|
|
72
|
+
-----BEGIN PGP PUBLIC KEY BLOCK-----
|
|
73
|
+
Version: GnuPG v1
|
|
74
|
+
|
|
75
|
+
mI0EVwUhJQEEAMYxFhgaAdM2Ul5r+XfpqAaI7SOxB14eRjhFjhchy4ylgVxetyLq
|
|
76
|
+
di3zeANXBIHsLBl7quYTlnmhJr/+GQRkCnXWiUp0tJsBVzGM3puK7c534gakEUH6
|
|
77
|
+
AlDtj5p3IeygzSyn8u7KORv+ainXfhwkvTO04mJmxAb2uT8ngKYFdPa1ABEBAAG0
|
|
78
|
+
J1Rlc3QgTWluaXBvcnRpbGUgPHRlc3RAbWluaXBvcnRpbGUub3JnPoi4BBMBAgAi
|
|
79
|
+
BQJXBSElAhsDBgsJCAcDAgYVCAIJCgsEFgIDAQIeAQIXgAAKCRBl6D5JZMNwswAK
|
|
80
|
+
A/90Cdb+PX21weBR2Q6uR06M/alPexuXXyJL8ZcwbQMJ/pBBgcS5/h1+rQkBI/CN
|
|
81
|
+
qpXdDlw2Xys2k0sNwdjIw3hmYRzBrddXlCSW3Sifq/hS+kfPZ1snQmIjCgy1Xky5
|
|
82
|
+
QGCcPUxBUxzmra88LakkDO+euKK3hcrfeFIi611lTum1NLiNBFcFISUBBADoyY6z
|
|
83
|
+
2PwH3RWUbqv0VX1s3/JO3v3xMjCRKPlFwsNwLTBtZoWfR6Ao1ajeCuZKfzNKIQ2I
|
|
84
|
+
rn86Rcqyrq4hTj+7BTWjkIPOBthjiL1YqbEBtX7jcYRkYvdQz/IG2F4zVV6X4AAR
|
|
85
|
+
Twx7qaXNt67ArzbHCe5gLNRUK6e6OArkahMv7QARAQABiJ8EGAECAAkFAlcFISUC
|
|
86
|
+
GwwACgkQZeg+SWTDcLNFiwP/TR33ClqWOz0mpjt0xPEoZ0ORmV6fo4sjjzgQoHH/
|
|
87
|
+
KTdsabJbGp8oLQGW/mx3OxgbsAkyZymb5H5cjaF4HtSd4cxI5t1C9ZS/ytN8pqfR
|
|
88
|
+
e29SBje8DAAJn2l57s2OddXLPQ0DUwCcdNEaqgHwSk/Swxc7K+IpfvjLKHKUZZBP
|
|
89
|
+
4Ko=
|
|
90
|
+
=SVWi
|
|
91
|
+
-----END PGP PUBLIC KEY BLOCK-----
|
|
92
|
+
KEY
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
def test_with_valid_gpg_signature
|
|
96
|
+
data_file = File.expand_path(File.join(File.dirname(__FILE__), 'assets', 'gpg-fixtures', 'data'))
|
|
97
|
+
|
|
98
|
+
@recipe.files << {
|
|
99
|
+
:url => "file://#{data_file}",
|
|
100
|
+
:gpg => {
|
|
101
|
+
:key => public_key,
|
|
102
|
+
:signature_url => "file://#{data_file}.asc"
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
@recipe.download
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
def test_optional_gpg_signature_url
|
|
109
|
+
data_file = File.expand_path(File.join(File.dirname(__FILE__), 'assets', 'gpg-fixtures', 'data'))
|
|
110
|
+
|
|
111
|
+
@recipe.files << {
|
|
112
|
+
:url => "file://#{data_file}",
|
|
113
|
+
:gpg => {
|
|
114
|
+
:key => public_key
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
@recipe.download
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
def test_with_invalid_gpg_signature
|
|
121
|
+
data_file = File.expand_path(File.join(File.dirname(__FILE__), 'assets', 'gpg-fixtures', 'data'))
|
|
122
|
+
|
|
123
|
+
@recipe.files << {
|
|
124
|
+
:url => "file://#{data_file}",
|
|
125
|
+
:gpg => {
|
|
126
|
+
:key => public_key,
|
|
127
|
+
:signature_url => "file://#{data_file}.invalid.asc"
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
exception = assert_raises(RuntimeError){
|
|
131
|
+
@recipe.download
|
|
132
|
+
}
|
|
133
|
+
assert_equal("signature mismatch", exception.message)
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
def test_with_invalid_key
|
|
137
|
+
data_file = File.expand_path(File.join(File.dirname(__FILE__), 'assets', 'gpg-fixtures', 'data'))
|
|
138
|
+
|
|
139
|
+
@recipe.files << {
|
|
140
|
+
:url => "file://#{data_file}",
|
|
141
|
+
:gpg => {
|
|
142
|
+
:key => "thisisaninvalidkey",
|
|
143
|
+
:signature_url => "file://#{data_file}.asc"
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
exception = assert_raises(RuntimeError){ @recipe.download }
|
|
147
|
+
assert_equal("invalid gpg key provided", exception.message)
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
def test_with_different_key_than_one_used_to_sign
|
|
151
|
+
puts "################"
|
|
152
|
+
|
|
153
|
+
key = <<-KEY
|
|
154
|
+
-----BEGIN PGP PUBLIC KEY BLOCK-----
|
|
155
|
+
Version: GnuPG v1
|
|
156
|
+
|
|
157
|
+
mQENBE7SKu8BCADQo6x4ZQfAcPlJMLmL8zBEBUS6GyKMMMDtrTh3Yaq481HB54oR
|
|
158
|
+
0cpKL05Ff9upjrIzLD5TJUCzYYM9GQOhguDUP8+ZU9JpSz3yO2TvH7WBbUZ8FADf
|
|
159
|
+
hblmmUBLNgOWgLo3W+FYhl3mz1GFS2Fvid6Tfn02L8CBAj7jxbjL1Qj/OA/WmLLc
|
|
160
|
+
m6BMTqI7IBlYW2vyIOIHasISGiAwZfp0ucMeXXvTtt14LGa8qXVcFnJTdwbf03AS
|
|
161
|
+
ljhYrQnKnpl3VpDAoQt8C68YCwjaNJW59hKqWB+XeIJ9CW98+EOAxLAFszSyGanp
|
|
162
|
+
rCqPd0numj9TIddjcRkTA/ZbmCWK+xjpVBGXABEBAAG0IU1heGltIERvdW5pbiA8
|
|
163
|
+
bWRvdW5pbkBtZG91bmluLnJ1PohGBBARAgAGBQJO01Y/AAoJEOzw6QssFyCDVyQA
|
|
164
|
+
n3qwTZlcZgyyzWu9Cs8gJ0CXREaSAJ92QjGLT9DijTcbB+q9OS/nl16Z/IhGBBAR
|
|
165
|
+
AgAGBQJO02JDAAoJEKk3YTmlJMU+P64AnjCKEXFelSVMtgefJk3+vpyt3QX1AKCH
|
|
166
|
+
9M3MbTWPeDUL+MpULlfdyfvjj4heBBARCAAGBQJRCTwgAAoJEFGFCWhsfl6CzF0B
|
|
167
|
+
AJsQ3DJbtGcZ+0VIcM2a06RRQfBvIHqm1A/1WSYmObLGAP90lxWlNjSugvUUlqTk
|
|
168
|
+
YEEgRTGozgixSyMWGJrNwqgMYokBOAQTAQIAIgUCTtIq7wIbAwYLCQ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/Ctw/76COwn0mtXeIXLCTvBmznXfaMKllsqbsy2nCJ2P2uJjOntw=
|
|
198
|
+
=4JAR
|
|
199
|
+
-----END PGP PUBLIC KEY BLOCK-----
|
|
200
|
+
KEY
|
|
201
|
+
|
|
202
|
+
data_file = File.expand_path(File.join(File.dirname(__FILE__), 'assets', 'gpg-fixtures', 'data'))
|
|
203
|
+
|
|
204
|
+
@recipe.files << {
|
|
205
|
+
:url => "file://#{data_file}",
|
|
206
|
+
:gpg => {
|
|
207
|
+
:key => key,
|
|
208
|
+
:signature_url => "file://#{data_file}.asc"
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
exception = assert_raises(RuntimeError){ @recipe.download }
|
|
212
|
+
assert_equal("signature mismatch", exception.message)
|
|
213
|
+
end
|
|
69
214
|
end
|
|
70
215
|
|
data/test/test_download.rb
CHANGED
|
@@ -5,22 +5,24 @@ describe "recipe download" do
|
|
|
5
5
|
|
|
6
6
|
attr :recipe
|
|
7
7
|
|
|
8
|
-
def server_must_receive_connection &block
|
|
8
|
+
def server_must_receive_connection(connections = 3, &block)
|
|
9
9
|
request_count = 0
|
|
10
10
|
|
|
11
11
|
server = TCPServer.open('localhost', TestCase::HTTP_PORT)
|
|
12
12
|
thread = Thread.new do
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
connections.times do
|
|
14
|
+
conn = server.accept
|
|
15
|
+
request_count += 1
|
|
16
|
+
conn.puts "CONNECTION SUCESSFULLY MADE" rescue SystemCallError
|
|
17
|
+
conn.close
|
|
18
|
+
end
|
|
17
19
|
end
|
|
18
20
|
|
|
19
21
|
block.call
|
|
20
22
|
|
|
21
23
|
thread.kill
|
|
22
24
|
server.close
|
|
23
|
-
|
|
25
|
+
|
|
24
26
|
request_count.must_be :>, 0
|
|
25
27
|
end
|
|
26
28
|
|
|
@@ -32,21 +34,21 @@ describe "recipe download" do
|
|
|
32
34
|
describe "urls" do
|
|
33
35
|
it "ftp" do
|
|
34
36
|
@recipe.files << "ftp://localhost:#{TestCase::HTTP_PORT}/foo"
|
|
35
|
-
server_must_receive_connection do
|
|
37
|
+
server_must_receive_connection 1 do
|
|
36
38
|
@recipe.download
|
|
37
39
|
end
|
|
38
40
|
end
|
|
39
41
|
|
|
40
42
|
it "handles http" do
|
|
41
43
|
@recipe.files << "http://localhost:#{TestCase::HTTP_PORT}/foo"
|
|
42
|
-
server_must_receive_connection do
|
|
44
|
+
server_must_receive_connection 3 do
|
|
43
45
|
@recipe.download
|
|
44
46
|
end
|
|
45
47
|
end
|
|
46
48
|
|
|
47
49
|
it "handles https" do
|
|
48
50
|
@recipe.files << "https://localhost:#{TestCase::HTTP_PORT}/foo"
|
|
49
|
-
server_must_receive_connection do
|
|
51
|
+
server_must_receive_connection 3 do
|
|
50
52
|
@recipe.download
|
|
51
53
|
end
|
|
52
54
|
end
|