bindeps 0.0.6 → 0.0.7

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
  SHA1:
3
- metadata.gz: 73d4b195eec3ac740185d58b64202495c16c1002
4
- data.tar.gz: e555f6766653523b2891e6f3de661f063db5fa92
3
+ metadata.gz: 4e76a60c0afc4c11a9970385125f0ee4fe203321
4
+ data.tar.gz: ade512a542e417f59eb6d22bf6bc190bf4119332
5
5
  SHA512:
6
- metadata.gz: 35fc32f868bf4ef51ea93400737252bcbab8d17fddc04bc9f4d99ae936a26a2a6eef5e174388250e8feada9699cf154efacd54966f61bbe97b07af3919502e86
7
- data.tar.gz: cce17d30c4e01a02f1fb32784c5798498dfdfe1142e391283e227bae31e67882d9c612126d02b8dd7845929290042596f801de7f42c9a8b8ed33da44e0fa521f
6
+ metadata.gz: 34dabe4eb5ff1b564123da329e4df203dc3de6ddd282accfa485bef4f24ff0b0ba451c4523c07a37bb801acacb121e4362d3a7e146125236b82068c29487d8f0
7
+ data.tar.gz: 1ea12308cf81a47e09ea165bcc9e84761ae62b7cc1abc48446f4d9a3e959e3c1db0a08efbc354eb1a4fa24902e53ef73e4e43adbacdc43095e00ab865cb69f8d
data/lib/bindeps.rb CHANGED
@@ -99,7 +99,7 @@ module Bindeps
99
99
  def installed? bin
100
100
  path = Which.which(bin)
101
101
  if path
