diff options
author | Bundlerbot <bot@bundler.io> | 2019-12-21 23:41:35 +0000 |
---|---|---|
committer | David RodrÃguez <deivid.rodriguez@riseup.net> | 2020-01-01 20:52:49 +0100 |
commit | cc59e39de82c540e0d50d7033f913b359e5f694f (patch) | |
tree | c11ead1d54fbcca5911081ae1c99397b9414e395 | |
parent | 4da3289ebdf87b0f5f20186a35309e989cf19e4c (diff) | |
download | bundler-cc59e39de82c540e0d50d7033f913b359e5f694f.tar.gz |
Merge #7514
7514: Fix `rake build` when path has spaces on it r=colby-swandale a=deivid-rodriguez
### What was the end-user problem that led to this PR?
The problem was that `rake build` can no longer be run from a path that has spaces on it.
### What was your diagnosis of the problem?
My diagnosis was that we need to escape the path for the shell somewhere.
### What is your fix for the problem, implemented in this PR?
My fix is to add `.shellescape` at the right place.
### Why did you choose this fix out of the possible options?
I chose this fix because it fixes the problem.
Fixes #7512.
Co-authored-by: David RodrÃguez <deivid.rodriguez@riseup.net>
(cherry picked from commit 26888b6dcf420d050f4e7d963926ea97de8c7804)
-rw-r--r-- | lib/bundler/gem_helper.rb | 2 | ||||
-rw-r--r-- | spec/runtime/gem_tasks_spec.rb | 14 |
2 files changed, 15 insertions, 1 deletions
diff --git a/lib/bundler/gem_helper.rb b/lib/bundler/gem_helper.rb index 7d4e382be8..a09d03a448 100644 --- a/lib/bundler/gem_helper.rb +++ b/lib/bundler/gem_helper.rb @@ -73,7 +73,7 @@ module Bundler def build_gem file_name = nil - sh("#{gem_command} build -V #{spec_path}".shellsplit) do + sh("#{gem_command} build -V #{spec_path.shellescape}".shellsplit) do file_name = File.basename(built_gem_path) SharedHelpers.filesystem_access(File.join(base, "pkg")) {|p| FileUtils.mkdir_p(p) } FileUtils.mv(built_gem_path, "pkg") diff --git a/spec/runtime/gem_tasks_spec.rb b/spec/runtime/gem_tasks_spec.rb index 4b92de76bb..74270a2316 100644 --- a/spec/runtime/gem_tasks_spec.rb +++ b/spec/runtime/gem_tasks_spec.rb @@ -57,6 +57,20 @@ RSpec.describe "require 'bundler/gem_tasks'" do expect(err).to be_empty end + context "rake build when path has spaces" do + before do + spaced_bundled_app = tmp.join("bundled app") + FileUtils.mv bundled_app, spaced_bundled_app + Dir.chdir(spaced_bundled_app) + end + + it "still runs successfully" do + bundle! "exec rake build" + + expect(err).to be_empty + end + end + it "adds 'pkg' to rake/clean's CLOBBER" do with_gem_path_as(Spec::Path.base_system_gems.to_s) do sys_exec! %(#{rake} -e 'load "Rakefile"; puts CLOBBER.inspect') |