httping 1.1.0 → 1.3.0

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/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009-2010 John Pignata
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ 'Software'), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -50,7 +50,7 @@ Tickets can be submitted by via GitHub issues.
50
50
 
51
51
  (The MIT License)
52
52
 
53
- Copyright (c) 2009 Jay Pignata
53
+ Copyright (c) 2009-2010 John Pignata
54
54
 
55
55
  Permission is hereby granted, free of charge, to any person obtaining
56
56
  a copy of this software and associated documentation files (the
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.0
1
+ 1.3.0
@@ -71,13 +71,17 @@ class Runner
71
71
  def parse_uri
72
72
  uri = URI.parse(ARGV.first)
73
73
 
74
+ if uri.class == URI::Generic
75
+ uri = URI.parse("http://#{ARGV.first}")
76
+ end
77
+
78
+ uri.path = "/" unless uri.path.match /^\//
79
+
74
80
  unless ["http", "https"].include?(uri.scheme)
75
81
  puts "ERROR: Invalid URI #{uri}"
76
82
  exit
77
83
  end
78
84
 
79
- uri.path = "/" unless uri.path.match /^\//
80
-
81
85
  uri
82
86
  end
83
87
  end
@@ -5,13 +5,13 @@ describe "Enumerable" do
5
5
  @array = [1, 58, 49, 330, 2, 15, 3, 80]
6
6
  end
7
7
 
8
- context ".sum" do
8
+ context "#sum" do
9
9
  it "returns the sum of all members of a set" do
10
10
  @array.sum.should be(538)
11
11
  end
12
12
  end
13
13
 
14
- context ".mean" do
14
+ context "#mean" do
15
15
  it "returns the mean of a set" do
16
16
  @array.mean.should be(67)
17
17
  end
@@ -25,7 +25,7 @@ describe "Float" do
25
25
  @seconds = 48.31292
26
26
  end
27
27
 
28
- context ".to_human_time" do
28
+ context "#to_human_time" do
29
29
  it "returns a human friendly string of the elapsed time represented by a float" do
30
30
  @milliseconds.to_human_time.should == "299 msecs"
31
31
  @second.to_human_time.should == "1 sec"
@@ -42,7 +42,7 @@ describe "Fixnum" do
42
42
  @gigabytes = 8_289_119_584
43
43
  end
44
44
 
45
- context ".to_human_size" do
45
+ context "#to_human_size" do
46
46
  it "returns a human friendly string of the amount of bytes represented by a number" do
47
47
  @bytes.to_human_size.should == "12 bytes"
48
48
  @kilobytes.to_human_size.should == "8 kb"
@@ -12,7 +12,7 @@ describe "Ping" do
12
12
  Output.clear
13
13
  end
14
14
 
15
- describe ".ping" do
15
+ describe "#ping" do
16
16
  context "a HTTP URI" do
17
17
  it "pings the configured url and outputs statistics" do
18
18
  @httping.ping
@@ -45,7 +45,7 @@ describe "Ping" do
45
45
  end
46
46
  end
47
47
 
48
- context ".count_reached?" do
48
+ context "#count_reached?" do
49
49
  it "returns false if a host has not yet been pinged the number of times requested" do
50
50
  2.times { @httping.ping }
51
51
  @httping.should_not be_count_reached
@@ -57,7 +57,7 @@ describe "Ping" do
57
57
  end
58
58
  end
59
59
 
60
- context ".results" do
60
+ context "#results" do
61
61
  before do
62
62
  5.times { @httping.ping }
63
63
  end
@@ -68,7 +68,7 @@ describe "Ping" do
68
68
  end
69
69
  end
70
70
 
71
- context ".json_results" do
71
+ context "#json_results" do
72
72
  before do
73
73
  @httping.format = :json
74
74
  2.times { @httping.ping }
@@ -80,7 +80,7 @@ describe "Ping" do
80
80
  end
81
81
  end
82
82
 
83
- context ".quick_results" do
83
+ context "#quick_results" do
84
84
  before do
85
85
  @httping.format = :quick
86
86
  @httping.ping
@@ -92,7 +92,7 @@ describe "Ping" do
92
92
  end
93
93
  end
94
94
 
95
- context ".run" do
95
+ context "#run" do
96
96
  before do
97
97
  @httping = Ping.new
98
98
  @httping.uri = URI.parse("http://www.example.com/")
@@ -10,7 +10,7 @@ describe "Runner" do
10
10
  Output.clear
11
11
  end
12
12
 
13
- context ".parse_arguments" do
13
+ context "#parse_arguments" do
14
14
  it "parses command-line arguments into an options hash" do
15
15
  ARGV << "http://www.example.com"
16
16
  ARGV << "--count" << "3"
@@ -53,7 +53,7 @@ describe "Runner" do
53
53
  end
54
54
  end
55
55
 
56
- context ".run" do
56
+ context "#run" do
57
57
  it "returns the params banner if no arguments are passed" do
58
58
  @runner.run
59
59
  Output.to_s.should == "Usage: httping [options] uri"
@@ -74,11 +74,11 @@ describe "Runner" do
74
74
  end
75
75
  end
76
76
 
77
- context "parse_uri" do
77
+ context "#parse_uri" do
78
78
  it "outputs an error and exists if not given an HTTP(S) URI" do
79
79
  ARGV << "ftp://www.example.com"
80
80
  @runner.parse_uri
81
- Output.to_s.should == "ERROR: Invalid URI ftp://www.example.com"
81
+ Output.to_s.should == "ERROR: Invalid URI ftp://www.example.com/"
82
82
  end
83
83
 
84
84
  it "accepts HTTP URIs" do
@@ -92,5 +92,11 @@ describe "Runner" do
92
92
  @runner.parse_uri
93
93
  Output.to_s.should_not match(/ERROR/)
94
94
  end
95
+
96
+ it "assumes HTTP for URIs without a scheme" do
97
+ ARGV << "www.example.com"
98
+ @runner.parse_uri
99
+ Output.to_s.should_not match(/ERROR/)
100
+ end
95
101
  end
96
102
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: httping
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Pignata
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-11-01 00:00:00 -04:00
12
+ date: 2009-12-28 00:00:00 -05:00
13
13
  default_executable: httping
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -39,8 +39,10 @@ executables:
39
39
  extensions: []
40
40
 
41
41
  extra_rdoc_files:
42
+ - LICENSE
42
43
  - README.md
43
44
  files:
45
+ - LICENSE
44
46
  - README.md
45
47
  - Rakefile
46
48
  - VERSION