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.
7 8 9 |
# File 'lib/gurney/source/bundler.rb', line 7 def initialize(gemfile_lock:) @gemfile_lock = gemfile_lock end |
Instance Method Details
#dependencies ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/gurney/source/bundler.rb', line 15 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
11 12 13 |
# File 'lib/gurney/source/bundler.rb', line 11 def present? !@gemfile_lock.nil? end |