Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ignore Bundler 1.14.* warning messages on a non-writable home directory
In Bundler 1.14, there was a [merged pull request](rubygems/bundler#4951) that introduced new functionality. When running `bundle` if the location specified in `Bundler.rubygems.user_home` has a problem (e.g. does not exist, is not writable, is not a directory), it prints out a warning message to STDOUT. You can see an example by running in bash: ``` gem install bundler --version 1.14.3 echo "source 'https://rubygems.org';\ngem 'wkhtmltopdf-binary-edge'" > Gemfile bundle install --path vendor/bundle HOME=/no/directory/found bundle exec which wkhtmltopdf ``` When run, you can see the output looks something like: ``` Your home directory is not set properly: * `/no/directory/found` is not a directory Bundler will use `/var/folders/wj/q7cqmwds75z3ndcdxrmpd9gh0000gn/T/bundler/home/rdimarco` as your home directory temporarily ``` The problem is that the [output from `bundle exec which wkhtmltopdf`] (https://github.com/pdfkit/pdfkit/blob/master/lib/pdfkit/configuration.rb#L26) is used to determine the path to the default `wkhtmltopdf` executable. So since there is the warning included in the output, the executable path contains the warning messages and is not valid. This commit will look at the lines returned by the `witch` statement and will return the first file path that it finds, ignoring the warning messages.
- Loading branch information