Class: GemfileReader::Reader

Inherits:
Object
  • Object
show all
Defined in:
lib/gemfile_reader/reader.rb

Constant Summary collapse

COMMENT_REGEX =
/^\s*#/
GEM_REGEX =
/gem\s*['"]([a-z_-]+)['"]/
RUBY_GEMS_API_URI =
"https://rubygems.org/api/v1/gems"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(gemfile_path = "Gemfile") ⇒ Reader

Returns a new instance of Reader.



15
16
17
18
19
# File 'lib/gemfile_reader/reader.rb', line 15

def initialize(gemfile_path = "Gemfile")
  @gemfile_path = gemfile_path
  @local_gems = []
  @missing_gems = []
end

Instance Attribute Details

#gemfile_pathObject (readonly)

Returns the value of attribute gemfile_path.



13
14
15
# File 'lib/gemfile_reader/reader.rb', line 13

def gemfile_path
  @gemfile_path
end

#local_gemsObject (readonly)

Returns the value of attribute local_gems.



13
14
15
# File 'lib/gemfile_reader/reader.rb', line 13

def local_gems
  @local_gems
end

#missing_gemsObject (readonly)

Returns the value of attribute missing_gems.



13
14
15
# File 'lib/gemfile_reader/reader.rb', line 13

def missing_gems
  @missing_gems
end

Instance Method Details

#callObject



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/gemfile_reader/reader.rb', line 21

def call
  Sync do
    gems_list.map do |gem_name|
      Async { fetch_gem_description(gem_name) }
    end.map(&:wait)
  end
  pp "Local gems:"
  pp local_gems
  pp "Missing gems:"
  pp missing_gems
end