httperfrb 0.3.7 → 0.3.8

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.
Files changed (3) hide show
  1. data/lib/httperf.rb +24 -0
  2. data/lib/httperf/version.rb +1 -1
  3. metadata +3 -3
data/lib/httperf.rb CHANGED
@@ -66,6 +66,28 @@ class HTTPerf
66
66
  # - wset
67
67
  def initialize options={}, path=nil
68
68
  self.parse = options.delete("parse")
69
+ if options.has_key?("command")
70
+ command = options.delete("command")
71
+ raise "Option command must not be passed with other options" unless options.empty?
72
+
73
+ valid_command = !!(command.match(/([a-z\/]*)httperf /))
74
+ raise "Invalid httperf command" unless valid_command
75
+
76
+ command.gsub!("--hog", "--hog=true")
77
+ command.gsub!("--verbose", "--verbose=true")
78
+
79
+ cli_options = command.split(" --")
80
+ path = cli_options.delete_at(0)
81
+ path = nil unless path.start_with?("/")
82
+
83
+ cli_options.each do |clio|
84
+ kvp = clio.split("=")
85
+ kvp = clio.split(" ") unless kvp.size == 2
86
+ raise "Error parsing command params" unless kvp.size == 2
87
+ options[kvp.first] = kvp.last
88
+ end
89
+ end
90
+
69
91
  options.each_key do |k|
70
92
  raise "'#{k}' is an invalid httperf param" unless params.keys.include?(k)
71
93
  end
@@ -142,6 +164,8 @@ class HTTPerf
142
164
  @options.each do |key,val|
143
165
  opts << "--#{key}=#{val} " unless val.nil?
144
166
  end
167
+ opts.gsub!("--hog=true", "--hog")
168
+ opts.gsub!("--hog=false", "")
145
169
  opts.gsub!("--verbose=true", "--verbose")
146
170
  opts.gsub!("--verbose=false", "")
147
171
  opts
@@ -1,4 +1,4 @@
1
1
  class HTTPerf
2
- VERSION = "0.3.7"
2
+ VERSION = "0.3.8"
3
3
  end
4
4
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: httperfrb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.7
4
+ version: 0.3.8
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: 2013-02-12 00:00:00.000000000 Z
12
+ date: 2013-03-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -108,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
108
108
  version: 1.3.6
109
109
  requirements: []
110
110
  rubyforge_project:
111
- rubygems_version: 1.8.25
111
+ rubygems_version: 1.8.24
112
112
  signing_key:
113
113
  specification_version: 3
114
114
  summary: HTTPerf via Ruby