summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMisty De Meo <mistydemeo@github.com>2016-08-01 17:09:33 +1000
committerMisty De Meo <mistydemeo@github.com>2016-08-02 11:21:16 +1000
commit7b6dff318f84c61f633c72c65f2d8e73b9ad9364 (patch)
tree381a61deba88b2769cd0e37fbe03ef23f0dfebf1
parentc1f6dd96f899b97ae1a3972cef7e453776df1dd6 (diff)
downloadbundler-7b6dff318f84c61f633c72c65f2d8e73b9ad9364.tar.gz
doctor: return stub result if no dylib tool installed
This will eventually support other tests, so the dylib test needs to be able to to meaningfully return an empty result
-rw-r--r--lib/bundler/cli/doctor.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/bundler/cli/doctor.rb b/lib/bundler/cli/doctor.rb
index 370e46ac69..df49315b45 100644
--- a/lib/bundler/cli/doctor.rb
+++ b/lib/bundler/cli/doctor.rb
@@ -13,6 +13,14 @@ module Bundler
@options = options
end
+ def otool_available?
+ system("otool --version 2>&1 >/dev/null")
+ end
+
+ def ldd_available?
+ !system("ldd --help 2>&1 >/dev/null").nil?
+ end
+
def dylibs_darwin(path)
output = `/usr/bin/otool -L "#{path}"`.chomp
dylibs = output.split("\n")[1..-1].map {|l| l.match(DARWIN_REGEX).captures[0] }.uniq
@@ -32,8 +40,10 @@ module Bundler
def dylibs(path)
case RbConfig::CONFIG["host_os"]
when /darwin/
+ return [] unless otool_available?
dylibs_darwin(path)
when /(linux|solaris|bsd)/
+ return [] unless ldd_available?
dylibs_ldd(path)
else # Windows, etc.
Bundler.ui.warn("Dynamic library check not supported on this platform.")