bindeps 0.0.7 → 0.0.8

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4e76a60c0afc4c11a9970385125f0ee4fe203321
4
- data.tar.gz: ade512a542e417f59eb6d22bf6bc190bf4119332
3
+ metadata.gz: 09a22034ecfb472bbf143443a4241f92e1bcd9a9
4
+ data.tar.gz: e867e4eaec47e2c02c26916191daef168ef2c55d
5
5
  SHA512:
6
- metadata.gz: 34dabe4eb5ff1b564123da329e4df203dc3de6ddd282accfa485bef4f24ff0b0ba451c4523c07a37bb801acacb121e4362d3a7e146125236b82068c29487d8f0
7
- data.tar.gz: 1ea12308cf81a47e09ea165bcc9e84761ae62b7cc1abc48446f4d9a3e959e3c1db0a08efbc354eb1a4fa24902e53ef73e4e43adbacdc43095e00ab865cb69f8d
6
+ metadata.gz: 7de37d58bb9a9b14f6767a7d34ad025ecad3077269d85bd832c988345b6672e3030f6fd70219d4b411604d1ba2b27db40bc9b907c2b49668891522e9766deafb
7
+ data.tar.gz: a9f18935a0be780f5df054e5a5570a21bfe5594f724cb52ec46af27ba557f6eb17e7c241f2bf32e76f89e86542bceb8a3027eebb06a52f009a70f84789dd0ed3
@@ -1,3 +1,3 @@
1
1
  module Bindeps
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
data/lib/bindeps.rb CHANGED
@@ -25,6 +25,26 @@ module Bindeps
25
25
  end
26
26
  end
27
27
 
28
+ # Check whether all dependencies are installed. Return an array of missing
29
+ # dependencies.
30
+ def self.missing dependencies
31
+ if dependencies.is_a? String
32
+ dependencies = YAML.load_file dependencies
33
+ end
34
+ tmpdir = Dir.mktmpdir
35
+ missing = []
36
+ Dir.chdir(tmpdir) do
37
+ dependencies.each_pair do |name, config|
38
+ d = Dependency.new(name,
39
+ config['binaries'],
40
+ config['version'],
41
+ config['url'])
42
+ missing << name unless d.all_installed?
43
+ end
44
+ end
45
+ missing
46
+ end
47
+
28
48
  class Dependency
29
49
 
30
50
  def initialize(name, binaries, versionconfig, urlconfig)
@@ -41,8 +61,6 @@ module Bindeps
41
61
 
42
62
  def install_missing
43
63
  unless all_installed?
44
- puts "binary dependency #{@name} not installed"
45
- puts "it will now be downloaded and installed"
46
64
  download
47
65
  unpack
48
66
  end
@@ -89,7 +107,6 @@ module Bindeps
89
107
  def all_installed?
90
108
  @binaries.each do |bin|
91
109
  unless installed? bin
92
- puts "required binary #{bin} is not installed"
93
110
  return false
94
111
  end
95
112
  end
@@ -102,20 +119,13 @@ module Bindeps
102
119
  ret = `#{@version_cmd} 2>&1`.split("\n").map{ |l| l.strip }.join('|')
103
120
  if ret && (/#{@version}/ =~ ret)
104
121
  return path
105
- else
106
- puts "installed version should have been #{@version}"
107
- puts "but it was:"
108
- puts ret
109
122
  end
110
- else
111
- puts "binary #{bin} is not in the PATH"
112
123
  end
113
124
  false
114
125
  end
115
126
 
116
127
  def install bin
117
128
  bindir = File.join(ENV['GEM_HOME'], 'bin')
118
- puts "installing #{bin} to #{bindir}"
119
129
  FileUtils.cp(bin, File.join(bindir, File.basename(bin)))
120
130
  end
121
131
 
@@ -0,0 +1,15 @@
1
+ neverinstalled:
2
+ binaries:
3
+ - neverinstalled
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
@@ -9,23 +9,19 @@ class TestBinDeps < Test::Unit::TestCase
9
9
  @data_dir = File.join(test_dir, 'data')
10
10
  end
11
11
 
12
- # teardown do
13
- #
14
- # end
15
- #
16
- # should "check if dependencies are installed" do
17
- #
18
- # end
19
- #
20
- # should "download and unpack dependencies" do
21
- # end
22
-
23
12
  should "identify and install missing dependencies" do
24
13
  test_yaml = File.join(@data_dir, 'fakebin.yaml')
25
14
  Bindeps.require test_yaml
26
15
  assert_equal 'success', `fakebin`.strip
27
16
  end
28
17
 
18
+ should "identify dependencies that are missing" do
19
+ test_yaml = File.join(@data_dir, 'neverinstalled.yaml')
20
+ missing = Bindeps.missing test_yaml
21
+ assert_equal 1, missing.length
22
+ assert_equal 'neverinstalled', missing.first
23
+ end
24
+
29
25
  should "handle case where version is not on first line" do
30
26
  test_yaml = File.join(@data_dir, 'fakebin2.yaml')
31
27
  # install fakebin2
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.7
4
+ version: 0.0.8
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-07-01 00:00:00.000000000 Z
11
+ date: 2014-07-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: which_works
@@ -149,6 +149,7 @@ files:
149
149
  - test/data/fakebin3
150
150
  - test/data/fakebin3.tgz
151
151
  - test/data/fakebin3.yaml
152
+ - test/data/neverinstalled.yaml
152
153
  - test/helper.rb
153
154
  - test/test_bindeps.rb
154
155
  homepage: https://github.com/Blahah/bindeps
@@ -171,7 +172,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
171
172
  version: '0'
172
173
  requirements: []
173
174
  rubyforge_project:
174
- rubygems_version: 2.0.6
175
+ rubygems_version: 2.1.4
175
176
  signing_key:
176
177
  specification_version: 4
177
178
  summary: binary dependency management for ruby gems
@@ -186,6 +187,7 @@ test_files:
186
187
  - test/data/fakebin3
187
188
  - test/data/fakebin3.tgz
188
189
  - test/data/fakebin3.yaml
190
+ - test/data/neverinstalled.yaml
189
191
  - test/helper.rb
190
192
  - test/test_bindeps.rb
191
193
  has_rdoc: