lib/polariscope/scanner/dependency_context.rb in polariscope-0.4.0 vs lib/polariscope/scanner/dependency_context.rb in polariscope-0.5.0
- old
+ new
@@ -49,11 +49,11 @@
def gem_versions
@gem_versions ||= GemVersions.new(dependencies.map(&:name), spec_type: spec_type)
end
- def bundle_definition
+ def bundle_definition # rubocop:disable Metrics/MethodLength
@bundle_definition ||=
::Tempfile.create do |gemfile|
::Tempfile.create do |gemfile_lock|
gemfile.puts parseable_gemfile_content
gemfile.rewind
@@ -62,9 +62,11 @@
gemfile_lock.rewind
Bundler::Definition.build(gemfile.path, gemfile_lock.path, false)
end
end
+ rescue Bundler::Dsl::DSLError => e
+ raise Polariscope::Error, "Unable to parse the provided Gemfile/Gemfile.lock: #{e.message}"
end
def current_dependency_version(dependency)
return ruby_scanner.version if dependency.name == GemVersions::RUBY_NAME