bindeps 1.1.2 → 1.2.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: ccc4c9b6b12aa39eeca92f3ed58fbf8740d4f132
4
- data.tar.gz: 99b87a1e44f339a21077da11ec44c2bee9c9185b
3
+ metadata.gz: 74eff957e81c9566dfc40705887561816cc26905
4
+ data.tar.gz: 4e00ae4f42c5d9af3e910a32a4e17e7d811f0d3c
5
5
  SHA512:
6
- metadata.gz: e92b9af3e4a8f712ca2a3f5ba5707cf236b6512e72431387c5952b4ec582788cf00c7d8feaf84f153ee9c4a9219c92aac1f84a4db590525459fb4a182b02bb05
7
- data.tar.gz: 8ccb82c363feffe8938688aeb97ae457637c3a80090c2a72776f4566a54321520fc458918c355416b86e88e20f2c44ce7c4b51d7fd73b822a0a06ad07a1b25af
6
+ metadata.gz: 75ecdcde7c39fee9581ac6db23f76221f7f167efa318367672fbe456a97c44df0e407bcc97cf195b207e2cd9ad8b32c87f5edf8ec92fdfc69dd8ace71b5fca65
7
+ data.tar.gz: 716dabef22b28961c101eaab322efc503c9fac190df05a815e3f6d2cb07f133842457488d01c886487c06d4acfc26c48dc9dffc6149ece3b5d32663787627221
data/README.md CHANGED
@@ -15,26 +15,6 @@ Simple binary dependency management for Ruby gems
15
15
  $ gem install bindeps
16
16
  ```
17
17
 
18
- ### Using Bundler
19
-
20
- Add this line to your application's Gemfile:
21
-
22
- ```
23
- gem 'bindeps'
24
- ```
25
-
26
- And then execute:
27
-
28
- ```bash
29
- $ bundle
30
- ```
31
-
32
- Or install it yourself as:
33
-
34
- ```bash
35
- $ gem install bindeps
36
- ```
37
-
38
18
  ## Usage
39
19
 
40
20
  Create a YAML file describing your dependencies as a dictionary. Read the [bindeps YAML format specifications](wiki/bindeps_YAML_format_specifications).
@@ -71,6 +51,15 @@ Bindeps.require 'binary_dependencies.yaml'
71
51
 
72
52
  `bindeps` will check run the `version:command` for each dependency. If the return value of the command doesn't match a regular expression test against the `version:number` field, `bindeps` will download the file that matches your system architecture, unpack it unless `unpack` is set to false, and place the binary in your path. Specifically, it is added to the `bin` directory of your RubyGems installation. This means the binary will be in the PATH as long as this version of RubyGems is in use (which is ideal for gem dependencies). If the return value does match, `bindeps` will do nothing.
73
53
 
54
+ ### Specifying an install directory
55
+
56
+ Simply pass the destination directory as the second argument to `Bindeps::require()`:
57
+
58
+ ```ruby
59
+ Bindeps.require('deps.yaml', '/some/install/directory')
60
+
61
+ ```
62
+
74
63
  ## Contributing
75
64
 
76
65
  1. Fork it
data/lib/bindeps.rb CHANGED
@@ -10,7 +10,7 @@ module Bindeps
10
10
  class DownloadFailedError < StandardError; end
11
11
  class UnsupportedSystemError < StandardError; end
12
12
 
13
- def self.require dependencies
13
+ def self.require(dependencies, destdir = '')
14
14
  if dependencies.is_a? String
15
15
  dependencies = YAML.load_file dependencies
16
16
  end
@@ -25,7 +25,7 @@ module Bindeps
25
25
  config['url'],
26
26
  unpack,
27
27
  libraries)
28
- d.install_missing
28
+ d.install_missing destdir
29
29
  end
30
30
  end
31
31
  end
@@ -77,11 +77,11 @@ module Bindeps
77
77
  @unpack = unpack
78
78
  end
79
79
 
80
- def install_missing
80
+ def install_missing destdir=''
81
81
  unless all_installed?
82
82
  puts "Installing #{@name} (#{@version})..."
83
83
  download
84
- unpack
84
+ unpack destdir
85
85
  end
86
86
  end
87
87
 
@@ -124,7 +124,7 @@ module Bindeps
124
124
  end
125
125
  end
126
126
 
127
- def unpack
127
+ def unpack destdir = ''
128
128
  archive = File.basename(@url)
129
129
  Unpacker.archive? archive
130
130
  if @unpack
@@ -135,13 +135,15 @@ module Bindeps
135
135
  if @binaries.include?(file) || @libraries.include?(file)
136
136
  dir = File.dirname(extracted).split(File::PATH_SEPARATOR).last
137
137
  dir = %w[bin lib].include?(dir) ? dir : '.'
138
- install(extracted, dir) unless File.directory?(extracted)
138
+ unless File.directory?(extracted)
139
+ install(extracted, dir, destdir)
140
+ end
139
141
  end
140
142
  end
141
143
  end
142
144
  end
143
145
  else
144
- install(@binaries.first, 'bin')
146
+ install(@binaries.first, 'bin', destdir)
145
147
  end
146
148
  end
147
149
 
@@ -173,11 +175,13 @@ module Bindeps
173
175
  false
174
176
  end
175
177
 
176
- def install(src, destprefix)
178
+ def install(src, destprefix, destdir = '')
177
179
  gem_home = ENV['GEM_HOME']
178
180
  home = ENV['HOME']
179
181
  basedir = File.join(home, '.local')
180
- if gem_home.nil?
182
+ if destdir.length > 0
183
+ basedir = destdir
184
+ elsif gem_home.nil?
181
185
  ENV['PATH'] = ENV['PATH'] + ":#{File.join(basedir, 'bin')}"
182
186
  else
183
187
  basedir = ENV['GEM_HOME']
@@ -1,3 +1,3 @@
1
1
  module Bindeps
2
- VERSION = "1.1.2"
2
+ VERSION = "1.2.0"
3
3
  end
data/test/test_bindeps.rb CHANGED
@@ -165,6 +165,16 @@ class TestBindeps < Test::Unit::TestCase
165
165
  assert_equal msg, `fakebin2`.strip
166
166
  end
167
167
 
168
+ should "install to a custom directory if specified" do
169
+ Dir.mktmpdir do |dir|
170
+ test_yaml = File.join(@data_dir, 'fakebin.yaml')
171
+ Bindeps.require(test_yaml, dir)
172
+ bindest = File.join(dir, 'bin', 'fakebin')
173
+ assert File.exist?(bindest)
174
+ assert_equal `#{bindest}`.chomp, 'success'
175
+ end
176
+ end
177
+
168
178
  should "handle lib dependencies" do
169
179
  test_yaml = File.join(@data_dir, 'fakelibbin.yaml')
170
180
  Bindeps.require test_yaml
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: 1.1.2
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Smith-Unna
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-02-07 00:00:00.000000000 Z
12
+ date: 2015-06-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fixwhich