bindeps 0.1.3 → 1.0.0

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: b07814f574d3695f940067291571a19c0f11f69c
4
- data.tar.gz: 605a2ec27508c8c87b1e7275d9f091333c7aa9ea
3
+ metadata.gz: 133fb10206978ebdb1caf2c391eea280bcfadead
4
+ data.tar.gz: 8fe29388274cc23ad9d8511cf6bde24e6f082dc3
5
5
  SHA512:
6
- metadata.gz: 2e70535f6f0a477b8c43c8868481431cf71dd0f758d7f42047ebdb3a119045bd6131efa1a8668b54c7c38faaa15627e34d145d6ab1ad26c3f4fd91e58cda3c78
7
- data.tar.gz: c28a30941eed04bab4bfd078d5eaf3f193e39ffa0794b69563e11a9eff283cfc03b9b3f760061c0b51bb636ea6783193475a8162ab6eca54a9a1f4fc45bb5256
6
+ metadata.gz: 3bbca5560b97ee4f77906a24e541bb1d71041eb19a8fe4011074c77f1e4758b4c57198c01c742258da704fdfcc509cdb4223bfc73bd703048c47357113926a9b
7
+ data.tar.gz: 8bce1184e71c3d7b8a60338f18ccc2181ecbb835e46a3ffd738867203ae3bb604160a849be8677f9a0515d891cea30ad6712287df02750f44ecff6248d422a27
data/bindeps.gemspec CHANGED
@@ -18,8 +18,8 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_dependency 'which', '~> 0.0', '>= 0.0.2'
22
- spec.add_dependency "which_works"
21
+ spec.add_dependency 'fixwhich', '~> 1.0', '>= 1.0.2'
22
+ spec.add_dependency 'downloadr', '~> 0.0', '>= 0.0.41'
23
23
 
24
24
  spec.add_development_dependency "bundler", "~> 1.3"
25
25
  spec.add_development_dependency 'rake', '~> 10.3', '>= 10.3.2'
data/lib/bindeps.rb CHANGED
@@ -1,8 +1,9 @@
1
1
  require "bindeps/version"
2
2
  require "unpacker"
3
- require "which_works"
3
+ require "fixwhich"
4
4
  require "tmpdir"
5
5
  require "yaml"
6
+ require "downloadr"
6
7
 
7
8
  module Bindeps
8
9
 
@@ -53,6 +54,8 @@ module Bindeps
53
54
 
54
55
  attr_reader :name, :version, :binaries
55
56
 
57
+ include Which
58
+
56
59
  def initialize(name, binaries, versionconfig, urlconfig, unpack)
57
60
  @name = name
58
61
  unless binaries.is_a? Array
@@ -92,23 +95,7 @@ module Bindeps
92
95
  end
93
96
 
94
97
  def download
95
- curl = which('curl').first
96
- wget = which('wget').first
97
- if curl
98
- cmd = "#{curl} -O -J -L #{@url}"
99
- stdout, stderr, status = Open3.capture3 cmd
100
- elsif wget
101
- cmd = "#{wget} #{@url}"
102
- stdout, stderr, status = Open3.capture3 cmd
103
- else
104
- msg = "You don't have curl or wget?! What kind of computer is "
105
- msg << "this?! Windows?! BeOS? OS/2?"
106
- raise DownloadFailedError.new(msg)
107
- end
108
- if !status.success?
109
- raise DownloadFailedError,
110
- "download of #{@url} for #{@name} failed:\n#{stdout}\n#{stderr}"
111
- end
98
+ Downloadr::HTTP.download @url
112
99
  end
113
100
 
114
101
  def unpack
@@ -139,7 +126,7 @@ module Bindeps
139
126
  end
140
127
 
141
128
  def installed? bin
142
- path = Which.which(bin)
129
+ path = which(bin)
143
130
  if path
144
131
  ret = `#{@version_cmd} 2>&1`.split("\n").map{ |l| l.strip }.join('|')
