Skip to content

Commit

Permalink
[Changed] specify path for bundle install [#168042947]
Browse files Browse the repository at this point in the history
Signed-off-by: Jeff Jun <jjun@pivotal.io>
  • Loading branch information
pivotal-pmital authored and Pivotal-Jeff-Jun committed Mar 27, 2020
1 parent 007074c commit 431355d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
6 changes: 5 additions & 1 deletion lib/license_finder/package_managers/bundler.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# frozen_string_literal: true

require 'bundler'
require 'securerandom'

module LicenseFinder
class Bundler < PackageManager
Expand All @@ -26,7 +27,10 @@ def package_management_command
def prepare_command
ignored_groups_argument = !ignored_groups.empty? ? "--without #{ignored_groups.to_a.join(' ')}" : ''

"bundle install #{ignored_groups_argument}".strip
gem_path = SecureRandom.uuid
logger.info self.class, "Running bundle install for #{Dir.pwd} with path #{gem_path}", color: :blue

"bundle install #{ignored_groups_argument} --path #{gem_path}".strip
end

def possible_package_paths
Expand Down
8 changes: 6 additions & 2 deletions spec/lib/license_finder/package_managers/bundler_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,21 @@ def build_gemspec(name, version, dependency = nil)
end

describe '.prepare_command' do
before do
allow(SecureRandom).to receive(:uuid).and_return('some-path')
end

context 'with ignored groups' do
subject { Bundler.new(ignored_groups: Set.new(%w[dev test]), project_path: Pathname.new('.'), definition: definition) }
it 'returns the correct prepare method' do
expect(subject.prepare_command).to eq('bundle install --without dev test')
expect(subject.prepare_command).to eq('bundle install --without dev test --path some-path')
end
end

context 'without ignored groups' do
subject { Bundler.new(ignored_groups: Set.new, project_path: Pathname.new('.'), definition: definition) }
it 'returns the correct prepare method' do
expect(subject.prepare_command).to eq('bundle install')
expect(subject.prepare_command).to eq('bundle install --path some-path')
end
end
end
Expand Down

0 comments on commit 431355d

Please sign in to comment.