hoick 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/hoick/command.rb +27 -5
- data/lib/hoick/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: 9a45c81b44157ce9e833bda8f0b4a0d8822043f0
|
4
|
+
data.tar.gz: 5dd7e6c5da5a8ed72684f9db9481c06e728112ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 16036cba8cd39cda4dd6e7e43ca3cea2dedd7e6efbccc1627978f71f5b93e80c35e495229a34a1d4b0afb89919c257072af195684673e1564a8b0225171a4f64
|
7
|
+
data.tar.gz: 655d76ada1d8c7b125f201a6d06e679d430181cf96489b439b4650570ce0c9740cbd3beb0f75da11663ea669121494da24b1cc58c897dadedbc73f7c450c9909
|
data/lib/hoick/command.rb
CHANGED
@@ -6,7 +6,25 @@ module Hoick
|
|
6
6
|
|
7
7
|
class Command < Clamp::Command
|
8
8
|
|
9
|
-
|
9
|
+
class << self
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def parse_url(url)
|
14
|
+
URI(url)
|
15
|
+
rescue ArgumentError => e
|
16
|
+
raise e
|
17
|
+
rescue URI::InvalidURIError => e
|
18
|
+
raise ArgumentError, e.message
|
19
|
+
end
|
20
|
+
|
21
|
+
def declare_url_parameter
|
22
|
+
parameter "URL", "address", &method(:parse_url)
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
option ["--base-url"], "URL", "base URL", &method(:parse_url)
|
10
28
|
|
11
29
|
option ["-b", "--[no-]body"], :flag, "display response body", :default => true
|
12
30
|
option ["-h", "--[no-]headers"], :flag, "display response status and headers"
|
@@ -17,7 +35,7 @@ module Hoick
|
|
17
35
|
|
18
36
|
option ["--follow"], :flag, "follow redirects"
|
19
37
|
|
20
|
-
|
38
|
+
declare_url_parameter
|
21
39
|
|
22
40
|
def execute
|
23
41
|
get_with_redirects do |response|
|
@@ -77,7 +95,7 @@ module Hoick
|
|
77
95
|
|
78
96
|
include PayloadOptions
|
79
97
|
|
80
|
-
|
98
|
+
declare_url_parameter
|
81
99
|
|
82
100
|
def execute
|
83
101
|
content = payload
|
@@ -97,7 +115,7 @@ module Hoick
|
|
97
115
|
|
98
116
|
include PayloadOptions
|
99
117
|
|
100
|
-
|
118
|
+
declare_url_parameter
|
101
119
|
|
102
120
|
def execute
|
103
121
|
content = payload
|
@@ -116,7 +134,11 @@ module Hoick
|
|
116
134
|
private
|
117
135
|
|
118
136
|
def uri
|
119
|
-
|
137
|
+
if base_url
|
138
|
+
base_url + url
|
139
|
+
else
|
140
|
+
url
|
141
|
+
end
|
120
142
|
end
|
121
143
|
|
122
144
|
def with_http_connection
|
data/lib/hoick/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hoick
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Williams
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-04-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mime-types
|