145
132
  if ret && (/#{@version}/ =~ ret)
@@ -1,3 +1,3 @@
1
1
  module Bindeps
2
- VERSION = "0.1.3"
2
+ VERSION = "1.0.0"
3
3
  end
data/lib/unpacker.rb CHANGED
@@ -23,9 +23,9 @@
23
23
 
24
24
  require 'fileutils'
25
25
  require 'tmpdir'
26
- require 'which'
27
- include Which
26
+ require 'fixwhich'
28
27
  require 'open3'
28
+ include Which
29
29
 
30
30
  module Unpacker
31
31
 
data/test/test_bindeps.rb CHANGED
@@ -90,51 +90,6 @@ class TestBindeps < Test::Unit::TestCase
90
90
  Gem::Platform.local.cpu = original_cpu
91
91
  end
92
92
 
93
- should "fallback to wget when curl is not available" do
94
- # set up fake OS
95
- original_os = RbConfig::CONFIG['host_os']
96
- RbConfig::CONFIG['host_os'] = 'solaris'
97
- original_cpu = Gem::Platform.local.cpu
98
- Gem::Platform.local.cpu = 'x86_64'
99
- # create config
100
- urlconfig = { '64bit' => { 'unix' => 'url' } }
101
- versionconfig = { 'number' => 1, 'command' => 'getversion' }
102
-
103
- # with only wget in the path
104
- original_path = ENV['PATH']
105
- ENV['PATH'] = File.expand_path(@data_dir)
106
- assert_nothing_raised Bindeps::DownloadFailedError do
107
- dep = Bindeps::Dependency.new('test', ['binary'],
108
- versionconfig, urlconfig, false)
109
- dep.download
110
- end
111
-
112
- # with neither curl nor wget
113
- ENV['PATH'] = ""
114
- assert_raise Bindeps::DownloadFailedError do
115
- dep = Bindeps::Dependency.new('test', ['binary'],
116
- versionconfig, urlconfig, false)
117
- dep.download
118
- end
119
-
120
- # restore path
121
- ENV['PATH'] = original_path
122
- # when download doesn't actually work
123
- assert_raise Bindeps::DownloadFailedError do
124
- dep = Bindeps::Dependency.new('test', ['binary'],
125
- versionconfig, urlconfig, false)
126
- dep.download
127
- end
128
-
129
- # restore real OS
130
- RbConfig::CONFIG['host_os'] = original_os
131
- Gem::Platform.local.cpu = original_cpu
132
- end
133
-
134
- should "fail when no downloader is available" do
135
-
136
- end
137
-
138
93
  should "initialize" do
139
94
  assert_nothing_raised do
140
95
  Bindeps::Dependency.new(
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bindeps
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Smith-Unna
@@ -9,42 +9,48 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-10-18 00:00:00.000000000 Z
12
+ date: 2014-12-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: which
15
+ name: fixwhich
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
18
  - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: '0.0'
20
+ version: '1.0'
21
21
  - - ">="
22
22
  - !ruby/object:Gem::Version
23
- version: 0.0.2
23
+ version: 1.0.2
24
24
  type: :runtime
25
25
  prerelease: false
26
26
  version_requirements: !ruby/object:Gem::Requirement
27
27
  requirements:
28
28
  - - "~>"
29
29
  - !ruby/object:Gem::Version
30
- version: '0.0'
30
+ version: '1.0'
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 0.0.2
33
+ version: 1.0.2
34
34
  - !ruby/object:Gem::Dependency
35
- name: which_works
35
+ name: downloadr
36
36
  requirement: !ruby/object:Gem::Requirement
37
37
  requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '0.0'
38
41
  - - ">="
39
42
  - !ruby/object:Gem::Version
40
- version: '0'
43
+ version: 0.0.41
41
44
  type: :runtime
42
45
  prerelease: false
43
46
  version_requirements: !ruby/object:Gem::Requirement
44
47
  requirements:
48
+ - - "~>"
49
+ - !ruby/object:Gem::Version
50
+ version: '0.0'
45
51
  - - ">="
46
52
  - !ruby/object:Gem::Version
47
- version: '0'
53
+ version: 0.0.41
48
54
  - !ruby/object:Gem::Dependency
49
55
  name: bundler
50
56
  requirement: !ruby/object:Gem::Requirement