Class: HR_Deploy::CheckNetworkTask

Inherits:
Task
  • Object
show all
Defined in:
lib/hr_deploy/tasks/check_network_task.rb

Instance Attribute Summary

Attributes inherited from Task

#end_time, #error, #start_time

Instance Method Summary collapse

Methods inherited from Task

#initialize, #reversal_instruction, #successful?

Constructor Details

This class inherits a constructor from HR_Deploy::Task

Instance Method Details

#runObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/hr_deploy/tasks/check_network_task.rb', line 8

def run
  print_stage 'Checking Internet connection...'

  if dry_run?
    self.success = true
    return
  end

  begin
    open('http://www.google.com')

  rescue
    self.error = 'Not connected to the Internet'
    self.success = false

  else
    print_success 'Internet connection is fine'
    self.success = true
  end
end