svengali 0.2.7.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. data/LICENSE +20 -0
  2. data/README +0 -0
  3. data/README.rdoc +17 -0
  4. data/Rakefile +47 -0
  5. data/VERSION +1 -0
  6. data/api_document020_en.pdf +0 -0
  7. data/api_document020_ja.pdf +0 -0
  8. data/api_document_en.pptx +0 -0
  9. data/api_document_ja.pptx +0 -0
  10. data/lib/svengali.rb +2 -0
  11. data/lib/svengali/config.rb +78 -0
  12. data/lib/svengali/ext_string.rb +55 -0
  13. data/lib/svengali/ext_string/command.yml +6 -0
  14. data/lib/svengali/ext_string/path.yml +6 -0
  15. data/lib/svengali/file_io.rb +106 -0
  16. data/lib/svengali/machine.rb +123 -0
  17. data/lib/svengali/platforms/debian.rb +5 -0
  18. data/lib/svengali/platforms/default.rb +4 -0
  19. data/lib/svengali/plugins/eucalyptus.rb +339 -0
  20. data/lib/svengali/plugins/machine_config.rb +126 -0
  21. data/lib/svengali/plugins/package.rb +7 -0
  22. data/lib/svengali/ssh.rb +106 -0
  23. data/lib/svengali/svengali.rb +19 -0
  24. data/lib/svengali/util.rb +117 -0
  25. data/rdoc/classes/CLibIPAddr.html +230 -0
  26. data/rdoc/classes/Cloud.html +506 -0
  27. data/rdoc/classes/Config.html +151 -0
  28. data/rdoc/classes/Config/ConfigFile.html +319 -0
  29. data/rdoc/classes/ExtStr.html +209 -0
  30. data/rdoc/classes/ExtStrAccessor.html +183 -0
  31. data/rdoc/classes/FileIO.html +415 -0
  32. data/rdoc/classes/Machine.html +771 -0
  33. data/rdoc/classes/MachineMaster.html +117 -0
  34. data/rdoc/classes/Platform.html +121 -0
  35. data/rdoc/classes/SSH.html +315 -0
  36. data/rdoc/created.rid +1 -0
  37. data/rdoc/files/README.html +101 -0
  38. data/rdoc/files/README_rdoc.html +133 -0
  39. data/rdoc/files/lib/svengali/config_rb.html +114 -0
  40. data/rdoc/files/lib/svengali/ext_string_rb.html +108 -0
  41. data/rdoc/files/lib/svengali/file_io_rb.html +115 -0
  42. data/rdoc/files/lib/svengali/machine_rb.html +108 -0
  43. data/rdoc/files/lib/svengali/platforms/debian_rb.html +107 -0
  44. data/rdoc/files/lib/svengali/platforms/default_rb.html +107 -0
  45. data/rdoc/files/lib/svengali/plugins/eucalyptus_rb.html +389 -0
  46. data/rdoc/files/lib/svengali/plugins/machine_config_rb.html +101 -0
  47. data/rdoc/files/lib/svengali/plugins/package_rb.html +101 -0
  48. data/rdoc/files/lib/svengali/ssh_rb.html +110 -0
  49. data/rdoc/files/lib/svengali/svengali_rb.html +125 -0
  50. data/rdoc/files/lib/svengali/util_rb.html +439 -0
  51. data/rdoc/files/lib/svengali_rb.html +108 -0
  52. data/rdoc/fr_class_index.html +37 -0
  53. data/rdoc/fr_file_index.html +41 -0
  54. data/rdoc/fr_method_index.html +100 -0
  55. data/rdoc/index.html +26 -0
  56. data/rdoc/rdoc-style.css +208 -0
  57. data/spec/spec.opts +1 -0
  58. data/spec/spec_helper.rb +9 -0
  59. data/spec/svengali_spec.rb +7 -0
  60. data/svengali.gemspec +113 -0
  61. data/svengali_sample.rb +43 -0
  62. data/test/scenario.sh +3 -0
  63. metadata +179 -0
