Class: Ayadn::CheckAyadn
- Defined in:
- lib/ayadn/diagnostics.rb
Instance Attribute Summary collapse
-
#response ⇒ Object
Returns the value of attribute response.
Attributes inherited from CheckBase
Instance Method Summary collapse
Methods inherited from CheckBase
#check_response_code, #get_response, #initialize, #rescue_network
Constructor Details
This class inherits a constructor from Ayadn::CheckBase
Instance Attribute Details
#response ⇒ Object
Returns the value of attribute response.
442 443 444 |
# File 'lib/ayadn/diagnostics.rb', line 442 def response @response end |
Instance Method Details
#check ⇒ Object
444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 |
# File 'lib/ayadn/diagnostics.rb', line 444 def check begin @status.say_header "checking RubyGems server response" get_response "https://rubygems.org/api/v1/gems/ayadn.json" check_response_code @status.say_header "checking Ayadn version" info = JSON.parse(@response.body) live = info["version"] @status.say_green(:live, "version #{live}") if live != VERSION @status.say_red(:local, "version #{VERSION}") @status.say { @status.say_yellow :update, "run 'gem update ayadn' to get the last version" } else @status.say_green(:local, "version #{VERSION}") end rescue JSON::ParserError => e @status.say_error "JSON error" @status.say_trace e rescue Interrupt @status.say_error "operation canceled" exit rescue => e rescue_network(e) end end |