Class: Cbradeps::GemfileScraper
- Inherits:
-
Object
- Object
- Cbradeps::GemfileScraper
- Defined in:
- lib/cobradeps/gemfile_scraper.rb
Defined Under Namespace
Classes: OptionParser
Instance Method Summary collapse
- #cobra_dependencies ⇒ Object
-
#initialize(root_path) ⇒ GemfileScraper
constructor
A new instance of GemfileScraper.
- #name ⇒ Object
- #to_s ⇒ Object
- #transitive_cobra_dependencies ⇒ Object
Constructor Details
#initialize(root_path) ⇒ GemfileScraper
Returns a new instance of GemfileScraper.
3 4 5 |
# File 'lib/cobradeps/gemfile_scraper.rb', line 3 def initialize(root_path) @root_path = root_path end |
Instance Method Details
#cobra_dependencies ⇒ Object
15 16 17 18 19 20 |
# File 'lib/cobradeps/gemfile_scraper.rb', line 15 def cobra_dependencies dirdep = direct_dependencies transitive_cobra_dependencies.select do |dep| dirdep.include?(dep[:name]) || dep[:options][:direct] end end |
#name ⇒ Object
7 8 9 |
# File 'lib/cobradeps/gemfile_scraper.rb', line 7 def name Pathname.new(@root_path).basename.to_s end |
#to_s ⇒ Object
11 12 13 |
# File 'lib/cobradeps/gemfile_scraper.rb', line 11 def to_s cobra_dependencies end |
#transitive_cobra_dependencies ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/cobradeps/gemfile_scraper.rb', line 22 def transitive_cobra_dependencies gem_dependencies.inject([]) do |memo, dep| if !!dep[:options][:path] absolute_dep = dep.clone absolute_dep[:options][:path] = File.(File.join(@root_path, dep[:options][:path])) memo << dep end memo end end |