url-status 1.0.2 → 1.0.5
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/lib/url_status.rb +17 -1
- data/lib/url_status/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 464dd6bff417b902058f071064a0c16a15c9a537
|
4
|
+
data.tar.gz: d3188a0b1a175ff6b78626434bef465adf8f282d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 15433535e360fe36159845fb9e4e2ff8d93d86b0862d6da589a25e92e891b54576f6190419c7a668f6a8e454cf7208c1cd241683762b00b9a84ddd2349a395d3
|
7
|
+
data.tar.gz: 3c7b3ba72b743e95644c09a28bc718788af310fe2597d40276193a8ac1ed619004241494936d45cfc4c209f2c27b484da0c2c2f5487523037b6998aae2fe0d81
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
|
4
|
+
url-status (1.0.2)
|
5
5
|
colorize
|
6
6
|
rest-client (~> 1.8)
|
7
7
|
trollop
|
@@ -32,7 +32,7 @@ PLATFORMS
|
|
32
32
|
DEPENDENCIES
|
33
33
|
bundler (~> 1.12)
|
34
34
|
rake (~> 10.0)
|
35
|
-
|
35
|
+
url-status!
|
36
36
|
|
37
37
|
BUNDLED WITH
|
38
38
|
1.12.5
|
data/lib/url_status.rb
CHANGED
@@ -14,18 +14,33 @@ module UrlStatus
|
|
14
14
|
|
15
15
|
class App
|
16
16
|
def main
|
17
|
+
# we want to disable the text coloring if we are printing to a
|
18
|
+
# file, or on a platform (like windows) that likely doesn't support
|
19
|
+
# the colors
|
20
|
+
String.disable_colorization = !$stdout.isatty
|
21
|
+
|
22
|
+
success = true
|
17
23
|
url_list.each do |url|
|
18
24
|
begin
|
19
25
|
response = get_response(url)
|
26
|
+
success = success && response.ok?
|
20
27
|
code = response.ok? ? response.code.to_s.green : response.code.to_s.red
|
21
28
|
final_url = response.request.url
|
29
|
+
|
22
30
|
text = "[#{code}] #{final_url}"
|
23
31
|
text += " (requested #{url})".yellow unless final_url.include?(url)
|
24
|
-
puts text
|
32
|
+
puts text
|
25
33
|
rescue StandardError => e
|
34
|
+
success = false
|
26
35
|
puts "[#{"---".red}] #{url} (#{e.to_s.red})"
|
27
36
|
end
|
37
|
+
|
38
|
+
$stdout.flush
|
28
39
|
end
|
40
|
+
|
41
|
+
# unless *every* request completed properly, return an error code
|
42
|
+
#, then we can do something else, like send an email
|
43
|
+
exit(false) unless success
|
29
44
|
end
|
30
45
|
|
31
46
|
def url_list
|
@@ -54,6 +69,7 @@ module UrlStatus
|
|
54
69
|
begin
|
55
70
|
return RestClient.get(url)
|
56
71
|
rescue RestClient::ExceptionWithResponse => e
|
72
|
+
raise e if e.response.nil?
|
57
73
|
return e.response
|
58
74
|
end
|
59
75
|
end
|
data/lib/url_status/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: url-status
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Reed
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-11-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|