Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 18 additions & 14 deletions lib/strategies/bundler_strategy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,24 @@ def name

def get_libraries
Dir.chdir(repo.file_location) do
`bundle show`
.split("\n")
.select { |line| line.strip.start_with?('*') }
.map do |line|
_, gem_name, version = line.split
version = version.gsub(/[()]/, '')
license = get_license(gem_name)

{
"name" => gem_name,
"version" => version,
"license" => license
}
end
Bundler.with_clean_env do
`bundle install`

`bundle show`
.split("\n")
.select { |line| line.strip.start_with?('*') }
.map do |line|
_, gem_name, version = line.split
version = version.gsub(/[()]/, '')
license = get_license(gem_name)

{
"name" => gem_name,
"version" => version,
"license" => license
}
end
end
end
end

Expand Down
4 changes: 4 additions & 0 deletions spec/lib/strategies/bundler_strategy_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
]
end

before do
allow(subject).to receive(:`).with('bundle install')
end

context 'with no gems' do
let(:no_gems_message) { "Could not locate Gemfile or .bundle/ directory\n" }

Expand Down