Class: CheckZilla::Check::Rubygem
- Inherits:
-
Object
- Object
- CheckZilla::Check::Rubygem
- Defined in:
- lib/checkzilla/check/rubygem.rb
Overview
Finally it’s matching your gem version against the last version in the rubygem api to determine what is up-to-date
Instance Attribute Summary collapse
-
#path ⇒ Object
Returns the value of attribute path.
-
#results ⇒ Object
Returns the value of attribute results.
Instance Method Summary collapse
-
#initialize(&block) ⇒ Rubygem
constructor
A new instance of Rubygem.
- #perform! ⇒ Object
Constructor Details
#initialize(&block) ⇒ Rubygem
Returns a new instance of Rubygem.
21 22 23 24 25 |
# File 'lib/checkzilla/check/rubygem.rb', line 21 def initialize &block @results = {} instance_eval(&block) if block_given? self end |
Instance Attribute Details
#path ⇒ Object
Returns the value of attribute path.
18 19 20 |
# File 'lib/checkzilla/check/rubygem.rb', line 18 def path @path end |
#results ⇒ Object
Returns the value of attribute results.
19 20 21 |
# File 'lib/checkzilla/check/rubygem.rb', line 19 def results @results end |
Instance Method Details
#perform! ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/checkzilla/check/rubygem.rb', line 27 def perform! dependencies = @path && gemfilelock_exists? ? deps_from_gemfilelock : deps_from_gem_list dependencies.each do |gem_name, gem_version| rubygems_response = Net::HTTP.get_response("rubygems.org","/api/v1/gems/#{gem_name}.json") if rubygems_response.code.to_i >= 400 puts "#{rubygems_response.code} on rubygems.org for #{gem_name}: #{rubygems_response.body}" next end newer_version = JSON.parse(rubygems_response.body)['version'] @results[gem_name] = [gem_version, newer_version] if gem_version != newer_version end end |