bindeps 0.0.8 → 0.0.9
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 +4 -4
- data/lib/bindeps/version.rb +1 -1
- data/lib/bindeps.rb +17 -9
- data/lib/unpacker.rb +5 -2
- data/test/data/fakebin.yaml +1 -0
- data/test/data/fakebin2.yaml +1 -0
- data/test/data/fakebin3.yaml +1 -0
- data/test/data/fakebin4 +5 -0
- data/test/data/fakebin4.yaml +16 -0
- data/test/test_bindeps.rb +27 -2
- metadata +7 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ba2bd3ec00323dc75661e16bc266e0b1d202b0f4
|
4
|
+
data.tar.gz: e37fc32f751c0c180b2268fc211ef7e62db980f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bae6e6b44f6b00bd1969179b0def3926ef8759b0dad9482ec856d18337fce9d48c3b53ce4f9b30a8fb50e11504a5d8666a30946620325f6b19606ebf2ddcfe2b
|
7
|
+
data.tar.gz: 5ccf3296ea9243c62477354271bb9cf3311cce11d6f06f2a85e3a231079020a34fbe66c23148942abcb7db3a12b96899db976bd8329b97eb777f1a0621a54618
|
data/lib/bindeps/version.rb
CHANGED
data/lib/bindeps.rb
CHANGED
@@ -19,7 +19,8 @@ module Bindeps
|
|
19
19
|
d = Dependency.new(name,
|
20
20
|
config['binaries'],
|
21
21
|
config['version'],
|
22
|
-
config['url']
|
22
|
+
config['url'],
|
23
|
+
config['unpack'])
|
23
24
|
d.install_missing
|
24
25
|
end
|
25
26
|
end
|
@@ -38,7 +39,8 @@ module Bindeps
|
|
38
39
|
d = Dependency.new(name,
|
39
40
|
config['binaries'],
|
40
41
|
config['version'],
|
41
|
-
config['url']
|
42
|
+
config['url'],
|
43
|
+
config['unpack'])
|
42
44
|
missing << name unless d.all_installed?
|
43
45
|
end
|
44
46
|
end
|
@@ -47,7 +49,7 @@ module Bindeps
|
|
47
49
|
|
48
50
|
class Dependency
|
49
51
|
|
50
|
-
def initialize(name, binaries, versionconfig, urlconfig)
|
52
|
+
def initialize(name, binaries, versionconfig, urlconfig, unpack)
|
51
53
|
@name = name
|
52
54
|
unless binaries.is_a? Array
|
53
55
|
raise ArgumentError,
|
@@ -57,6 +59,7 @@ module Bindeps
|
|
57
59
|
@version = versionconfig['number']
|
58
60
|
@version_cmd = versionconfig['command']
|
59
61
|
@url = choose_url urlconfig
|
62
|
+
@unpack = unpack
|
60
63
|
end
|
61
64
|
|
62
65
|
def install_missing
|
@@ -93,14 +96,18 @@ module Bindeps
|
|
93
96
|
|
94
97
|
def unpack
|
95
98
|
archive = File.basename(@url)
|
96
|
-
|
97
|
-
|
98
|
-
Dir
|
99
|
-
|
100
|
-
|
99
|
+
if @unpack
|
100
|
+
Unpacker.unpack(archive) do |dir|
|
101
|
+
Dir.chdir dir do
|
102
|
+
Dir['**/*'].each do |extracted|
|
103
|
+
if @binaries.include? File.basename(extracted)
|
104
|
+
install(extracted) unless File.directory?(extracted)
|
105
|
+
end
|
101
106
|
end
|
102
107
|
end
|
103
108
|
end
|
109
|
+
else
|
110
|
+
install(@binaries.first)
|
104
111
|
end
|
105
112
|
end
|
106
113
|
|
@@ -126,7 +133,8 @@ module Bindeps
|
|
126
133
|
|
127
134
|
def install bin
|
128
135
|
bindir = File.join(ENV['GEM_HOME'], 'bin')
|
129
|
-
|
136
|
+
install_location = File.join(bindir, File.basename(bin))
|
137
|
+
FileUtils.install(bin, install_location, :mode => 0775)
|
130
138
|
end
|
131
139
|
|
132
140
|
end
|
data/lib/unpacker.rb
CHANGED
@@ -23,6 +23,7 @@
|
|
23
23
|
|
24
24
|
require 'fileutils'
|
25
25
|
require 'tmpdir'
|
26
|
+
require 'open3'
|
26
27
|
|
27
28
|
module Unpacker
|
28
29
|
|
@@ -44,8 +45,10 @@ module Unpacker
|
|
44
45
|
else
|
45
46
|
raise UnrecognizedArchiveError
|
46
47
|
end
|
47
|
-
|
48
|
-
|
48
|
+
stdout, stderr, status = Open3.capture3 cmd
|
49
|
+
if !status.success?
|
50
|
+
raise RuntimeError.new("There was a problem unpacking #{file}\n#{stderr}")
|
51
|
+
end
|
49
52
|
block.call Dir.new(dir)
|
50
53
|
end
|
51
54
|
end
|
data/test/data/fakebin.yaml
CHANGED
data/test/data/fakebin2.yaml
CHANGED
data/test/data/fakebin3.yaml
CHANGED
data/test/data/fakebin4
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
fakebin:
|
2
|
+
binaries:
|
3
|
+
- fakebin4
|
4
|
+
version:
|
5
|
+
number: 4.0.1
|
6
|
+
command: fakebin4
|
7
|
+
url:
|
8
|
+
64bit:
|
9
|
+
macosx: https://github.com/cboursnell/bindeps/raw/master/test/data/fakebin4
|
10
|
+
linux: https://github.com/cboursnell/bindeps/raw/master/test/data/fakebin4
|
11
|
+
unix: https://github.com/cboursnell/bindeps/raw/master/test/data/fakebin4
|
12
|
+
32bit:
|
13
|
+
macosx: https://github.com/cboursnell/bindeps/raw/master/test/data/fakebin4
|
14
|
+
linux: https://github.com/cboursnell/bindeps/raw/master/test/data/fakebin4
|
15
|
+
unix: https://github.com/cboursnell/bindeps/raw/master/test/data/fakebin4
|
16
|
+
unpack: false
|
data/test/test_bindeps.rb
CHANGED
@@ -9,6 +9,15 @@ class TestBinDeps < Test::Unit::TestCase
|
|
9
9
|
@data_dir = File.join(test_dir, 'data')
|
10
10
|
end
|
11
11
|
|
12
|
+
teardown do
|
13
|
+
# delete fake binaries from
|
14
|
+
bindir = File.join(ENV['GEM_HOME'], 'bin')
|
15
|
+
`rm #{bindir}/fakebin` if File.exist?("#{bindir}/fakebin")
|
16
|
+
`rm #{bindir}/fakebin2` if File.exist?("#{bindir}/fakebin2")
|
17
|
+
`rm #{bindir}/fakebin3` if File.exist?("#{bindir}/fakebin3")
|
18
|
+
`rm #{bindir}/fakebin4` if File.exist?("#{bindir}/fakebin4")
|
19
|
+
end
|
20
|
+
|
12
21
|
should "identify and install missing dependencies" do
|
13
22
|
test_yaml = File.join(@data_dir, 'fakebin.yaml')
|
14
23
|
Bindeps.require test_yaml
|
@@ -32,7 +41,8 @@ class TestBinDeps < Test::Unit::TestCase
|
|
32
41
|
d = Bindeps::Dependency.new(name,
|
33
42
|
config['binaries'],
|
34
43
|
config['version'],
|
35
|
-
config['url']
|
44
|
+
config['url'],
|
45
|
+
config['unpack'])
|
36
46
|
assert d.installed?('fakebin2')
|
37
47
|
end
|
38
48
|
end
|
@@ -47,11 +57,26 @@ class TestBinDeps < Test::Unit::TestCase
|
|
47
57
|
d = Bindeps::Dependency.new(name,
|
48
58
|
config['binaries'],
|
49
59
|
config['version'],
|
50
|
-
config['url']
|
60
|
+
config['url'],
|
61
|
+
config['unpack'])
|
51
62
|
assert d.installed?('fakebin3')
|
52
63
|
end
|
53
64
|
end
|
54
65
|
|
66
|
+
should "handle binaries that don't need to be unpacked" do
|
67
|
+
test_yaml = File.join(@data_dir, 'fakebin4.yaml')
|
68
|
+
Bindeps.require test_yaml
|
69
|
+
deps = YAML.load_file test_yaml
|
70
|
+
deps.each_pair do |name, config|
|
71
|
+
d = Bindeps::Dependency.new(name,
|
72
|
+
config['binaries'],
|
73
|
+
config['version'],
|
74
|
+
config['url'],
|
75
|
+
config['unpack'])
|
76
|
+
assert d.installed?('fakebin4'), "fakebin4 installed"
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
55
80
|
end
|
56
81
|
|
57
82
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bindeps
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Smith-Unna
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-08-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: which_works
|
@@ -149,6 +149,8 @@ files:
|
|
149
149
|
- test/data/fakebin3
|
150
150
|
- test/data/fakebin3.tgz
|
151
151
|
- test/data/fakebin3.yaml
|
152
|
+
- test/data/fakebin4
|
153
|
+
- test/data/fakebin4.yaml
|
152
154
|
- test/data/neverinstalled.yaml
|
153
155
|
- test/helper.rb
|
154
156
|
- test/test_bindeps.rb
|
@@ -172,7 +174,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
172
174
|
version: '0'
|
173
175
|
requirements: []
|
174
176
|
rubyforge_project:
|
175
|
-
rubygems_version: 2.
|
177
|
+
rubygems_version: 2.0.6
|
176
178
|
signing_key:
|
177
179
|
specification_version: 4
|
178
180
|
summary: binary dependency management for ruby gems
|
@@ -187,6 +189,8 @@ test_files:
|
|
187
189
|
- test/data/fakebin3
|
188
190
|
- test/data/fakebin3.tgz
|
189
191
|
- test/data/fakebin3.yaml
|
192
|
+
- test/data/fakebin4
|
193
|
+
- test/data/fakebin4.yaml
|
190
194
|
- test/data/neverinstalled.yaml
|
191
195
|
- test/helper.rb
|
192
196
|
- test/test_bindeps.rb
|