isup 0.0.5 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. checksums.yaml +8 -8
  2. data/bin/isup +1 -1
  3. data/lib/isup.rb +14 -8
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NTAwYjE5Y2U3YTIwZGIyMGI3ZTRkODBkZDE1MzY0NzYzZDQ3Y2VlMQ==
4
+ OWQzZDBmNThjMzc1YTZhMjE4Y2ZjYTg2MWVmYmJlZTQ0M2Q1NjgxMA==
5
5
  data.tar.gz: !binary |-
6
- ZWQ3MDUzOTU0MWU4NjFjMTQxMTc3MGU1OWUxZDM1Y2I1ZmU1ZTRmMQ==
6
+ MWVkZDI5YzI5NjhhM2FkMDQ2YzVjZDIxZWMxMjE4ODJjZjQzZTUwNg==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- ZjMwNDNhYThkZjgyMWMxNTAyNDYxZDQxNDFiOGI3NDFhNmUxMzNiNmY2N2Y2
10
- ZGUyOTllMTgyOWJhOTZmZGE2YWZiY2NhMGU3MWRjNjA2YTI1MjkxZWFjYjNm
11
- YmNhYTU4ZjE1MTYxZmIyMGI0MmIzMGI5NTc5YzU1YjQ5MGE3MGI=
9
+ MzgwM2U3YzExMTg1NzlhYWI3NzU3ZjEwYzY5NjdlNmIyYTE0ZWM2ZWNhMDBj
10
+ NWY3ZjQ2YjU5MGVhMDgwZDg0MGRiMGJhNTEwZjVjNjQ5N2IxNDg1MDNmZGIx
11
+ ZWIzODJhNDE0MWQwZjQ2ZjI2Nzc4ZTVkNmMyZWI4N2Q2ZDJmNWM=
12
12
  data.tar.gz: !binary |-
13
- OWYwMTI1YjYwYmIyODM2NzUxM2U3YzU0YWIzYzVlMTU1YWIyMTBhZTQwM2Nh
14
- MTQ4ZGQ3OTFlYjFiNjNmNGI5ZmJkNmExZDRiY2Q4YzQwNmM4MjhhZmEyMTM1
15
- MTYxZTJmZDJiOGU0ZWJmYWUwMjRkZDJkM2UxODJhM2JiZDk3ZDg=
13
+ NTM4YmU0MTM5MjI4NjRhMGUxNWEzMGJlYzZhMmU2NWI2MGU1YWM2ZjgyYTNk
14
+ Njk5ZjliMWNmNTNhMTUyYzA0ODkwZGMzNzQ3MDY0ZDIzODAxYTg1MTE2MGZm
15
+ MzkyMGIyZjEyY2FlOWE4MjFiZGMwNjI4YWE5OTk5MTI5MDRjMTE=
data/bin/isup CHANGED
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require 'isup'
4
- Isup.new(ARGV[0])
4
+ Isup.new(ARGV)
data/lib/isup.rb CHANGED
@@ -3,13 +3,19 @@ require "net/http"
3
3
  # A simple class to determine whether a website is down.
4
4
  class Isup
5
5
 
6
- def initialize(url)
7
- @url = url
8
- if valid?
9
- up?
10
- else
11
- puts "Please input a valid URL"
6
+ def initialize(args)
7
+ args.each do |x|
8
+ @url = x
9
+ @input_good = true
10
+ if (x == "-v") || (x == "--verbose")
11
+ @verbose = true
12
+ elsif valid?
13
+ up?
14
+ else
15
+ @input_good = false
16
+ end
12
17
  end
18
+ puts "Please input a valid URL." if !@input_good
13
19
  end
14
20
 
15
21
  private
@@ -42,10 +48,9 @@ class Isup
42
48
  begin
43
49
  @response = Net::HTTP.get_response(URI(uri_str))
44
50
  rescue SocketError
45
- false
51
+ @up = false
46
52
  rescue Errno::ECONNRESET
47
53
  @up = true
48
- false
49
54
  else
50
55
  case @response
51
56
  when Net::HTTPSuccess then
@@ -56,6 +61,7 @@ class Isup
56
61
  @up = false
57
62
  when Net::HTTPRedirection then
58
63
  @location = @response['location']
64
+ puts "Redirecting to #{@location}" if @verbose
59
65
  fetch(@location, limit - 1)
60
66
  else
61
67
  warn "Unable to complete the request."
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: isup
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Brinker