102
- ret = `#{@version_cmd}`.strip
102
+ ret = `#{@version_cmd} 2>&1`.split("\n").map{ |l| l.strip }.join('|')
103
103
  if ret && (/#{@version}/ =~ ret)
104
104
  return path
105
105
  else
@@ -1,3 +1,3 @@
1
1
  module Bindeps
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
@@ -0,0 +1,4 @@
1
+ #! /bin/sh
2
+ echo 'this is a non-matching line'
3
+ echo 'fakebin v2.0.1'
4
+ echo 'more non-matching stuff'
Binary file
@@ -0,0 +1,15 @@
1
+ fakebin:
2
+ binaries:
3
+ - fakebin2
4
+ version:
5
+ number: 2.0.1
6
+ command: fakebin2
7
+ url:
8
+ 64bit:
9
+ macosx: https://github.com/Blahah/bindeps/raw/master/test/data/fakebin2.tgz
10
+ linux: https://github.com/Blahah/bindeps/raw/master/test/data/fakebin2.tgz
11
+ unix: https://github.com/Blahah/bindeps/raw/master/test/data/fakebin2.tgz
12
+ 32bit:
13
+ macosx: https://github.com/Blahah/bindeps/raw/master/test/data/fakebin2.tgz
14
+ linux: https://github.com/Blahah/bindeps/raw/master/test/data/fakebin2.tgz
15
+ unix: https://github.com/Blahah/bindeps/raw/master/test/data/fakebin2.tgz
@@ -0,0 +1,5 @@
1
+ #! /bin/sh
2
+ # all output to stderr (some programs show version this way)
3
+ echo 'this is a non-matching line' 1>&2
4
+ echo 'fakebin v2.0.1.ERR' 1>&2
5
+ echo 'more non-matching stuff' 1>&2
Binary file
@@ -0,0 +1,15 @@
1
+ fakebin:
2
+ binaries:
3
+ - fakebin3
4
+ version:
5
+ number: 2.0.1.ERR
6
+ command: fakebin3
7
+ url:
8
+ 64bit:
9
+ macosx: https://github.com/Blahah/bindeps/raw/master/test/data/fakebin3.tgz
10
+ linux: https://github.com/Blahah/bindeps/raw/master/test/data/fakebin3.tgz
11
+ unix: https://github.com/Blahah/bindeps/raw/master/test/data/fakebin3.tgz
12
+ 32bit:
13
+ macosx: https://github.com/Blahah/bindeps/raw/master/test/data/fakebin3.tgz
14
+ linux: https://github.com/Blahah/bindeps/raw/master/test/data/fakebin3.tgz
15
+ unix: https://github.com/Blahah/bindeps/raw/master/test/data/fakebin3.tgz
data/test/test_bindeps.rb CHANGED
@@ -6,8 +6,7 @@ class TestBinDeps < Test::Unit::TestCase
6
6
 
7
7
  setup do
8
8
  test_dir = File.dirname(__FILE__)
9
- data_dir = File.join(test_dir, 'data')
10
- @test_yaml = File.join(data_dir, 'fakebin.yaml')
9
+ @data_dir = File.join(test_dir, 'data')
11
10
  end
12
11
 
13
12
  # teardown do
@@ -22,10 +21,41 @@ class TestBinDeps < Test::Unit::TestCase
22
21
  # end
23
22
 
24
23
  should "identify and install missing dependencies" do
25
- Bindeps.require @test_yaml
24
+ test_yaml = File.join(@data_dir, 'fakebin.yaml')
25
+ Bindeps.require test_yaml
26
26
  assert_equal 'success', `fakebin`.strip
27
27
  end
28
28
 
29
+ should "handle case where version is not on first line" do
30
+ test_yaml = File.join(@data_dir, 'fakebin2.yaml')
31
+ # install fakebin2
32
+ Bindeps.require test_yaml
33
+ # now Dependency should detect it as installed
34
+ deps = YAML.load_file test_yaml
35
+ deps.each_pair do |name, config|
36
+ d = Bindeps::Dependency.new(name,
37
+ config['binaries'],
38
+ config['version'],
39
+ config['url'])
40
+ assert d.installed?('fakebin2')
41
+ end
42
+ end
43
+
44
+ should "handle version output to stderr" do
45
+ test_yaml = File.join(@data_dir, 'fakebin3.yaml')
46
+ # install fakebin3
47
+ Bindeps.require test_yaml
48
+ # now Dependency should detect it as installed
49
+ deps = YAML.load_file test_yaml
50
+ deps.each_pair do |name, config|
51
+ d = Bindeps::Dependency.new(name,
52
+ config['binaries'],
53
+ config['version'],
54
+ config['url'])
55
+ assert d.installed?('fakebin3')
56
+ end
57
+ end
58
+
29
59
  end
30
60
 
31
61
  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.6
4
+ version: 0.0.7
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-06-27 00:00:00.000000000 Z
11
+ date: 2014-07-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: which_works
@@ -143,6 +143,12 @@ files:
143
143
  - test/data/fakebin
144
144
  - test/data/fakebin.tgz
145
145
  - test/data/fakebin.yaml
146
+ - test/data/fakebin2
147
+ - test/data/fakebin2.tgz
148
+ - test/data/fakebin2.yaml
149
+ - test/data/fakebin3
150
+ - test/data/fakebin3.tgz
151
+ - test/data/fakebin3.yaml
146
152
  - test/helper.rb
147
153
  - test/test_bindeps.rb
148
154
  homepage: https://github.com/Blahah/bindeps
@@ -174,6 +180,12 @@ test_files:
174
180
  - test/data/fakebin
175
181
  - test/data/fakebin.tgz
176
182
  - test/data/fakebin.yaml
183
+ - test/data/fakebin2
184
+ - test/data/fakebin2.tgz
185
+ - test/data/fakebin2.yaml
186
+ - test/data/fakebin3
187
+ - test/data/fakebin3.tgz
188
+ - test/data/fakebin3.yaml
177
189
  - test/helper.rb
178
190
  - test/test_bindeps.rb
179
191
  has_rdoc: