blitz 0.1.8 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- data/blitz.gemspec +2 -2
- data/lib/blitz.rb +1 -1
- data/lib/blitz/command/curl.rb +43 -2
- metadata +3 -3
data/blitz.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{blitz}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.9"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["pcapr"]
|
12
|
-
s.date = %q{2011-07-
|
12
|
+
s.date = %q{2011-07-14}
|
13
13
|
s.default_executable = %q{blitz}
|
14
14
|
s.description = %q{Make load and performance testing a fun sport}
|
15
15
|
s.email = %q{support@blitz.io}
|
data/lib/blitz.rb
CHANGED
data/lib/blitz/command/curl.rb
CHANGED
@@ -152,6 +152,8 @@ class Curl < Command # :nodoc:
|
|
152
152
|
duration = recent.duration * 1000
|
153
153
|
if duration >= 0
|
154
154
|
output << "%13u " % duration
|
155
|
+
else
|
156
|
+
output << "%13s " % 'no data'
|
155
157
|
end
|
156
158
|
|
157
159
|
output << "%7u " % recent.errors
|
@@ -180,7 +182,8 @@ class Curl < Command # :nodoc:
|
|
180
182
|
{ :short => '-T', :long => '--timeout', :value => '<ms>', :help => 'Wait time for both connect and responses' },
|
181
183
|
{ :short => '-u', :long => '--user', :value => '<user[:pass]>', :help => 'User and password for authentication' },
|
182
184
|
{ :short => '-X', :long => '--request', :value => '<string>', :help => 'Request method to use (GET, HEAD, PUT, etc.)' },
|
183
|
-
{ :short => '-v', :long => '--
|
185
|
+
{ :short => '-v', :long => '--variable', :value => '<string>', :help => 'Define a variable to use' },
|
186
|
+
{ :short => '-V', :long => '--verbose', :value => '', :help => 'Print the request/response headers' },
|
184
187
|
{ :short => '-1', :long => '--tlsv1', :value => '', :help => 'Use TLSv1 (SSL)' },
|
185
188
|
{ :short => '-2', :long => '--sslv2', :value => '', :help => 'Use SSLv2 (SSL)' },
|
186
189
|
{ :short => '-3', :long => '--sslv3', :value => '', :help => 'Use SSLv3 (SSL)' }
|
@@ -199,6 +202,8 @@ class Curl < Command # :nodoc:
|
|
199
202
|
|
200
203
|
def parse_cli argv
|
201
204
|
hash = Hash.new
|
205
|
+
hash['text'] = argv.join(' ')
|
206
|
+
|
202
207
|
while not argv.empty?
|
203
208
|
break if argv.first[0,1] != '-'
|
204
209
|
|
@@ -289,7 +294,43 @@ class Curl < Command # :nodoc:
|
|
289
294
|
next
|
290
295
|
end
|
291
296
|
|
292
|
-
if
|
297
|
+
if /-v:(\S+)/ =~ k or /--variable:(\S+)/ =~ k
|
298
|
+
variable_name = $1
|
299
|
+
variable_parameter = shift(k, argv)
|
300
|
+
|
301
|
+
assert_match(/^[a-zA-Z][a-zA-Z0-9]*$/, variable_name, "variable name must be alphanumeric: #{variable_name}")
|
302
|
+
|
303
|
+
hash['variables'] ||= Hash.new
|
304
|
+
|
305
|
+
parameter_hash = {}
|
306
|
+
if variable_parameter.match(/^(list)?\[([^\]]+)\]$/)
|
307
|
+
parameter_hash['type'] = 'list'
|
308
|
+
parameter_hash['entries'] = $2.split(',')
|
309
|
+
elsif variable_parameter.match(/^(a|alpha)$/)
|
310
|
+
parameter_hash['type'] = 'alpha'
|
311
|
+
elsif variable_parameter.match(/^(a|alpha)\[(\d+)(,(\d+)(,(\d+))?)?\]$/)
|
312
|
+
parameter_hash['type'] = 'alpha'
|
313
|
+
parameter_hash['min'] = $2.to_i
|
314
|
+
parameter_hash['max'] = $3.to_i
|
315
|
+
parameter_hash['count'] = $4 ? $4 : 1000
|
316
|
+
elsif variable_parameter.match(/^(n|number)$/)
|
317
|
+
parameter_hash['type'] = 'number'
|
318
|
+
elsif variable_parameter.match(/^(n|number)\[(-?\d+),(-?\d+)(,(\d+))?\]$/)
|
319
|
+
parameter_hash['type'] = 'number'
|
320
|
+
parameter_hash['min'] = $2.to_i
|
321
|
+
parameter_hash['max'] = $3.to_i
|
322
|
+
parameter_hash['count'] = $4 ? $4.to_i : 1000
|
323
|
+
elsif variable_parameter.match(/^(u|udid)$/)
|
324
|
+
parameter_hash['type'] = 'udid'
|
325
|
+
else
|
326
|
+
raise ArgumentError, "Invalid variable parameter to #{variable_name}: #{variable_parameter}"
|
327
|
+
end
|
328
|
+
|
329
|
+
hash['variables'][variable_name] = parameter_hash
|
330
|
+
next
|
331
|
+
end
|
332
|
+
|
333
|
+
if [ '-V', '--verbose' ].member? k
|
293
334
|
hash['verbose'] = true
|
294
335
|
next
|
295
336
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: blitz
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.1.
|
5
|
+
version: 0.1.9
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- pcapr
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-07-
|
13
|
+
date: 2011-07-14 00:00:00 -07:00
|
14
14
|
default_executable: blitz
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -135,7 +135,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
135
135
|
requirements:
|
136
136
|
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
hash:
|
138
|
+
hash: 63947055
|
139
139
|
segments:
|
140
140
|
- 0
|
141
141
|
version: "0"
|