mu 5.7.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (117) hide show
  1. data/Mu_Gem.html +1591 -0
  2. data/bin/mu +11 -0
  3. data/lib/mu.rb +65 -0
  4. data/lib/mu/api/ddt.rb +233 -0
  5. data/lib/mu/api/homepage.rb +54 -0
  6. data/lib/mu/api/muapi.rb +231 -0
  7. data/lib/mu/api/netconfig.rb +233 -0
  8. data/lib/mu/api/scale.rb +199 -0
  9. data/lib/mu/api/system.rb +40 -0
  10. data/lib/mu/client.rb +31 -0
  11. data/lib/mu/command.rb +28 -0
  12. data/lib/mu/command/api.rb +95 -0
  13. data/lib/mu/command/cmd_appid.rb +486 -0
  14. data/lib/mu/command/cmd_cli.rb +151 -0
  15. data/lib/mu/command/cmd_ddt.rb +449 -0
  16. data/lib/mu/command/cmd_homepage.rb +146 -0
  17. data/lib/mu/command/cmd_muapi.rb +361 -0
  18. data/lib/mu/command/cmd_netconfig.rb +262 -0
  19. data/lib/mu/command/cmd_runscale.rb +533 -0
  20. data/lib/mu/command/cmd_runscenario.rb +258 -0
  21. data/lib/mu/command/cmd_runverify.rb +336 -0
  22. data/lib/mu/command/cmd_scale.rb +333 -0
  23. data/lib/mu/command/cmd_system.rb +127 -0
  24. data/lib/mu/command/curl.rb +246 -0
  25. data/lib/mu/command/help.rb +29 -0
  26. data/lib/mu/curl/error.rb +54 -0
  27. data/lib/mu/curl/verify.rb +137 -0
  28. data/lib/mu/helper.rb +55 -0
  29. data/lib/mu/http_helper.rb +232 -0
  30. data/rdoc/classes/Mu.html +305 -0
  31. data/rdoc/classes/Mu/Client.html +265 -0
  32. data/rdoc/classes/Mu/Command.html +208 -0
  33. data/rdoc/classes/Mu/Command/API.html +524 -0
  34. data/rdoc/classes/Mu/Command/Cmd_appid.html +934 -0
  35. data/rdoc/classes/Mu/Command/Cmd_cli.html +515 -0
  36. data/rdoc/classes/Mu/Command/Cmd_ddt.html +1169 -0
  37. data/rdoc/classes/Mu/Command/Cmd_homepage.html +489 -0
  38. data/rdoc/classes/Mu/Command/Cmd_muapi.html +968 -0
  39. data/rdoc/classes/Mu/Command/Cmd_netconfig.html +743 -0
  40. data/rdoc/classes/Mu/Command/Cmd_runscale.html +970 -0
  41. data/rdoc/classes/Mu/Command/Cmd_runscenario.html +530 -0
  42. data/rdoc/classes/Mu/Command/Cmd_runverify.html +621 -0
  43. data/rdoc/classes/Mu/Command/Cmd_scale.html +939 -0
  44. data/rdoc/classes/Mu/Command/Cmd_system.html +426 -0
  45. data/rdoc/classes/Mu/Command/Curl.html +524 -0
  46. data/rdoc/classes/Mu/Command/Help.html +166 -0
  47. data/rdoc/classes/Mu/Curl.html +116 -0
  48. data/rdoc/classes/Mu/Curl/Error.html +157 -0
  49. data/rdoc/classes/Mu/Curl/Error/Authorize.html +178 -0
  50. data/rdoc/classes/Mu/Curl/Error/Connect.html +149 -0
  51. data/rdoc/classes/Mu/Curl/Error/DNS.html +113 -0
  52. data/rdoc/classes/Mu/Curl/Error/Region.html +160 -0
  53. data/rdoc/classes/Mu/Curl/Error/Status.html +149 -0
  54. data/rdoc/classes/Mu/Curl/Error/Timeout.html +149 -0
  55. data/rdoc/classes/Mu/Curl/Verify.html +282 -0
  56. data/rdoc/classes/Mu/Curl/Verify/Request.html +227 -0
  57. data/rdoc/classes/Mu/Curl/Verify/Response.html +187 -0
  58. data/rdoc/classes/Mu/Curl/Verify/Result.html +188 -0
  59. data/rdoc/classes/Mu/Ddt.html +914 -0
  60. data/rdoc/classes/Mu/Helper.html +308 -0
  61. data/rdoc/classes/Mu/Homepage.html +377 -0
  62. data/rdoc/classes/Mu/HttpHelper.html +639 -0
  63. data/rdoc/classes/Mu/Muapi.html +816 -0
  64. data/rdoc/classes/Mu/Netconfig.html +781 -0
  65. data/rdoc/classes/Mu/Scale.html +832 -0
  66. data/rdoc/classes/Mu/System.html +281 -0
  67. data/rdoc/classes/Object.html +148 -0
  68. data/rdoc/classes/TCTestMu.html +1793 -0
  69. data/rdoc/classes/Test.html +107 -0
  70. data/rdoc/classes/Test/Unit.html +107 -0
  71. data/rdoc/classes/Test/Unit/TestCase.html +113 -0
  72. data/rdoc/created.rid +1 -0
  73. data/rdoc/files/lib/mu/api/ddt_rb.html +101 -0
  74. data/rdoc/files/lib/mu/api/homepage_rb.html +101 -0
  75. data/rdoc/files/lib/mu/api/muapi_rb.html +101 -0
  76. data/rdoc/files/lib/mu/api/netconfig_rb.html +101 -0
  77. data/rdoc/files/lib/mu/api/scale_rb.html +101 -0
  78. data/rdoc/files/lib/mu/api/system_rb.html +101 -0
  79. data/rdoc/files/lib/mu/client_rb.html +101 -0
  80. data/rdoc/files/lib/mu/command/api_rb.html +101 -0
  81. data/rdoc/files/lib/mu/command/cmd_appid_rb.html +119 -0
  82. data/rdoc/files/lib/mu/command/cmd_cli_rb.html +108 -0
  83. data/rdoc/files/lib/mu/command/cmd_ddt_rb.html +117 -0
  84. data/rdoc/files/lib/mu/command/cmd_homepage_rb.html +115 -0
  85. data/rdoc/files/lib/mu/command/cmd_muapi_rb.html +116 -0
  86. data/rdoc/files/lib/mu/command/cmd_netconfig_rb.html +116 -0
  87. data/rdoc/files/lib/mu/command/cmd_runscale_rb.html +119 -0
  88. data/rdoc/files/lib/mu/command/cmd_runscenario_rb.html +115 -0
  89. data/rdoc/files/lib/mu/command/cmd_runverify_rb.html +117 -0
  90. data/rdoc/files/lib/mu/command/cmd_scale_rb.html +115 -0
  91. data/rdoc/files/lib/mu/command/cmd_system_rb.html +116 -0
  92. data/rdoc/files/lib/mu/command/curl_rb.html +101 -0
  93. data/rdoc/files/lib/mu/command/help_rb.html +101 -0
  94. data/rdoc/files/lib/mu/command_rb.html +107 -0
  95. data/rdoc/files/lib/mu/curl/error_rb.html +101 -0
  96. data/rdoc/files/lib/mu/curl/verify_rb.html +101 -0
  97. data/rdoc/files/lib/mu/helper_rb.html +101 -0
  98. data/rdoc/files/lib/mu/http_helper_rb.html +101 -0
  99. data/rdoc/files/lib/mu_rb.html +121 -0
  100. data/rdoc/files/test/helper_rb.html +112 -0
  101. data/rdoc/files/test/tc_test_mu_rb.html +111 -0
  102. data/rdoc/fr_class_index.html +68 -0
  103. data/rdoc/fr_file_index.html +55 -0
  104. data/rdoc/fr_method_index.html +374 -0
  105. data/rdoc/index.html +24 -0
  106. data/rdoc/rdoc-style.css +208 -0
  107. data/test/data/app_id_stats.csv +1 -0
  108. data/test/data/data_cgi.msl +94 -0
  109. data/test/data/data_cgi.xml +322 -0
  110. data/test/data/default_test.csv +3 -0
  111. data/test/data/ftp_with_channel.xml +1643 -0
  112. data/test/data/irc.xml +3837 -0
  113. data/test/data/scale_configuration.json +25 -0
  114. data/test/data/test_data_cgi_error.xml +35 -0
  115. data/test/helper.rb +18 -0
  116. data/test/tc_test_mu.rb +716 -0
  117. metadata +322 -0
