vantage 0.0.6 → 0.0.7
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.
- data/lib/vantage/cli.rb +17 -9
- data/lib/vantage/config.rb +4 -0
- data/lib/vantage/version.rb +1 -1
- metadata +3 -2
data/lib/vantage/cli.rb
CHANGED
@@ -10,21 +10,29 @@ module Vantage
|
|
10
10
|
|
11
11
|
def run!
|
12
12
|
ARGV.options do |o|
|
13
|
+
list = false
|
13
14
|
urls = []
|
14
|
-
point =
|
15
|
+
point = Vantage::Config.point_list.sample
|
15
16
|
|
16
17
|
o.set_summary_indent(" ")
|
17
|
-
o.banner ="Usage:
|
18
|
+
o.banner = "Usage: vantage [OPTIONS]"
|
19
|
+
o.banner += "\nExample: vantage -u http://google.com,http://yahoo.com"
|
20
|
+
o.on('-l', '--list-points', 'List allowed vantage points') { list = true }
|
18
21
|
o.on('-u', '--urls URLS', Array, 'List of urls to check') { |list| urls = list }
|
19
|
-
o.on('-p', '--point POINT', String, 'Vantage point to check from.
|
22
|
+
o.on('-p', '--point POINT', String, 'Vantage point to check from. If not set, will use a random point') { |p| point = p }
|
20
23
|
o.parse!
|
21
24
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
25
|
+
if list
|
26
|
+
puts Vantage::Config.point_list.join("\n")
|
27
|
+
else
|
28
|
+
abort("Error: --urls is required\n\n#{o}") if urls.empty?
|
29
|
+
abort("Error: specified point does not exist\n\n#{o}") unless Vantage::Config.point_list.include?(point)
|
30
|
+
|
31
|
+
checks = urls.map { |u| { "url" => u } }
|
32
|
+
json = Vantage::Client.new.check("checks" => checks, "point" => point)
|
33
|
+
results = OkJson.decode(json)
|
34
|
+
results.each { |r| emit(r) }
|
35
|
+
end
|
28
36
|
end
|
29
37
|
end
|
30
38
|
end
|
data/lib/vantage/config.rb
CHANGED
data/lib/vantage/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vantage
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-05-27 00:00:00.
|
12
|
+
date: 2012-05-27 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: An example cli for vantage.io
|
15
15
|
email:
|
@@ -57,3 +57,4 @@ signing_key:
|
|
57
57
|
specification_version: 3
|
58
58
|
summary: An example cli for vantage.io
|
59
59
|
test_files: []
|
60
|
+
has_rdoc:
|