Class: Gurney::Source::Bundler
- Defined in:
- lib/gurney/source/bundler.rb
Instance Method Summary collapse
- #dependencies ⇒ Object
-
#initialize(gemfile_lock:) ⇒ Bundler
constructor
A new instance of Bundler.
- #present? ⇒ Boolean
Constructor Details
#initialize(gemfile_lock:) ⇒ Bundler
Returns a new instance of Bundler.
9 10 11 |
# File 'lib/gurney/source/bundler.rb', line 9 def initialize(gemfile_lock:) @gemfile_lock = gemfile_lock end |
Instance Method Details
#dependencies ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/gurney/source/bundler.rb', line 17 def dependencies if present? Dir.mktmpdir do |dir| Dir.chdir dir do File.write('Gemfile', '') # LockfileParser requires a Gemfile to be present, can be empty lockfile = ::Bundler::LockfileParser.new(@gemfile_lock) lockfile.specs.map { |spec| Dependency.new(ecosystem: 'rubygems', name: spec.name, version: spec.version.to_s) } end end end end |
#present? ⇒ Boolean
13 14 15 |
# File 'lib/gurney/source/bundler.rb', line 13 def present? !@gemfile_lock.nil? end |