@@ -0,0 +1,426 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>Class: Mu::Command::Cmd_system</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="classHeader">
50
+ <table class="header-table">
51
+ <tr class="top-aligned-row">
52
+ <td><strong>Class</strong></td>
53
+ <td class="class-name-in-header">Mu::Command::Cmd_system</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../../files/lib/mu/command/cmd_system_rb.html">
59
+ lib/mu/command/cmd_system.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ <tr class="top-aligned-row">
66
+ <td><strong>Parent:</strong></td>
67
+ <td>
68
+ Command
69
+ </td>
70
+ </tr>
71
+ </table>
72
+ </div>
73
+ <!-- banner header -->
74
+
75
+ <div id="bodyContent">
76
+
77
+
78
+
79
+ <div id="contextContent">
80
+
81
+
82
+
83
+ </div>
84
+
85
+ <div id="method-list">
86
+ <h3 class="section-bar">Methods</h3>
87
+
88
+ <div class="name-list">
89
+ <a href="#M000101">cmd_help</a>&nbsp;&nbsp;
90
+ <a href="#M000102">cmd_restart</a>&nbsp;&nbsp;
91
+ <a href="#M000103">cmd_status</a>&nbsp;&nbsp;
92
+ <a href="#M000104">cmd_status2</a>&nbsp;&nbsp;
93
+ <a href="#M000107">help</a>&nbsp;&nbsp;
94
+ <a href="#M000106">parse_cli</a>&nbsp;&nbsp;
95
+ <a href="#M000105">setup</a>&nbsp;&nbsp;
96
+ </div>
97
+ </div>
98
+
99
+ </div>
100
+
101
+
102
+ <!-- if includes -->
103
+
104
+ <div id="section">
105
+
106
+
107
+
108
+
109
+
110
+ <div id="attribute-list">
111
+ <h3 class="section-bar">Attributes</h3>
112
+
113
+ <div class="name-list">
114
+ <table>
115
+ <tr class="top-aligned-row context-row">
116
+ <td class="context-item-name">api</td>
117
+ <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
118
+ <td class="context-item-desc"></td>
119
+ </tr>
120
+ <tr class="top-aligned-row context-row">
121
+ <td class="context-item-name">host</td>
122
+ <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
123
+ <td class="context-item-desc"></td>
124
+ </tr>
125
+ <tr class="top-aligned-row context-row">
126
+ <td class="context-item-name">password</td>
127
+ <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
128
+ <td class="context-item-desc"></td>
129
+ </tr>
130
+ <tr class="top-aligned-row context-row">
131
+ <td class="context-item-name">username</td>
132
+ <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
133
+ <td class="context-item-desc"></td>
134
+ </tr>
135
+ </table>
136
+ </div>
137
+ </div>
138
+
139
+
140
+
141
+ <!-- if method_list -->
142
+ <div id="methods">
143
+ <h3 class="section-bar">Public Instance methods</h3>
144
+
145
+ <div id="method-M000101" class="method-detail">
146
+ <a name="M000101"></a>
147
+
148
+ <div class="method-heading">
149
+ <a href="#M000101" class="method-signature">
150
+ <span class="method-name">cmd_help</span><span class="method-args">(argv)</span>
151
+ </a>
152
+ </div>
153
+
154
+ <div class="method-description">
155
+ <p>
156
+ outputs <a href="Cmd_system.html#M000107">help</a> for this command
157
+ </p>
158
+ <pre>
159
+ * argv = command-line arguments
160
+ </pre>
161
+ <p><a class="source-toggle" href="#"
162
+ onclick="toggleCode('M000101-source');return false;">[Source]</a></p>
163
+ <div class="method-source-code" id="M000101-source">
164
+ <pre>
165
+ <span class="ruby-comment cmt"># File lib/mu/command/cmd_system.rb, line 12</span>
166
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cmd_help</span> <span class="ruby-identifier">argv</span>
167
+ <span class="ruby-identifier">help</span>
168
+ <span class="ruby-keyword kw">end</span>
169
+ </pre>
170
+ </div>
171
+ </div>
172
+ </div>
173
+
174
+ <div id="method-M000102" class="method-detail">
175
+ <a name="M000102"></a>
176
+
177
+ <div class="method-heading">
178
+ <a href="#M000102" class="method-signature">
179
+ <span class="method-name">cmd_restart</span><span class="method-args">(argv)</span>
180
+ </a>
181
+ </div>
182
+
183
+ <div class="method-description">
184
+ <p>
185
+ restarts the <a href="../../Mu.html">Mu</a> system services (this does not
186
+ reboot the appliance)
187
+ </p>
188
+ <pre>
189
+ * argv = command-line arguments
190
+ </pre>
191
+ <p><a class="source-toggle" href="#"
192
+ onclick="toggleCode('M000102-source');return false;">[Source]</a></p>
193
+ <div class="method-source-code" id="M000102-source">
194
+ <pre>
195
+ <span class="ruby-comment cmt"># File lib/mu/command/cmd_system.rb, line 18</span>
196
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cmd_restart</span> <span class="ruby-identifier">argv</span>
197
+ <span class="ruby-identifier">setup</span> <span class="ruby-identifier">argv</span>
198
+ <span class="ruby-identifier">response</span> = <span class="ruby-ivar">@api</span>.<span class="ruby-identifier">restart</span>
199
+ <span class="ruby-identifier">msg</span> <span class="ruby-identifier">response</span>
200
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">response</span>
201
+ <span class="ruby-keyword kw">end</span>
202
+ </pre>
203
+ </div>
204
+ </div>
205
+ </div>
206
+
207
+ <div id="method-M000103" class="method-detail">
208
+ <a name="M000103"></a>
209
+
210
+ <div class="method-heading">
211
+ <a href="#M000103" class="method-signature">
212
+ <span class="method-name">cmd_status</span><span class="method-args">(argv)</span>
213
+ </a>
214
+ </div>
215
+
216
+ <div class="method-description">
217
+ <p>
218
+ gets the complete <a href="../System.html">System</a> status page
219
+ </p>
220
+ <pre>
221
+ * argv = command-line arguments
222
+ </pre>
223
+ <p><a class="source-toggle" href="#"
224
+ onclick="toggleCode('M000103-source');return false;">[Source]</a></p>
225
+ <div class="method-source-code" id="M000103-source">
226
+ <pre>
227
+ <span class="ruby-comment cmt"># File lib/mu/command/cmd_system.rb, line 27</span>
228
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cmd_status</span> <span class="ruby-identifier">argv</span>
229
+ <span class="ruby-identifier">setup</span> <span class="ruby-identifier">argv</span>
230
+ <span class="ruby-identifier">response</span> = <span class="ruby-ivar">@api</span>.<span class="ruby-identifier">status</span>
231
+ <span class="ruby-identifier">msg</span> <span class="ruby-identifier">response</span>
232
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">response</span>
233
+ <span class="ruby-keyword kw">end</span>
234
+ </pre>
235
+ </div>
236
+ </div>
237
+ </div>
238
+
239
+ <div id="method-M000104" class="method-detail">
240
+ <a name="M000104"></a>
241
+
242
+ <div class="method-heading">
243
+ <a href="#M000104" class="method-signature">
244
+ <span class="method-name">cmd_status2</span><span class="method-args">(argv)</span>
245
+ </a>
246
+ </div>
247
+
248
+ <div class="method-description">
249
+ <p>
250
+ gets additional system status information, imncluding hard drive, model and
251
+ serial data
252
+ </p>
253
+ <pre>
254
+ * argv = command-line arguments
255
+ </pre>
256
+ <p><a class="source-toggle" href="#"
257
+ onclick="toggleCode('M000104-source');return false;">[Source]</a></p>
258
+ <div class="method-source-code" id="M000104-source">
259
+ <pre>
260
+ <span class="ruby-comment cmt"># File lib/mu/command/cmd_system.rb, line 36</span>
261
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cmd_status2</span> <span class="ruby-identifier">argv</span>
262
+ <span class="ruby-identifier">setup</span> <span class="ruby-identifier">argv</span>
263
+ <span class="ruby-identifier">response</span> = <span class="ruby-ivar">@api</span>.<span class="ruby-identifier">status2</span>
264
+ <span class="ruby-identifier">msg</span> <span class="ruby-identifier">response</span>
265
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">response</span>
266
+ <span class="ruby-keyword kw">end</span>
267
+ </pre>
268
+ </div>
269
+ </div>
270
+ </div>
271
+
272
+ <h3 class="section-bar">Private Instance methods</h3>
273
+
274
+ <div id="method-M000107" class="method-detail">
275
+ <a name="M000107"></a>
276
+
277
+ <div class="method-heading">
278
+ <a href="#M000107" class="method-signature">
279
+ <span class="method-name">help</span><span class="method-args">()</span>
280
+ </a>
281
+ </div>
282
+
283
+ <div class="method-description">
284
+ <p>
285
+ displays command-line <a href="Cmd_system.html#M000107">help</a>
286
+ </p>
287
+ <p><a class="source-toggle" href="#"
288
+ onclick="toggleCode('M000107-source');return false;">[Source]</a></p>
289
+ <div class="method-source-code" id="M000107-source">
290
+ <pre>
291
+ <span class="ruby-comment cmt"># File lib/mu/command/cmd_system.rb, line 94</span>
292
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">help</span>
293
+ <span class="ruby-identifier">helps</span> = [
294
+ { <span class="ruby-identifier">:short</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'-h'</span>, <span class="ruby-identifier">:long</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'--help'</span>, <span class="ruby-identifier">:value</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">''</span>, <span class="ruby-identifier">:help</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'help on command line options'</span> },
295
+ { <span class="ruby-identifier">:short</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'-m'</span>, <span class="ruby-identifier">:long</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'--mu_string'</span>, <span class="ruby-identifier">:value</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'&lt;string&gt;'</span>, <span class="ruby-identifier">:help</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'user, password, mu_ip in the form of admin:admin@10.9.8.7'</span> },
296
+ { <span class="ruby-identifier">:short</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'-o'</span>, <span class="ruby-identifier">:long</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'--output'</span>, <span class="ruby-identifier">:value</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'&lt;string&gt;'</span>, <span class="ruby-identifier">:help</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'output logging to this file'</span> },
297
+ { <span class="ruby-identifier">:short</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'-v'</span>, <span class="ruby-identifier">:long</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'--verbose'</span>, <span class="ruby-identifier">:value</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">''</span>, <span class="ruby-identifier">:help</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'set Logger::DEBUG level'</span> }
298
+ ]
299
+
300
+ <span class="ruby-identifier">cmds</span> = [
301
+ <span class="ruby-value str">&quot;mu cmd_system:restart&quot;</span>,
302
+ <span class="ruby-value str">&quot;mu cmd_system:status&quot;</span>,
303
+ <span class="ruby-value str">&quot;mu cmd_system:status2&quot;</span>
304
+ ]
305
+
306
+ <span class="ruby-identifier">max_long_size</span> = <span class="ruby-identifier">helps</span>.<span class="ruby-identifier">inject</span>(<span class="ruby-value">0</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">memo</span>, <span class="ruby-identifier">obj</span><span class="ruby-operator">|</span> [ <span class="ruby-identifier">obj</span>[<span class="ruby-identifier">:long</span>].<span class="ruby-identifier">size</span>, <span class="ruby-identifier">memo</span> ].<span class="ruby-identifier">max</span> }
307
+ <span class="ruby-identifier">max_value_size</span> = <span class="ruby-identifier">helps</span>.<span class="ruby-identifier">inject</span>(<span class="ruby-value">0</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">memo</span>, <span class="ruby-identifier">obj</span><span class="ruby-operator">|</span> [ <span class="ruby-identifier">obj</span>[<span class="ruby-identifier">:value</span>].<span class="ruby-identifier">size</span>, <span class="ruby-identifier">memo</span> ].<span class="ruby-identifier">max</span> }
308
+ <span class="ruby-identifier">puts</span>
309
+ <span class="ruby-identifier">puts</span> <span class="ruby-value str">&quot;Usage: mu cmd_system &lt;options&gt;&quot;</span>
310
+ <span class="ruby-identifier">puts</span>
311
+ <span class="ruby-identifier">helps</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">h</span><span class="ruby-operator">|</span>
312
+ <span class="ruby-identifier">puts</span> <span class="ruby-value str">&quot;%-*s %*s %-*s %s&quot;</span> <span class="ruby-operator">%</span> [<span class="ruby-identifier">max_long_size</span>, <span class="ruby-identifier">h</span>[<span class="ruby-identifier">:long</span>], <span class="ruby-value">2</span>, <span class="ruby-identifier">h</span>[<span class="ruby-identifier">:short</span>], <span class="ruby-identifier">max_value_size</span>, <span class="ruby-identifier">h</span>[<span class="ruby-identifier">:value</span>], <span class="ruby-identifier">h</span>[<span class="ruby-identifier">:help</span>]]
313
+ <span class="ruby-keyword kw">end</span>
314
+ <span class="ruby-identifier">puts</span>
315
+ <span class="ruby-identifier">puts</span> <span class="ruby-value str">&quot;Available Commands&quot;</span>
316
+ <span class="ruby-identifier">puts</span>
317
+ <span class="ruby-identifier">cmds</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">c</span> <span class="ruby-operator">|</span>
318
+ <span class="ruby-identifier">puts</span> <span class="ruby-identifier">c</span>
319
+ <span class="ruby-keyword kw">end</span>
320
+ <span class="ruby-identifier">puts</span>
321
+ <span class="ruby-keyword kw">end</span>
322
+ </pre>
323
+ </div>
324
+ </div>
325
+ </div>
326
+
327
+ <div id="method-M000106" class="method-detail">
328
+ <a name="M000106"></a>
329
+
330
+ <div class="method-heading">
331
+ <a href="#M000106" class="method-signature">
332
+ <span class="method-name">parse_cli</span><span class="method-args">(argv)</span>
333
+ </a>
334
+ </div>
335
+
336
+ <div class="method-description">
337
+ <p>
338
+ parses command-line arguments
339
+ </p>
340
+ <p><a class="source-toggle" href="#"
341
+ onclick="toggleCode('M000106-source');return false;">[Source]</a></p>
342
+ <div class="method-source-code" id="M000106-source">
343
+ <pre>
344
+ <span class="ruby-comment cmt"># File lib/mu/command/cmd_system.rb, line 56</span>
345
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">parse_cli</span> <span class="ruby-identifier">argv</span>
346
+ <span class="ruby-identifier">args</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
347
+ <span class="ruby-keyword kw">while</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">argv</span>.<span class="ruby-identifier">empty?</span>
348
+ <span class="ruby-identifier">args</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">argv</span>.<span class="ruby-identifier">shift</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">argv</span>.<span class="ruby-identifier">first</span>[<span class="ruby-value">0</span>,<span class="ruby-value">1</span>] <span class="ruby-operator">!=</span> <span class="ruby-value str">'-'</span>
349
+
350
+ <span class="ruby-identifier">k</span> = <span class="ruby-identifier">argv</span>.<span class="ruby-identifier">shift</span>
351
+
352
+ <span class="ruby-keyword kw">if</span> [ <span class="ruby-value str">'-h'</span>, <span class="ruby-value str">'--help'</span> ].<span class="ruby-identifier">member?</span> <span class="ruby-identifier">k</span>
353
+ <span class="ruby-identifier">help</span>
354
+ <span class="ruby-identifier">exit</span>
355
+ <span class="ruby-keyword kw">end</span>
356
+
357
+ <span class="ruby-keyword kw">if</span> [ <span class="ruby-value str">'-m'</span>, <span class="ruby-value str">'--mu_string'</span> ].<span class="ruby-identifier">member?</span> <span class="ruby-identifier">k</span>
358
+ <span class="ruby-identifier">mu_string</span> = <span class="ruby-identifier">shift</span>(<span class="ruby-identifier">k</span>, <span class="ruby-identifier">argv</span>)
359
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">mu_string</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/(.+?):(.+?)@(.*)/</span>
360
+ <span class="ruby-ivar">@@mu_admin_user</span> = <span class="ruby-identifier">$1</span>
361
+ <span class="ruby-ivar">@@mu_admin_pass</span> = <span class="ruby-identifier">$2</span>
362
+ <span class="ruby-ivar">@@mu_ip</span> = <span class="ruby-identifier">$3</span>
363
+ <span class="ruby-keyword kw">end</span>
364
+ <span class="ruby-keyword kw">next</span>
365
+ <span class="ruby-keyword kw">end</span>
366
+
367
+ <span class="ruby-keyword kw">if</span> [ <span class="ruby-value str">'-o'</span>, <span class="ruby-value str">'--output'</span> ].<span class="ruby-identifier">member?</span> <span class="ruby-identifier">k</span>
368
+ <span class="ruby-identifier">$stdout</span>.<span class="ruby-identifier">reopen</span>(<span class="ruby-identifier">shift</span>(<span class="ruby-identifier">k</span>, <span class="ruby-identifier">argv</span>), <span class="ruby-value str">&quot;w&quot;</span>)
369
+ <span class="ruby-keyword kw">next</span>
370
+ <span class="ruby-keyword kw">end</span>
371
+
372
+ <span class="ruby-keyword kw">if</span> [ <span class="ruby-value str">'-v'</span>, <span class="ruby-value str">'--verbose'</span> ].<span class="ruby-identifier">member?</span> <span class="ruby-identifier">k</span>
373
+ <span class="ruby-identifier">$log</span>.<span class="ruby-identifier">level</span> = <span class="ruby-constant">Logger</span><span class="ruby-operator">::</span><span class="ruby-constant">DEBUG</span>
374
+ <span class="ruby-keyword kw">next</span>
375
+ <span class="ruby-keyword kw">end</span>
376
+
377
+ <span class="ruby-keyword kw">end</span>
378
+
379
+ <span class="ruby-identifier">args</span>
380
+ <span class="ruby-keyword kw">end</span>
381
+ </pre>
382
+ </div>
383
+ </div>
384
+ </div>
385
+
386
+ <div id="method-M000105" class="method-detail">
387
+ <a name="M000105"></a>
388
+
389
+ <div class="method-heading">
390
+ <a href="#M000105" class="method-signature">
391
+ <span class="method-name">setup</span><span class="method-args">(argv)</span>
392
+ </a>
393
+ </div>
394
+
395
+ <div class="method-description">
396
+ <p><a class="source-toggle" href="#"
397
+ onclick="toggleCode('M000105-source');return false;">[Source]</a></p>
398
+ <div class="method-source-code" id="M000105-source">
399
+ <pre>
400
+ <span class="ruby-comment cmt"># File lib/mu/command/cmd_system.rb, line 45</span>
401
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">setup</span> <span class="ruby-identifier">argv</span>
402
+ <span class="ruby-identifier">parse_cli</span> <span class="ruby-identifier">argv</span>
403
+ <span class="ruby-ivar">@host</span> = (<span class="ruby-ivar">@@mu_ip</span>.<span class="ruby-identifier">nil?</span>) <span class="ruby-operator">?</span> <span class="ruby-value str">&quot;127.0.0.1&quot;</span> <span class="ruby-operator">:</span> <span class="ruby-ivar">@@mu_ip</span>
404
+ <span class="ruby-ivar">@username</span> = (<span class="ruby-ivar">@@mu_admin_user</span>.<span class="ruby-identifier">nil?</span>) <span class="ruby-operator">?</span> <span class="ruby-value str">&quot;admin&quot;</span> <span class="ruby-operator">:</span> <span class="ruby-ivar">@@mu_admin_user</span>
405
+ <span class="ruby-ivar">@password</span> = (<span class="ruby-ivar">@@mu_admin_pass</span>.<span class="ruby-identifier">nil?</span>) <span class="ruby-operator">?</span> <span class="ruby-value str">&quot;admin&quot;</span> <span class="ruby-operator">:</span> <span class="ruby-ivar">@@mu_admin_pass</span>
406
+ <span class="ruby-ivar">@api</span> = <span class="ruby-constant">System</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@host</span>, <span class="ruby-ivar">@username</span>, <span class="ruby-ivar">@password</span>)
407
+ <span class="ruby-identifier">msg</span> <span class="ruby-node">&quot;Created System Api object to :#{@host}&quot;</span>, <span class="ruby-constant">Logger</span><span class="ruby-operator">::</span><span class="ruby-constant">DEBUG</span>
408
+ <span class="ruby-keyword kw">end</span>
409
+ </pre>
410
+ </div>
411
+ </div>
412
+ </div>
413
+
414
+
415
+ </div>
416
+
417
+
418
+ </div>
419
+
420
+
421
+ <div id="validator-badges">
422
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
423
+ </div>
424
+
425
+ </body>
426
+ </html>
@@ -0,0 +1,524 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>Class: Mu::Command::Curl</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="classHeader">
50
+ <table class="header-table">
51
+ <tr class="top-aligned-row">
52
+ <td><strong>Class</strong></td>
53
+ <td class="class-name-in-header">Mu::Command::Curl</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../../files/lib/mu/command/curl_rb.html">
59
+ lib/mu/command/curl.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ <tr class="top-aligned-row">
66
+ <td><strong>Parent:</strong></td>
67
+ <td>
68
+ Command
69
+ </td>
70
+ </tr>
71
+ </table>
72
+ </div>
73
+ <!-- banner header -->
74
+
75
+ <div id="bodyContent">
76
+
77
+
78
+
79
+ <div id="contextContent">
80
+
81
+
82
+
83
+ </div>
84
+
85
+ <div id="method-list">
86
+ <h3 class="section-bar">Methods</h3>
87
+
88
+ <div class="name-list">
89
+ <a href="#M000135">authorize_error</a>&nbsp;&nbsp;
90
+ <a href="#M000137">cmd_default</a>&nbsp;&nbsp;
91
+ <a href="#M000134">cmd_help</a>&nbsp;&nbsp;
92
+ <a href="#M000136">cmd_run</a>&nbsp;&nbsp;
93
+ <a href="#M000140">help</a>&nbsp;&nbsp;
94
+ <a href="#M000141">parse_cli</a>&nbsp;&nbsp;
95
+ <a href="#M000139">print_verify_result</a>&nbsp;&nbsp;
96
+ <a href="#M000138">verify</a>&nbsp;&nbsp;
97
+ </div>
98
+ </div>
99
+
100
+ </div>
101
+
102
+
103
+ <!-- if includes -->
104
+
105
+ <div id="section">
106
+
107
+
108
+
109
+
110
+
111
+
112
+
113
+
114
+ <!-- if method_list -->
115
+ <div id="methods">
116
+ <h3 class="section-bar">Public Instance methods</h3>
117
+
118
+ <div id="method-M000135" class="method-detail">
119
+ <a name="M000135"></a>
120
+
121
+ <div class="method-heading">
122
+ <a href="#M000135" class="method-signature">
123
+ <span class="method-name">authorize_error</span><span class="method-args">(e)</span>
124
+ </a>
125
+ </div>
126
+
127
+ <div class="method-description">
128
+ <p><a class="source-toggle" href="#"
129
+ onclick="toggleCode('M000135-source');return false;">[Source]</a></p>
130
+ <div class="method-source-code" id="M000135-source">
131
+ <pre>
132
+ <span class="ruby-comment cmt"># File lib/mu/command/curl.rb, line 8</span>
133
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">authorize_error</span> <span class="ruby-identifier">e</span>
134
+ <span class="ruby-identifier">base_url</span> = <span class="ruby-node">&quot;#{e.scheme}://#{e.host}:#{e.port}&quot;</span>
135
+ <span class="ruby-identifier">puts</span>
136
+ <span class="ruby-identifier">error</span> <span class="ruby-node">&quot;You haven't verified that you are the dev/ops dude for #{e.host}&quot;</span>
137
+ <span class="ruby-identifier">error</span> <span class="ruby-value str">&quot;&quot;</span>
138
+ <span class="ruby-identifier">error</span> <span class="ruby-value str">&quot;Do one of the following:&quot;</span>
139
+ <span class="ruby-identifier">error</span> <span class="ruby-value str">&quot;- Add an empty file at&quot;</span>
140
+ <span class="ruby-identifier">error</span> <span class="ruby-node">&quot; #{base_url}/#{e.uuid}&quot;</span>
141
+ <span class="ruby-identifier">error</span> <span class="ruby-value str">&quot;- Add the following meta tag to the / page &quot;</span>
142
+ <span class="ruby-identifier">error</span> <span class="ruby-node">&quot; &lt;meta name=\&quot;escale\&quot; content=\&quot;#{e.uuid}\&quot;&gt;&quot;</span>
143
+ <span class="ruby-identifier">error</span> <span class="ruby-value str">&quot;&quot;</span>
144
+ <span class="ruby-identifier">error</span> <span class="ruby-value str">&quot;Use escale curl:authorize when you are done&quot;</span>
145
+ <span class="ruby-identifier">puts</span>
146
+ <span class="ruby-keyword kw">end</span>
147
+ </pre>
148
+ </div>
149
+ </div>
150
+ </div>
151
+
152
+ <div id="method-M000137" class="method-detail">
153
+ <a name="M000137"></a>
154
+
155
+ <div class="method-heading">
156
+ <span class="method-name">cmd_default</span><span class="method-args">(argv)</span>
157
+ </div>
158
+
159
+ <div class="method-description">
160
+ <p>
161
+ Alias for <a href="Curl.html#M000136">cmd_run</a>
162
+ </p>
163
+ </div>
164
+ </div>
165
+
166
+ <div id="method-M000134" class="method-detail">
167
+ <a name="M000134"></a>
168
+
169
+ <div class="method-heading">
170
+ <a href="#M000134" class="method-signature">
171
+ <span class="method-name">cmd_help</span><span class="method-args">(argv)</span>
172
+ </a>
173
+ </div>
174
+
175
+ <div class="method-description">
176
+ <p><a class="source-toggle" href="#"
177
+ onclick="toggleCode('M000134-source');return false;">[Source]</a></p>
178
+ <div class="method-source-code" id="M000134-source">
179
+ <pre>
180
+ <span class="ruby-comment cmt"># File lib/mu/command/curl.rb, line 4</span>
181
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cmd_help</span> <span class="ruby-identifier">argv</span>
182
+ <span class="ruby-identifier">help</span>
183
+ <span class="ruby-keyword kw">end</span>
184
+ </pre>
185
+ </div>
186
+ </div>
187
+ </div>
188
+
189
+ <div id="method-M000136" class="method-detail">
190
+ <a name="M000136"></a>
191
+
192
+ <div class="method-heading">
193
+ <a href="#M000136" class="method-signature">
194
+ <span class="method-name">cmd_run</span><span class="method-args">(argv)</span>
195
+ </a>
196
+ </div>
197
+
198
+ <div class="method-description">
199
+ <p><a class="source-toggle" href="#"
200
+ onclick="toggleCode('M000136-source');return false;">[Source]</a></p>
201
+ <div class="method-source-code" id="M000136-source">
202
+ <pre>
203
+ <span class="ruby-comment cmt"># File lib/mu/command/curl.rb, line 23</span>
204
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cmd_run</span> <span class="ruby-identifier">argv</span>
205
+ <span class="ruby-identifier">args</span> = <span class="ruby-identifier">parse_cli</span> <span class="ruby-identifier">argv</span>
206
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">args</span>[<span class="ruby-value str">'help'</span>]
207
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">help</span>
208
+ <span class="ruby-keyword kw">end</span>
209
+
210
+ <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">args</span>[<span class="ruby-value str">'pattern'</span>]
211
+ <span class="ruby-identifier">verify</span> <span class="ruby-identifier">args</span>
212
+ <span class="ruby-keyword kw">return</span>
213
+ <span class="ruby-keyword kw">end</span>
214
+ <span class="ruby-keyword kw">end</span>
215
+ </pre>
216
+ </div>
217
+ </div>
218
+ </div>
219
+
220
+ <h3 class="section-bar">Private Instance methods</h3>
221
+
222
+ <div id="method-M000140" class="method-detail">
223
+ <a name="M000140"></a>
224
+
225
+ <div class="method-heading">
226
+ <a href="#M000140" class="method-signature">
227
+ <span class="method-name">help</span><span class="method-args">()</span>
228
+ </a>
229
+ </div>
230
+
231
+ <div class="method-description">
232
+ <p><a class="source-toggle" href="#"
233
+ onclick="toggleCode('M000140-source');return false;">[Source]</a></p>
234
+ <div class="method-source-code" id="M000140-source">
235
+ <pre>
236
+ <span class="ruby-comment cmt"># File lib/mu/command/curl.rb, line 95</span>
237
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">help</span>
238
+ <span class="ruby-identifier">helps</span> = [
239
+ { <span class="ruby-identifier">:short</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'-A'</span>, <span class="ruby-identifier">:long</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'--user-agent'</span>, <span class="ruby-identifier">:value</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'&lt;string&gt;'</span>, <span class="ruby-identifier">:help</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'User-Agent to send to server'</span> },
240
+ { <span class="ruby-identifier">:short</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'-b'</span>, <span class="ruby-identifier">:long</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'--cookie'</span>, <span class="ruby-identifier">:value</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'name=&lt;string&gt;'</span>, <span class="ruby-identifier">:help</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'Cookie to send to the server (multiple)'</span> },
241
+ { <span class="ruby-identifier">:short</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'-d'</span>, <span class="ruby-identifier">:long</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'--data'</span>, <span class="ruby-identifier">:value</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'&lt;string&gt;'</span>, <span class="ruby-identifier">:help</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'Data to send in a PUT or POST request'</span> },
242
+ { <span class="ruby-identifier">:short</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'-D'</span>, <span class="ruby-identifier">:long</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'--dump-header'</span>, <span class="ruby-identifier">:value</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'&lt;file&gt;'</span>, <span class="ruby-identifier">:help</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'Print the request/response headers'</span> },
243
+ { <span class="ruby-identifier">:short</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'-e'</span>, <span class="ruby-identifier">:long</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'--referer'</span>, <span class="ruby-identifier">:value</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'&lt;string&gt;'</span>, <span class="ruby-identifier">:help</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'Referer URL'</span> },
244
+ { <span class="ruby-identifier">:short</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'-h'</span>, <span class="ruby-identifier">:long</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'--help'</span>, <span class="ruby-identifier">:value</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">''</span>, <span class="ruby-identifier">:help</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'Help on command line options'</span> },
245
+ { <span class="ruby-identifier">:short</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'-H'</span>, <span class="ruby-identifier">:long</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'--header'</span>, <span class="ruby-identifier">:value</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'&lt;string&gt;'</span>, <span class="ruby-identifier">:help</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'Custom header to pass to server'</span> },
246
+ { <span class="ruby-identifier">:short</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'-p'</span>, <span class="ruby-identifier">:long</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'--pattern'</span>, <span class="ruby-identifier">:value</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'&lt;s&gt;-&lt;e&gt;:&lt;d&gt;'</span>, <span class="ruby-identifier">:help</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'Ramp from s to e concurrent requests in d secs'</span> },
247
+ { <span class="ruby-identifier">:short</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'-r'</span>, <span class="ruby-identifier">:long</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'--region'</span>, <span class="ruby-identifier">:value</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'&lt;string&gt;'</span>, <span class="ruby-identifier">:help</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'Choose one of us-east or us-west'</span> },
248
+ { <span class="ruby-identifier">:short</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'-s'</span>, <span class="ruby-identifier">:long</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'--status'</span>, <span class="ruby-identifier">:value</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'&lt;number&gt;'</span>, <span class="ruby-identifier">:help</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'Assert on the HTTP response status code'</span> },
249
+ { <span class="ruby-identifier">:short</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'-T'</span>, <span class="ruby-identifier">:long</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'--timeout'</span>, <span class="ruby-identifier">:value</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'&lt;ms&gt;'</span>, <span class="ruby-identifier">:help</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'Wait time for both connect and responses'</span> },
250
+ { <span class="ruby-identifier">:short</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'-u'</span>, <span class="ruby-identifier">:long</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'--user'</span>, <span class="ruby-identifier">:value</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'&lt;user[:pass]&gt;'</span>, <span class="ruby-identifier">:help</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'User and password for authentication'</span> },
251
+ { <span class="ruby-identifier">:short</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'-X'</span>, <span class="ruby-identifier">:long</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'--request'</span>, <span class="ruby-identifier">:value</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'&lt;string&gt;'</span>, <span class="ruby-identifier">:help</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'Request method to use (GET, HEAD, PUT, etc.)'</span> },
252
+ { <span class="ruby-identifier">:short</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'-v'</span>, <span class="ruby-identifier">:long</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'--verbose'</span>, <span class="ruby-identifier">:value</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">''</span>, <span class="ruby-identifier">:help</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'Print the request/response headers'</span> },
253
+ { <span class="ruby-identifier">:short</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'-1'</span>, <span class="ruby-identifier">:long</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'--tlsv1'</span>, <span class="ruby-identifier">:value</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">''</span>, <span class="ruby-identifier">:help</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'Use TLSv1 (SSL)'</span> },
254
+ { <span class="ruby-identifier">:short</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'-2'</span>, <span class="ruby-identifier">:long</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'--sslv2'</span>, <span class="ruby-identifier">:value</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">''</span>, <span class="ruby-identifier">:help</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'Use SSLv2 (SSL)'</span> },
255
+ { <span class="ruby-identifier">:short</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'-3'</span>, <span class="ruby-identifier">:long</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'--sslv3'</span>, <span class="ruby-identifier">:value</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">''</span>, <span class="ruby-identifier">:help</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'Use SSLv3 (SSL)'</span> }
256
+ ]
257
+
258
+ <span class="ruby-identifier">max_long_size</span> = <span class="ruby-identifier">helps</span>.<span class="ruby-identifier">inject</span>(<span class="ruby-value">0</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">memo</span>, <span class="ruby-identifier">obj</span><span class="ruby-operator">|</span> [ <span class="ruby-identifier">obj</span>[<span class="ruby-identifier">:long</span>].<span class="ruby-identifier">size</span>, <span class="ruby-identifier">memo</span> ].<span class="ruby-identifier">max</span> }
259
+ <span class="ruby-identifier">max_value_size</span> = <span class="ruby-identifier">helps</span>.<span class="ruby-identifier">inject</span>(<span class="ruby-value">0</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">memo</span>, <span class="ruby-identifier">obj</span><span class="ruby-operator">|</span> [ <span class="ruby-identifier">obj</span>[<span class="ruby-identifier">:value</span>].<span class="ruby-identifier">size</span>, <span class="ruby-identifier">memo</span> ].<span class="ruby-identifier">max</span> }
260
+ <span class="ruby-identifier">puts</span>
261
+ <span class="ruby-identifier">msg</span> <span class="ruby-value str">&quot;Usage: mu curl &lt;options&gt; &lt;url&gt;&quot;</span>
262
+ <span class="ruby-identifier">puts</span>
263
+ <span class="ruby-identifier">helps</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">h</span><span class="ruby-operator">|</span>
264
+ <span class="ruby-identifier">msg</span> <span class="ruby-value str">&quot;%-*s %*s %-*s %s&quot;</span> <span class="ruby-operator">%</span> [<span class="ruby-identifier">max_long_size</span>, <span class="ruby-identifier">h</span>[<span class="ruby-identifier">:long</span>], <span class="ruby-value">2</span>, <span class="ruby-identifier">h</span>[<span class="ruby-identifier">:short</span>], <span class="ruby-identifier">max_value_size</span>, <span class="ruby-identifier">h</span>[<span class="ruby-identifier">:value</span>], <span class="ruby-identifier">h</span>[<span class="ruby-identifier">:help</span>]]
265
+ <span class="ruby-keyword kw">end</span>
266
+ <span class="ruby-identifier">puts</span>
267
+ <span class="ruby-keyword kw">end</span>
268
+ </pre>
269
+ </div>
270
+ </div>
271
+ </div>
272
+
273
+ <div id="method-M000141" class="method-detail">
274
+ <a name="M000141"></a>
275
+
276
+ <div class="method-heading">
277
+ <a href="#M000141" class="method-signature">
278
+ <span class="method-name">parse_cli</span><span class="method-args">(argv)</span>
279
+ </a>
280
+ </div>
281
+
282
+ <div class="method-description">
283
+ <p><a class="source-toggle" href="#"
284
+ onclick="toggleCode('M000141-source');return false;">[Source]</a></p>
285
+ <div class="method-source-code" id="M000141-source">
286
+ <pre>
287
+ <span class="ruby-comment cmt"># File lib/mu/command/curl.rb, line 127</span>
288
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">parse_cli</span> <span class="ruby-identifier">argv</span>
289
+ <span class="ruby-identifier">hash</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
290
+ <span class="ruby-keyword kw">while</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">argv</span>.<span class="ruby-identifier">empty?</span>
291
+ <span class="ruby-keyword kw">break</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">argv</span>.<span class="ruby-identifier">first</span>[<span class="ruby-value">0</span>,<span class="ruby-value">1</span>] <span class="ruby-operator">!=</span> <span class="ruby-value str">'-'</span>
292
+
293
+ <span class="ruby-identifier">k</span> = <span class="ruby-identifier">argv</span>.<span class="ruby-identifier">shift</span>
294
+ <span class="ruby-keyword kw">if</span> [ <span class="ruby-value str">'-A'</span>, <span class="ruby-value str">'--user-agent'</span> ].<span class="ruby-identifier">member?</span> <span class="ruby-identifier">k</span>
295
+ <span class="ruby-identifier">hash</span>[<span class="ruby-value str">'user-agent'</span>] = <span class="ruby-identifier">shift</span>(<span class="ruby-identifier">k</span>, <span class="ruby-identifier">argv</span>)
296
+ <span class="ruby-keyword kw">next</span>
297
+ <span class="ruby-keyword kw">end</span>
298
+
299
+ <span class="ruby-keyword kw">if</span> [ <span class="ruby-value str">'-b'</span>, <span class="ruby-value str">'--cookie'</span> ].<span class="ruby-identifier">member?</span> <span class="ruby-identifier">k</span>
300
+ <span class="ruby-comment cmt"># TODO: support cookie jars</span>
301
+ <span class="ruby-identifier">hash</span>[<span class="ruby-value str">'cookies'</span>] <span class="ruby-operator">||=</span> []
302
+ <span class="ruby-identifier">hash</span>[<span class="ruby-value str">'cookies'</span>] <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">shift</span>(<span class="ruby-identifier">k</span>, <span class="ruby-identifier">argv</span>)
303
+ <span class="ruby-keyword kw">next</span>
304
+ <span class="ruby-keyword kw">end</span>
305
+
306
+ <span class="ruby-keyword kw">if</span> [ <span class="ruby-value str">'-d'</span>, <span class="ruby-value str">'--data'</span> ].<span class="ruby-identifier">member?</span> <span class="ruby-identifier">k</span>
307
+ <span class="ruby-comment cmt"># TODO: Read from a file using the @syntax</span>
308
+ <span class="ruby-identifier">hash</span>[<span class="ruby-value str">'content'</span>] <span class="ruby-operator">||=</span> <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
309
+ <span class="ruby-identifier">hash</span>[<span class="ruby-value str">'content'</span>][<span class="ruby-value str">'data'</span>] <span class="ruby-operator">||=</span> []
310
+ <span class="ruby-identifier">hash</span>[<span class="ruby-value str">'content'</span>][<span class="ruby-value str">'data'</span>] <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">shift</span>(<span class="ruby-identifier">k</span>, <span class="ruby-identifier">argv</span>)
311
+ <span class="ruby-keyword kw">next</span>
312
+ <span class="ruby-keyword kw">end</span>
313
+
314
+ <span class="ruby-keyword kw">if</span> [ <span class="ruby-value str">'-D'</span>, <span class="ruby-value str">'--dump-header'</span> ].<span class="ruby-identifier">member?</span> <span class="ruby-identifier">k</span>
315
+ <span class="ruby-identifier">hash</span>[<span class="ruby-value str">'dump-header'</span>] = <span class="ruby-identifier">shift</span>(<span class="ruby-identifier">k</span>, <span class="ruby-identifier">argv</span>)
316
+ <span class="ruby-keyword kw">next</span>
317
+ <span class="ruby-keyword kw">end</span>
318
+
319
+ <span class="ruby-keyword kw">if</span> [ <span class="ruby-value str">'-e'</span>, <span class="ruby-value str">'--referer'</span>].<span class="ruby-identifier">member?</span> <span class="ruby-identifier">k</span>
320
+ <span class="ruby-identifier">hash</span>[<span class="ruby-value str">'referer'</span>] = <span class="ruby-identifier">shift</span>(<span class="ruby-identifier">k</span>, <span class="ruby-identifier">argv</span>)
321
+ <span class="ruby-keyword kw">next</span>
322
+ <span class="ruby-keyword kw">end</span>
323
+
324
+ <span class="ruby-keyword kw">if</span> [ <span class="ruby-value str">'-h'</span>, <span class="ruby-value str">'--help'</span> ].<span class="ruby-identifier">member?</span> <span class="ruby-identifier">k</span>
325
+ <span class="ruby-identifier">hash</span>[<span class="ruby-value str">'help'</span>] = <span class="ruby-keyword kw">true</span>
326
+ <span class="ruby-keyword kw">next</span>
327
+ <span class="ruby-keyword kw">end</span>
328
+
329
+ <span class="ruby-keyword kw">if</span> [ <span class="ruby-value str">'-H'</span>, <span class="ruby-value str">'--header'</span> ].<span class="ruby-identifier">member?</span> <span class="ruby-identifier">k</span>
330
+ <span class="ruby-identifier">hash</span>[<span class="ruby-value str">'headers'</span>] <span class="ruby-operator">||=</span> []
331
+ <span class="ruby-identifier">hash</span>[<span class="ruby-value str">'headers'</span>].<span class="ruby-identifier">push</span> <span class="ruby-identifier">shift</span>(<span class="ruby-identifier">k</span>, <span class="ruby-identifier">argv</span>)
332
+ <span class="ruby-keyword kw">next</span>
333
+ <span class="ruby-keyword kw">end</span>
334
+
335
+ <span class="ruby-keyword kw">if</span> [ <span class="ruby-value str">'-p'</span>, <span class="ruby-value str">'--pattern'</span> ].<span class="ruby-identifier">member?</span> <span class="ruby-identifier">k</span>
336
+ <span class="ruby-identifier">v</span> = <span class="ruby-identifier">shift</span>(<span class="ruby-identifier">k</span>, <span class="ruby-identifier">argv</span>)
337
+ <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-regexp re">/^(\d+)-(\d+):(\d+)$/</span> <span class="ruby-operator">=~</span> <span class="ruby-identifier">v</span>
338
+ <span class="ruby-identifier">raise</span> <span class="ruby-value str">&quot;invalid ramp pattern&quot;</span>
339
+ <span class="ruby-keyword kw">end</span>
340
+ <span class="ruby-identifier">hash</span>[<span class="ruby-value str">'pattern'</span>] = {
341
+ <span class="ruby-value str">'iterations'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">1</span>,
342
+ <span class="ruby-value str">'intervals'</span> =<span class="ruby-operator">&gt;</span> [{
343
+ <span class="ruby-value str">'iterations'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">1</span>,
344
+ <span class="ruby-value str">'start'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">$1</span>.<span class="ruby-identifier">to_i</span>,
345
+ <span class="ruby-value str">'end'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">$2</span>.<span class="ruby-identifier">to_i</span>,
346
+ <span class="ruby-value str">'duration'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">$3</span>.<span class="ruby-identifier">to_i</span>
347
+ }]
348
+ }
349
+ <span class="ruby-keyword kw">next</span>
350
+ <span class="ruby-keyword kw">end</span>
351
+
352
+ <span class="ruby-keyword kw">if</span> [ <span class="ruby-value str">'-r'</span>, <span class="ruby-value str">'--region'</span> ].<span class="ruby-identifier">member?</span> <span class="ruby-identifier">k</span>
353
+ <span class="ruby-identifier">v</span> = <span class="ruby-identifier">shift</span>(<span class="ruby-identifier">k</span>, <span class="ruby-identifier">argv</span>)
354
+ <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">v</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-value str">&quot;us-west&quot;</span>) <span class="ruby-keyword kw">and</span> <span class="ruby-operator">!</span><span class="ruby-identifier">v</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-value str">&quot;us-east&quot;</span>)
355
+ <span class="ruby-identifier">raise</span> <span class="ruby-value str">'region must be one of us-west or us-east'</span>
356
+ <span class="ruby-keyword kw">end</span>
357
+ <span class="ruby-identifier">hash</span>[<span class="ruby-value str">'region'</span>] = <span class="ruby-identifier">v</span>
358
+ <span class="ruby-keyword kw">next</span>
359
+ <span class="ruby-keyword kw">end</span>
360
+
361
+ <span class="ruby-keyword kw">if</span> [ <span class="ruby-value str">'-s'</span>, <span class="ruby-value str">'--status'</span> ].<span class="ruby-identifier">member?</span> <span class="ruby-identifier">k</span>
362
+ <span class="ruby-identifier">hash</span>[<span class="ruby-value str">'status'</span>] = <span class="ruby-identifier">shift</span>(<span class="ruby-identifier">k</span>, <span class="ruby-identifier">argv</span>).<span class="ruby-identifier">to_i</span>
363
+ <span class="ruby-keyword kw">next</span>
364
+ <span class="ruby-keyword kw">end</span>
365
+
366
+ <span class="ruby-keyword kw">if</span> [ <span class="ruby-value str">'-T'</span>, <span class="ruby-value str">'--timeout'</span> ].<span class="ruby-identifier">member?</span> <span class="ruby-identifier">k</span>
367
+ <span class="ruby-identifier">hash</span>[<span class="ruby-value str">'timeout'</span>] = <span class="ruby-identifier">shift</span>(<span class="ruby-identifier">k</span>, <span class="ruby-identifier">argv</span>).<span class="ruby-identifier">to_i</span>
368
+ <span class="ruby-keyword kw">next</span>
369
+ <span class="ruby-keyword kw">end</span>
370
+
371
+ <span class="ruby-keyword kw">if</span> [ <span class="ruby-value str">'-u'</span>, <span class="ruby-value str">'--user'</span> ].<span class="ruby-identifier">member?</span> <span class="ruby-identifier">k</span>
372
+ <span class="ruby-identifier">hash</span>[<span class="ruby-value str">'user'</span>] = <span class="ruby-identifier">shift</span>(<span class="ruby-identifier">k</span>, <span class="ruby-identifier">argv</span>)
373
+ <span class="ruby-keyword kw">next</span>
374
+ <span class="ruby-keyword kw">end</span>
375
+
376
+ <span class="ruby-keyword kw">if</span> [ <span class="ruby-value str">'-X'</span>, <span class="ruby-value str">'--request'</span> ].<span class="ruby-identifier">member?</span> <span class="ruby-identifier">k</span>
377
+ <span class="ruby-identifier">hash</span>[<span class="ruby-value str">'request'</span>] = <span class="ruby-identifier">shift</span>(<span class="ruby-identifier">k</span>, <span class="ruby-identifier">argv</span>)
378
+ <span class="ruby-keyword kw">next</span>
379
+ <span class="ruby-keyword kw">end</span>
380
+
381
+ <span class="ruby-keyword kw">if</span> [ <span class="ruby-value str">'-v'</span>, <span class="ruby-value str">'--verbose'</span> ].<span class="ruby-identifier">member?</span> <span class="ruby-identifier">k</span>
382
+ <span class="ruby-identifier">hash</span>[<span class="ruby-value str">'verbose'</span>] = <span class="ruby-keyword kw">true</span>
383
+ <span class="ruby-keyword kw">next</span>
384
+ <span class="ruby-keyword kw">end</span>
385
+
386
+ <span class="ruby-keyword kw">if</span> [ <span class="ruby-value str">'-1'</span>, <span class="ruby-value str">'--tlsv1'</span> ].<span class="ruby-identifier">member?</span> <span class="ruby-identifier">k</span>
387
+ <span class="ruby-identifier">hash</span>[<span class="ruby-value str">'ssl'</span>] = <span class="ruby-value str">'tlsv1'</span>
388
+ <span class="ruby-keyword kw">next</span>
389
+ <span class="ruby-keyword kw">end</span>
390
+
391
+ <span class="ruby-keyword kw">if</span> [ <span class="ruby-value str">'-2'</span>, <span class="ruby-value str">'--sslv2'</span> ].<span class="ruby-identifier">member?</span> <span class="ruby-identifier">k</span>
392
+ <span class="ruby-identifier">hash</span>[<span class="ruby-value str">'ssl'</span>] = <span class="ruby-value str">'sslv2'</span>
393
+ <span class="ruby-keyword kw">next</span>
394
+ <span class="ruby-keyword kw">end</span>
395
+
396
+ <span class="ruby-keyword kw">if</span> [ <span class="ruby-value str">'-3'</span>, <span class="ruby-value str">'--sslv3'</span> ].<span class="ruby-identifier">member?</span> <span class="ruby-identifier">k</span>
397
+ <span class="ruby-identifier">hash</span>[<span class="ruby-value str">'ssl'</span>] = <span class="ruby-value str">'sslv2'</span>
398
+ <span class="ruby-keyword kw">next</span>
399
+ <span class="ruby-keyword kw">end</span>
400
+
401
+ <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-node">&quot;Unknown option #{k}&quot;</span>
402
+ <span class="ruby-keyword kw">end</span>
403
+
404
+ <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">hash</span>[<span class="ruby-value str">'help'</span>]
405
+ <span class="ruby-identifier">url</span> = <span class="ruby-identifier">argv</span>.<span class="ruby-identifier">shift</span>
406
+ <span class="ruby-identifier">raise</span> <span class="ruby-value str">'no URL specified!'</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">url</span>.<span class="ruby-identifier">nil?</span>
407
+ <span class="ruby-identifier">hash</span>[<span class="ruby-value str">'url'</span>] = <span class="ruby-identifier">url</span>
408
+ <span class="ruby-keyword kw">end</span>
409
+
410
+ <span class="ruby-identifier">hash</span>
411
+ <span class="ruby-keyword kw">end</span>
412
+ </pre>
413
+ </div>
414
+ </div>
415
+ </div>
416
+
417
+ <div id="method-M000139" class="method-detail">
418
+ <a name="M000139"></a>
419
+
420
+ <div class="method-heading">
421
+ <a href="#M000139" class="method-signature">
422
+ <span class="method-name">print_verify_result</span><span class="method-args">(args, result)</span>
423
+ </a>
424
+ </div>
425
+
426
+ <div class="method-description">
427
+ <p><a class="source-toggle" href="#"
428
+ onclick="toggleCode('M000139-source');return false;">[Source]</a></p>
429
+ <div class="method-source-code" id="M000139-source">
430
+ <pre>
431
+ <span class="ruby-comment cmt"># File lib/mu/command/curl.rb, line 52</span>
432
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">print_verify_result</span> <span class="ruby-identifier">args</span>, <span class="ruby-identifier">result</span>
433
+ <span class="ruby-identifier">rtt</span> = <span class="ruby-identifier">result</span>.<span class="ruby-identifier">duration</span>
434
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">rtt</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">1.0</span>
435
+ <span class="ruby-identifier">rtt</span> = (<span class="ruby-identifier">rtt</span> <span class="ruby-operator">*</span> <span class="ruby-value">1000</span>).<span class="ruby-identifier">floor</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-value str">' ms'</span>;
436
+ <span class="ruby-keyword kw">else</span>
437
+ <span class="ruby-identifier">rtt</span> = (<span class="ruby-value str">&quot;%.2f&quot;</span> <span class="ruby-operator">%</span> <span class="ruby-identifier">rtt</span>) <span class="ruby-operator">+</span> <span class="ruby-value str">' sec'</span>;
438
+ <span class="ruby-keyword kw">end</span>
439
+
440
+ <span class="ruby-identifier">puts</span> <span class="ruby-value str">&quot;-&quot;</span> <span class="ruby-operator">*</span> <span class="ruby-value">70</span>
441
+ <span class="ruby-identifier">msg</span> <span class="ruby-node">&quot;#{result.region}: Response time of #{rtt}&quot;</span>
442
+ <span class="ruby-identifier">puts</span> <span class="ruby-value str">&quot;-&quot;</span> <span class="ruby-operator">*</span> <span class="ruby-value">70</span>
443
+ <span class="ruby-identifier">puts</span>
444
+
445
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">args</span>[<span class="ruby-value str">'dump-header'</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">args</span>[<span class="ruby-value str">'verbose'</span>]
446
+ <span class="ruby-identifier">puts</span> <span class="ruby-value str">&quot;&gt; &quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">result</span>.<span class="ruby-identifier">request</span>.<span class="ruby-identifier">line</span>
447
+ <span class="ruby-identifier">result</span>.<span class="ruby-identifier">request</span>.<span class="ruby-identifier">headers</span>.<span class="ruby-identifier">each_pair</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>, <span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;&gt; #{k}: #{v}\r\n&quot;</span> }
448
+ <span class="ruby-identifier">puts</span>
449
+
450
+ <span class="ruby-identifier">content</span> = <span class="ruby-identifier">result</span>.<span class="ruby-identifier">request</span>.<span class="ruby-identifier">content</span>
451
+ <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">content</span>.<span class="ruby-identifier">empty?</span>
452
+ <span class="ruby-keyword kw">if</span> <span class="ruby-regexp re">/^[[:print:]]+$/</span> <span class="ruby-operator">=~</span> <span class="ruby-identifier">content</span>
453
+ <span class="ruby-identifier">puts</span> <span class="ruby-identifier">content</span>
454
+ <span class="ruby-keyword kw">else</span>
455
+ <span class="ruby-identifier">puts</span> <span class="ruby-constant">Hexy</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">content</span>).<span class="ruby-identifier">to_s</span>
456
+ <span class="ruby-keyword kw">end</span>
457
+ <span class="ruby-identifier">puts</span>
458
+ <span class="ruby-keyword kw">end</span>
459
+
460
+ <span class="ruby-identifier">puts</span> <span class="ruby-value str">&quot;&lt; &quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">result</span>.<span class="ruby-identifier">response</span>.<span class="ruby-identifier">line</span>
461
+ <span class="ruby-identifier">result</span>.<span class="ruby-identifier">response</span>.<span class="ruby-identifier">headers</span>.<span class="ruby-identifier">each_pair</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>, <span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;&gt; #{k}: #{v}\r\n&quot;</span> }
462
+ <span class="ruby-identifier">puts</span>
463
+ <span class="ruby-keyword kw">end</span>
464
+
465
+ <span class="ruby-identifier">content</span> = <span class="ruby-identifier">result</span>.<span class="ruby-identifier">response</span>.<span class="ruby-identifier">content</span>
466
+ <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">content</span>.<span class="ruby-identifier">empty?</span>
467
+ <span class="ruby-keyword kw">if</span> <span class="ruby-regexp re">/^[[:print:]]+$/</span> <span class="ruby-operator">=~</span> <span class="ruby-identifier">content</span>
468
+ <span class="ruby-identifier">puts</span> <span class="ruby-identifier">content</span>
469
+ <span class="ruby-keyword kw">else</span>
470
+ <span class="ruby-identifier">puts</span> <span class="ruby-constant">Hexy</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">content</span>).<span class="ruby-identifier">to_s</span>
471
+ <span class="ruby-keyword kw">end</span>
472
+ <span class="ruby-keyword kw">end</span>
473
+ <span class="ruby-keyword kw">end</span>
474
+ </pre>
475
+ </div>
476
+ </div>
477
+ </div>
478
+
479
+ <div id="method-M000138" class="method-detail">
480
+ <a name="M000138"></a>
481
+
482
+ <div class="method-heading">
483
+ <a href="#M000138" class="method-signature">
484
+ <span class="method-name">verify</span><span class="method-args">(args)</span>
485
+ </a>
486
+ </div>
487
+
488
+ <div class="method-description">
489
+ <p><a class="source-toggle" href="#"
490
+ onclick="toggleCode('M000138-source');return false;">[Source]</a></p>
491
+ <div class="method-source-code" id="M000138-source">
492
+ <pre>
493
+ <span class="ruby-comment cmt"># File lib/mu/command/curl.rb, line 38</span>
494
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">verify</span> <span class="ruby-identifier">args</span>
495
+ <span class="ruby-keyword kw">begin</span>
496
+ <span class="ruby-identifier">job</span> = <span class="ruby-operator">::</span><span class="ruby-constant">Mu</span><span class="ruby-operator">::</span><span class="ruby-constant">Curl</span><span class="ruby-operator">::</span><span class="ruby-constant">Verify</span>.<span class="ruby-identifier">execute</span> <span class="ruby-identifier">args</span>
497
+ <span class="ruby-identifier">result</span> = <span class="ruby-identifier">job</span>.<span class="ruby-identifier">result</span>
498
+ <span class="ruby-identifier">print_verify_result</span> <span class="ruby-identifier">args</span>, <span class="ruby-identifier">result</span>
499
+ <span class="ruby-keyword kw">rescue</span> <span class="ruby-operator">::</span><span class="ruby-constant">Mu</span><span class="ruby-operator">::</span><span class="ruby-constant">Curl</span><span class="ruby-operator">::</span><span class="ruby-constant">Error</span><span class="ruby-operator">::</span><span class="ruby-constant">Authorize</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
500
+ <span class="ruby-identifier">authorize_error</span> <span class="ruby-identifier">e</span>
501
+ <span class="ruby-keyword kw">rescue</span> <span class="ruby-operator">::</span><span class="ruby-constant">Mu</span><span class="ruby-operator">::</span><span class="ruby-constant">Curl</span><span class="ruby-operator">::</span><span class="ruby-constant">Error</span><span class="ruby-operator">::</span><span class="ruby-constant">Region</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
502
+ <span class="ruby-identifier">error</span> <span class="ruby-node">&quot;#{e.region}: #{e.message}&quot;</span>
503
+ <span class="ruby-keyword kw">rescue</span> <span class="ruby-operator">::</span><span class="ruby-constant">Mu</span><span class="ruby-operator">::</span><span class="ruby-constant">Curl</span><span class="ruby-operator">::</span><span class="ruby-constant">Error</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
504
+ <span class="ruby-identifier">error</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">message</span>
505
+ <span class="ruby-keyword kw">end</span>
506
+ <span class="ruby-keyword kw">end</span>
507
+ </pre>
508
+ </div>
509
+ </div>
510
+ </div>
511
+
512
+
513
+ </div>
514
+
515
+
516
+ </div>
517
+
518
+
519
+ <div id="validator-badges">
520
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
521
+ </div>
522
+
523
+ </body>
524
+ </html>