Class: Natives::GemfileViewer

Inherits:
Object
  • Object
show all
Defined in:
lib/natives/gemfile_viewer.rb

Instance Method Summary collapse

Constructor Details

#initialize(gemfile_path) ⇒ GemfileViewer

Returns a new instance of GemfileViewer.



5
6
7
8
# File 'lib/natives/gemfile_viewer.rb', line 5

def initialize(gemfile_path)
  @gemfile_path = File.expand_path(gemfile_path)
  @lockfile_path = "#{@gemfile_path}.lock"
end

Instance Method Details

#gem_namesObject



10
11
12
13
# File 'lib/natives/gemfile_viewer.rb', line 10

def gem_names
  lockfile = Bundler::LockfileParser.new(Bundler.read_file(@lockfile_path))
  lockfile.specs.map(&:name)
end