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.
414 415 416 |
# File 'lib/ayadn/diagnostics.rb', line 414 def response @response end |
Instance Method Details
#check ⇒ Object
416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 |
# File 'lib/ayadn/diagnostics.rb', line 416 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 |