Class: Cbratest::GemfileScraper

Inherits:
Object
  • Object
show all
Defined in:
lib/cobratest/gemfile_scraper.rb

Instance Method Summary collapse

Constructor Details

#initialize(root_path) ⇒ GemfileScraper

Returns a new instance of GemfileScraper.



5
6
7
# File 'lib/cobratest/gemfile_scraper.rb', line 5

def initialize(root_path)
  @root_path = root_path
end

Instance Method Details

#nameObject



9
10
11
# File 'lib/cobratest/gemfile_scraper.rb', line 9

def name
  Pathname.new(@root_path).basename.to_s
end

#to_sObject



13
14
15
# File 'lib/cobratest/gemfile_scraper.rb', line 13

def to_s
  {name: name, options: {path: @root_path}}
end

#transitive_cobra_dependenciesObject



17
18
19
20
21
22
23
24
25
26
# File 'lib/cobratest/gemfile_scraper.rb', line 17

def transitive_cobra_dependencies
  gem_dependencies.inject([]) do |memo, dep|
    if !!dep[:options][:path]
      absolute_dep = dep.clone
      absolute_dep[:options][:path] = File.expand_path(File.join(@root_path, dep[:options][:path]))
      memo << dep
    end
    memo
  end
end