hansel 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/VERSION +1 -1
  2. data/hansel.gemspec +1 -1
  3. data/lib/arg_parser.rb +32 -48
  4. metadata +2 -2
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.4
1
+ 0.1.5
data/hansel.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{hansel}
8
- s.version = "0.1.4"
8
+ s.version = "0.1.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Paul Mylchreest"]
data/lib/arg_parser.rb CHANGED
@@ -28,86 +28,70 @@ module Hansel
28
28
  )
29
29
  end
30
30
 
31
- def server options
31
+ def server_options options
32
32
  options.on("-s", "--server=S",
33
- "Specifies the IP hostname of the server.") do |opt|
34
- @options.server = opt
33
+ "Specifies the IP hostname of the server.") do |server|
34
+ @options.server = server
35
35
  end
36
- end
37
36
 
38
- def port options
39
37
  options.on("-p", "--port=N",
40
- "This option specifies the port number N on which the web server is listening for HTTP requests.") do |opt|
41
- @options.port = opt
38
+ "Specifies the port number on which the server is listening.") do |port|
39
+ @options.port = port
42
40
  end
43
- end
44
41
 
45
- def uri options
46
42
  options.on("-u", "--uri=S",
47
- "Specifies that URI S should be accessed on the server.") do |opt|
48
- @options.uri = opt
43
+ "Specifies that URI S should be accessed on the server.") do |uri|
44
+ @options.uri = uri
49
45
  end
50
46
  end
51
47
 
52
- def connections options
48
+ def httperf_options options
53
49
  options.on("-n", "--num_conns=N",
54
- "Specifies the total number of connections to create.") do |opt|
55
- @options.num_conns = opt
50
+ "Specifies the total number of connections to create.") do |num_conns|
51
+ @options.num_conns = num_conns
56
52
  end
57
- end
58
53
 
59
- def low_rate options
60
54
  options.on("-l", "--low_rate=S",
61
- "Specifies the starting fixed rate at which connections are created.") do |opt|
62
- @options.low_rate = opt
55
+ "Specifies the starting fixed rate at which connections are created.") do |low_rate|
56
+ @options.low_rate = low_rate
63
57
  end
64
- end
65
58
 
66
- def high_rate options
67
59
  options.on("-l", "--high_rate=S",
68
- "Specifies the ending fixed rate at which connections are created.") do |opt|
69
- @options.high_rate = opt
60
+ "Specifies the ending fixed rate at which connections are created.") do |high_rate|
61
+ @options.high_rate = high_rate
70
62
  end
71
- end
72
63
 
73
- def rate_step options
74
64
  options.on("-l", "--rate_step=S",
75
- "Specifies the fixed rate step at which connections are created.") do |opt|
76
- @options.rate_step = opt
65
+ "Specifies the fixed rate step at which connections are created.") do |rate_step|
66
+ @options.rate_step = rate_step
77
67
  end
78
68
  end
79
69
 
80
- def cookie options
81
- options.on("-c", "--cookie=C", "Specify a cookie.") do |opt|
82
- @options.cookie = opt
70
+ def output_options options
71
+ options.on("-f", "--format=FORMAT [yaml|csv|octave]",
72
+ "Specify an output format.") do |format|
73
+ @options.output_format = format.to_sym
83
74
  end
84
- end
85
75
 
86
- def format options
87
- options.on("-f", "--format=FILE [yaml|csv]", "Specify an output format.") do |opt|
88
- @options.output_format = opt.to_sym
76
+ options.on("-o", "--output=FILE", "Specify an output file.") do |output|
77
+ @options.output = output
89
78
  end
90
- end
91
79
 
92
- def output options
93
- options.on("-o", "--output=FILE", "Specify an output file.") do |opt|
94
- @options.output = opt
80
+ options.on("-d", "--output_dir=PATH",
81
+ "Specify an output directory.") do |output_dir|
82
+ @options.output_dir = output_dir
95
83
  end
96
84
  end
97
85
 
98
- def output_dir options
99
- options.on("-d", "--output_dir=PATH", "Specify an output directory.") do |opt|
100
- @options.output_dir = opt
86
+ def other_options options
87
+ options.on("-c", "--cookie=C", "Specify a cookie.") do |cookie|
88
+ @options.cookie = cookie
101
89
  end
102
- end
103
90
 
104
- def verbose options
105
- options.on("-v", "--[no-]verbose", "Run verbosely") do |opt|
106
- @options.verbose = opt
91
+ options.on("-v", "--[no-]verbose", "Run verbosely") do |verbose|
92
+ @options.verbose = verbose
107
93
  end
108
- end
109
94
 
110
- def help options
111
95
  options.on_tail("-h", "--help", "Show this message") do
112
96
  puts options
113
97
  @options.exit = true
@@ -124,8 +108,8 @@ module Hansel
124
108
  def parse_options options
125
109
  options.banner = "Usage: hansel [options]"
126
110
  options.separator "Options:"
127
- %w(server port uri connections low_rate high_rate rate_step cookie
128
- format output output_dir verbose help version).map(&:to_sym).each do |method|
111
+ %w(server_options httperf_options output_options
112
+ other_options version).map(&:to_sym).each do |method|
129
113
  self.send method, options
130
114
  end
131
115
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 4
9
- version: 0.1.4
8
+ - 5
9
+ version: 0.1.5
10
10
  platform: ruby
11
11
  authors:
12
12
  - Paul Mylchreest