diff options
author | The Bundler Bot <bot@bundler.io> | 2017-08-18 03:46:33 +0000 |
---|---|---|
committer | The Bundler Bot <bot@bundler.io> | 2017-08-18 03:46:33 +0000 |
commit | da6a52a9b255147b389d29e2b22ce397bbb8377b (patch) | |
tree | e856eacae2c989e437557f8d06d4ef87db9dd32b /spec/support/builders.rb | |
parent | 1f4e890304a5dae7c83d40305e2d878ca7c0362e (diff) | |
parent | 4bc46ea111ddd8b124ec0c75a288040dd46416cc (diff) | |
download | bundler-da6a52a9b255147b389d29e2b22ce397bbb8377b.tar.gz |
Auto merge of #5933 - NickLaMuro:bundle-pristine-respect-bundler-config, r=segiddins
Use Bundler::Installer for bundle pristine
Fixes bundler pristine to respect the `bundle config` options for particular gems. In my particular case, on OSX I have a keg version of `pg` and a bundle config with the following entry:
```console
$ bundle config
...
build.pg
Set for the current user (/Users/nicklamuro/.bundle/config): "--with-pg-config=/usr/local/Cellar/postgresql@9.5/9.5.6/bin/pg_config"
```
This would not be respected
What was the end-user problem that led to this PR?
--------------------------------------------------
See above, but steps to reproduce (requires `bundler` >= 1.15):
1. Install postgres on your machine if it is not already there (OS dependent)
2. Add the following bundler build arg for `pg`:
```console
$ bundle config build.pg -- --with-pg-config=$(which pg_config)
```
2. Make sure `pg_config` is not in your `$PATH`:
```console
$ export PATH=$(echo "$PATH" | sed "s|:$(dirname $(which pg_conf)))||")
```
* Create a simple project with `pg` as a single gem in your Gemfile:
```
# Gemfile
gem "pg"
```
* Bundle:
```console
$ bundle install
```
* Attempt to `bundle pristine` (you should get an error):
```console
$ bundle pristine
```
What was your diagnosis of the problem?
---------------------------------------
The newly added `bundle pristine` did no use the same code that was used by `bundle install` to execute the re-installation of the gem.
What is your fix for the problem, implemented in this PR?
---------------------------------------------------------
By making use of the `Bundler::Installer` and `Bundler::Installer::GemInstaller` code that is already used with `bundle install`, we can reuse the code that injects the `bundle config` options into each gem that is being installed.
Why did you choose this fix out of the possible options?
--------------------------------------------------------
Didn't want to repeat code that was already being used elsewhere. Caused a few lines of code to be added that weren't there previously, but nothing obscene.
Diffstat (limited to 'spec/support/builders.rb')
-rw-r--r-- | spec/support/builders.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/spec/support/builders.rb b/spec/support/builders.rb index af91c5e6a7..93b173a5d0 100644 --- a/spec/support/builders.rb +++ b/spec/support/builders.rb @@ -563,10 +563,17 @@ module Spec write "ext/extconf.rb", <<-RUBY require "mkmf" + # exit 1 unless with_config("simple") extension_name = "very_simple_binary_c" - dir_config extension_name + if extra_lib_dir = with_config("ext-lib") + # add extra libpath if --with-ext-lib is + # passed in as a build_arg + dir_config extension_name, nil, extra_lib_dir + else + dir_config extension_name + end create_makefile extension_name RUBY write "ext/very_simple_binary.c", <<-C |