@@ -0,0 +1,151 @@
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>Module: Config</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>Module</strong></td>
53
+ <td class="class-name-in-header">Config</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../files/lib/svengali/config_rb.html">
59
+ lib/svengali/config.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ </table>
66
+ </div>
67
+ <!-- banner header -->
68
+
69
+ <div id="bodyContent">
70
+
71
+
72
+
73
+ <div id="contextContent">
74
+
75
+
76
+
77
+ </div>
78
+
79
+ <div id="method-list">
80
+ <h3 class="section-bar">Methods</h3>
81
+
82
+ <div class="name-list">
83
+ <a href="#M000059">get_config_file</a>&nbsp;&nbsp;
84
+ </div>
85
+ </div>
86
+
87
+ </div>
88
+
89
+
90
+ <!-- if includes -->
91
+
92
+ <div id="section">
93
+
94
+ <div id="class-list">
95
+ <h3 class="section-bar">Classes and Modules</h3>
96
+
97
+ Class <a href="Config/ConfigFile.html" class="link">Config::ConfigFile</a><br />
98
+
99
+ </div>
100
+
101
+
102
+
103
+
104
+
105
+
106
+
107
+ <!-- if method_list -->
108
+ <div id="methods">
109
+ <h3 class="section-bar">Public Instance methods</h3>
110
+
111
+ <div id="method-M000059" class="method-detail">
112
+ <a name="M000059"></a>
113
+
114
+ <div class="method-heading">
115
+ <a href="#M000059" class="method-signature">
116
+ <span class="method-name">get_config_file</span><span class="method-args">(remote_filepath_str)</span>
117
+ </a>
118
+ </div>
119
+
120
+ <div class="method-description">
121
+ <p>
122
+ if there isn&#8216;t a file which has specified file name, New file is
123
+ created.
124
+ </p>
125
+ <p><a class="source-toggle" href="#"
126
+ onclick="toggleCode('M000059-source');return false;">[Source]</a></p>
127
+ <div class="method-source-code" id="M000059-source">
128
+ <pre>
129
+ <span class="ruby-comment cmt"># File lib/svengali/config.rb, line 7</span>
130
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_config_file</span>(<span class="ruby-identifier">remote_filepath_str</span>)
131
+ <span class="ruby-comment cmt"># passed @sftp_session is not one of ConfigFile</span>
132
+ <span class="ruby-keyword kw">return</span> <span class="ruby-constant">ConfigFile</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">remote_filepath_str</span>,<span class="ruby-ivar">@sftp_session</span>)
133
+ <span class="ruby-keyword kw">end</span>
134
+ </pre>
135
+ </div>
136
+ </div>
137
+ </div>
138
+
139
+
140
+ </div>
141
+
142
+
143
+ </div>
144
+
145
+
146
+ <div id="validator-badges">
147
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
148
+ </div>
149
+
150
+ </body>
151
+ </html>
@@ -0,0 +1,319 @@
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: Config::ConfigFile</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">Config::ConfigFile</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../files/lib/svengali/config_rb.html">
59
+ lib/svengali/config.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
+ Object
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="#M000062">append_str</a>&nbsp;&nbsp;
90
+ <a href="#M000060">new</a>&nbsp;&nbsp;
91
+ <a href="#M000064">remove_col_by_regexp</a>&nbsp;&nbsp;
92
+ <a href="#M000063">remove_col_by_str</a>&nbsp;&nbsp;
93
+ <a href="#M000061">replace_col</a>&nbsp;&nbsp;
94
+ <a href="#M000065">save</a>&nbsp;&nbsp;
95
+ </div>
96
+ </div>
97
+
98
+ </div>
99
+
100
+
101
+ <!-- if includes -->
102
+ <div id="includes">
103
+ <h3 class="section-bar">Included Modules</h3>
104
+
105
+ <div id="includes-list">
106
+ <span class="include-name"><a href="../FileIO.html">FileIO</a></span>
107
+ </div>
108
+ </div>
109
+
110
+ <div id="section">
111
+
112
+
113
+
114
+
115
+
116
+
117
+
118
+
119
+ <!-- if method_list -->
120
+ <div id="methods">
121
+ <h3 class="section-bar">Public Class methods</h3>
122
+
123
+ <div id="method-M000060" class="method-detail">
124
+ <a name="M000060"></a>
125
+
126
+ <div class="method-heading">
127
+ <a href="#M000060" class="method-signature">
128
+ <span class="method-name">new</span><span class="method-args">(remote_path_str,sftp_session)</span>
129
+ </a>
130
+ </div>
131
+
132
+ <div class="method-description">
133
+ <p>
134
+ ssh_session =&gt; Net::SFTP::Session <a
135
+ href="ConfigFile.html">ConfigFile</a> class doesn&#8216;t manage passed
136
+ sftp_session value
137
+ </p>
138
+ <p><a class="source-toggle" href="#"
139
+ onclick="toggleCode('M000060-source');return false;">[Source]</a></p>
140
+ <div class="method-source-code" id="M000060-source">
141
+ <pre>
142
+ <span class="ruby-comment cmt"># File lib/svengali/config.rb, line 22</span>
143
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">remote_path_str</span>,<span class="ruby-identifier">sftp_session</span>)
144
+ <span class="ruby-ivar">@sftp_session</span> = <span class="ruby-identifier">sftp_session</span>
145
+
146
+ <span class="ruby-ivar">@remote_filepath_str</span> = <span class="ruby-identifier">remote_path_str</span>
147
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">is_exist</span>(<span class="ruby-identifier">remote_path_str</span>)
148
+ <span class="ruby-comment cmt"># config_file = @sftp_session.open!(remote_path_str)</span>
149
+ <span class="ruby-ivar">@config_file_contents</span> = <span class="ruby-identifier">get_contents_remote</span>(<span class="ruby-ivar">@remote_filepath_str</span>)
150
+ <span class="ruby-keyword kw">else</span>
151
+ <span class="ruby-ivar">@config_file_contents</span> = <span class="ruby-value str">&quot;&quot;</span>
152
+ <span class="ruby-keyword kw">end</span>
153
+
154
+ <span class="ruby-keyword kw">end</span>
155
+ </pre>
156
+ </div>
157
+ </div>
158
+ </div>
159
+
160
+ <h3 class="section-bar">Public Instance methods</h3>
161
+
162
+ <div id="method-M000062" class="method-detail">
163
+ <a name="M000062"></a>
164
+
165
+ <div class="method-heading">
166
+ <a href="#M000062" class="method-signature">
167
+ <span class="method-name">append_str</span><span class="method-args">(str)</span>
168
+ </a>
169
+ </div>
170
+
171
+ <div class="method-description">
172
+ <p><a class="source-toggle" href="#"
173
+ onclick="toggleCode('M000062-source');return false;">[Source]</a></p>
174
+ <div class="method-source-code" id="M000062-source">
175
+ <pre>
176
+ <span class="ruby-comment cmt"># File lib/svengali/config.rb, line 48</span>
177
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">append_str</span>(<span class="ruby-identifier">str</span>)
178
+ <span class="ruby-ivar">@config_file_contents</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">str</span>
179
+ <span class="ruby-keyword kw">end</span>
180
+ </pre>
181
+ </div>
182
+ </div>
183
+ </div>
184
+
185
+ <div id="method-M000064" class="method-detail">
186
+ <a name="M000064"></a>
187
+
188
+ <div class="method-heading">
189
+ <a href="#M000064" class="method-signature">
190
+ <span class="method-name">remove_col_by_regexp</span><span class="method-args">(regexp)</span>
191
+ </a>
192
+ </div>
193
+
194
+ <div class="method-description">
195
+ <p>
196
+ remove columns which matched passed regular expression
197
+ </p>
198
+ <p><a class="source-toggle" href="#"
199
+ onclick="toggleCode('M000064-source');return false;">[Source]</a></p>
200
+ <div class="method-source-code" id="M000064-source">
201
+ <pre>
202
+ <span class="ruby-comment cmt"># File lib/svengali/config.rb, line 68</span>
203
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">remove_col_by_regexp</span>(<span class="ruby-identifier">regexp</span>)
204
+ <span class="ruby-identifier">not_inp</span>()
205
+ <span class="ruby-keyword kw">end</span>
206
+ </pre>
207
+ </div>
208
+ </div>
209
+ </div>
210
+
211
+ <div id="method-M000063" class="method-detail">
212
+ <a name="M000063"></a>
213
+
214
+ <div class="method-heading">
215
+ <a href="#M000063" class="method-signature">
216
+ <span class="method-name">remove_col_by_str</span><span class="method-args">(str)</span>
217
+ </a>
218
+ </div>
219
+
220
+ <div class="method-description">
221
+ <p>
222
+ remove all columns which contains passed string
223
+ </p>
224
+ <p><a class="source-toggle" href="#"
225
+ onclick="toggleCode('M000063-source');return false;">[Source]</a></p>
226
+ <div class="method-source-code" id="M000063-source">
227
+ <pre>
228
+ <span class="ruby-comment cmt"># File lib/svengali/config.rb, line 53</span>
229
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">remove_col_by_str</span>(<span class="ruby-identifier">str</span>)
230
+ <span class="ruby-identifier">orig_contents_io</span> = <span class="ruby-constant">StringIO</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@config_file_contents</span>)
231
+ <span class="ruby-identifier">removed_contents_io</span> = <span class="ruby-constant">StringIO</span>.<span class="ruby-identifier">new</span>()
232
+ <span class="ruby-identifier">orig_contents_io</span>.<span class="ruby-identifier">each_line</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">line</span><span class="ruby-operator">|</span>
233
+ <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">line</span>.<span class="ruby-identifier">index</span>(<span class="ruby-identifier">str</span>)
234
+ <span class="ruby-identifier">removed_contents_io</span>.<span class="ruby-identifier">puts</span>(<span class="ruby-identifier">line</span>)
235
+ <span class="ruby-keyword kw">end</span>
236
+ }
237
+ <span class="ruby-identifier">orig_contents_io</span>.<span class="ruby-identifier">close</span>()
238
+ <span class="ruby-identifier">removed_contents_io</span>.<span class="ruby-identifier">close</span>()
239
+
240
+ <span class="ruby-ivar">@config_file_contents</span> = <span class="ruby-identifier">removed_contents_io</span>.<span class="ruby-identifier">string</span>
241
+ <span class="ruby-keyword kw">end</span>
242
+ </pre>
243
+ </div>
244
+ </div>
245
+ </div>
246
+
247
+ <div id="method-M000061" class="method-detail">
248
+ <a name="M000061"></a>
249
+
250
+ <div class="method-heading">
251
+ <a href="#M000061" class="method-signature">
252
+ <span class="method-name">replace_col</span><span class="method-args">(original_col_str,replaced_col_str)</span>
253
+ </a>
254
+ </div>
255
+
256
+ <div class="method-description">
257
+ <p>
258
+ replace columns which has specified content
259
+ </p>
260
+ <p><a class="source-toggle" href="#"
261
+ onclick="toggleCode('M000061-source');return false;">[Source]</a></p>
262
+ <div class="method-source-code" id="M000061-source">
263
+ <pre>
264
+ <span class="ruby-comment cmt"># File lib/svengali/config.rb, line 36</span>
265
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">replace_col</span>(<span class="ruby-identifier">original_col_str</span>,<span class="ruby-identifier">replaced_col_str</span>)
266
+ <span class="ruby-identifier">orig_contents_io</span> = <span class="ruby-constant">StringIO</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@config_file_contents</span>)
267
+ <span class="ruby-identifier">replaced_contents_io</span> = <span class="ruby-constant">StringIO</span>.<span class="ruby-identifier">new</span>()
268
+ <span class="ruby-identifier">orig_contents_io</span>.<span class="ruby-identifier">each_line</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">line</span><span class="ruby-operator">|</span>
269
+ <span class="ruby-identifier">replaced_contents_io</span>.<span class="ruby-identifier">puts</span>(<span class="ruby-identifier">line</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-identifier">original_col_str</span>,<span class="ruby-identifier">replaced_col_str</span>))
270
+ }
271
+ <span class="ruby-identifier">orig_contents_io</span>.<span class="ruby-identifier">close</span>()
272
+ <span class="ruby-identifier">replaced_contents_io</span>.<span class="ruby-identifier">close</span>()
273
+
274
+ <span class="ruby-ivar">@config_file_contents</span> = <span class="ruby-identifier">replaced_contents_io</span>.<span class="ruby-identifier">string</span>
275
+ <span class="ruby-keyword kw">end</span>
276
+ </pre>
277
+ </div>
278
+ </div>
279
+ </div>
280
+
281
+ <div id="method-M000065" class="method-detail">
282
+ <a name="M000065"></a>
283
+
284
+ <div class="method-heading">
285
+ <a href="#M000065" class="method-signature">
286
+ <span class="method-name">save</span><span class="method-args">()</span>
287
+ </a>
288
+ </div>
289
+
290
+ <div class="method-description">
291
+ <p>
292
+ <a href="ConfigFile.html#M000065">save</a> modified content
293
+ </p>
294
+ <p><a class="source-toggle" href="#"
295
+ onclick="toggleCode('M000065-source');return false;">[Source]</a></p>
296
+ <div class="method-source-code" id="M000065-source">
297
+ <pre>
298
+ <span class="ruby-comment cmt"># File lib/svengali/config.rb, line 73</span>
299
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">save</span>
300
+ <span class="ruby-identifier">write_contents_remote</span>(<span class="ruby-ivar">@remote_filepath_str</span>,<span class="ruby-ivar">@config_file_contents</span>)
301
+ <span class="ruby-keyword kw">end</span>
302
+ </pre>
303
+ </div>
304
+ </div>
305
+ </div>
306
+
307
+
308
+ </div>
309
+
310
+
311
+ </div>
312
+
313
+
314
+ <div id="validator-badges">
315
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
316
+ </div>
317
+
318
+ </body>
319
+ </html>