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,209 @@
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: ExtStr</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">ExtStr</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../files/lib/svengali/ext_string_rb.html">
59
+ lib/svengali/ext_string.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
+ <div id="description">
82
+ <p>
83
+ manages externarized strings on YAML files
84
+ </p>
85
+
86
+ </div>
87
+
88
+
89
+ </div>
90
+
91
+ <div id="method-list">
92
+ <h3 class="section-bar">Methods</h3>
93
+
94
+ <div class="name-list">
95
+ <a href="#M000031">cmd</a>&nbsp;&nbsp;
96
+ <a href="#M000032">init</a>&nbsp;&nbsp;
97
+ <a href="#M000030">path</a>&nbsp;&nbsp;
98
+ </div>
99
+ </div>
100
+
101
+ </div>
102
+
103
+
104
+ <!-- if includes -->
105
+
106
+ <div id="section">
107
+
108
+
109
+
110
+
111
+
112
+
113
+
114
+
115
+ <!-- if method_list -->
116
+ <div id="methods">
117
+ <h3 class="section-bar">Public Class methods</h3>
118
+
119
+ <div id="method-M000031" class="method-detail">
120
+ <a name="M000031"></a>
121
+
122
+ <div class="method-heading">
123
+ <a href="#M000031" class="method-signature">
124
+ <span class="method-name">cmd</span><span class="method-args">()</span>
125
+ </a>
126
+ </div>
127
+
128
+ <div class="method-description">
129
+ <p><a class="source-toggle" href="#"
130
+ onclick="toggleCode('M000031-source');return false;">[Source]</a></p>
131
+ <div class="method-source-code" id="M000031-source">
132
+ <pre>
133
+ <span class="ruby-comment cmt"># File lib/svengali/ext_string.rb, line 16</span>
134
+ <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">cmd</span>()
135
+ <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@@command_accessor</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-ivar">@@path_accessor</span>
136
+ <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">init</span>()
137
+ <span class="ruby-keyword kw">end</span>
138
+
139
+ <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@@command_accessor</span>
140
+ <span class="ruby-keyword kw">end</span>
141
+ </pre>
142
+ </div>
143
+ </div>
144
+ </div>
145
+
146
+ <div id="method-M000032" class="method-detail">
147
+ <a name="M000032"></a>
148
+
149
+ <div class="method-heading">
150
+ <a href="#M000032" class="method-signature">
151
+ <span class="method-name">init</span><span class="method-args">()</span>
152
+ </a>
153
+ </div>
154
+
155
+ <div class="method-description">
156
+ <p><a class="source-toggle" href="#"
157
+ onclick="toggleCode('M000032-source');return false;">[Source]</a></p>
158
+ <div class="method-source-code" id="M000032-source">
159
+ <pre>
160
+ <span class="ruby-comment cmt"># File lib/svengali/ext_string.rb, line 24</span>
161
+ <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">init</span>()
162
+ <span class="ruby-ivar">@@command_accessor</span> = <span class="ruby-constant">ExtStrAccessor</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">File</span><span class="ruby-operator">::</span><span class="ruby-identifier">dirname</span>(<span class="ruby-keyword kw">__FILE__</span>) <span class="ruby-operator">+</span> <span class="ruby-value str">&quot;/ext_string/command.yml&quot;</span>,<span class="ruby-identifier">$platform_name</span>)
163
+ <span class="ruby-ivar">@@path_accessor</span> = <span class="ruby-constant">ExtStrAccessor</span>.<span class="ruby-identifier">new</span>( <span class="ruby-constant">File</span><span class="ruby-operator">::</span><span class="ruby-identifier">dirname</span>(<span class="ruby-keyword kw">__FILE__</span>) <span class="ruby-operator">+</span> <span class="ruby-value str">&quot;/ext_string/path.yml&quot;</span>,<span class="ruby-identifier">$platform_name</span>)
164
+ <span class="ruby-keyword kw">end</span>
165
+ </pre>
166
+ </div>
167
+ </div>
168
+ </div>
169
+
170
+ <div id="method-M000030" class="method-detail">
171
+ <a name="M000030"></a>
172
+
173
+ <div class="method-heading">
174
+ <a href="#M000030" class="method-signature">
175
+ <span class="method-name">path</span><span class="method-args">()</span>
176
+ </a>
177
+ </div>
178
+
179
+ <div class="method-description">
180
+ <p><a class="source-toggle" href="#"
181
+ onclick="toggleCode('M000030-source');return false;">[Source]</a></p>
182
+ <div class="method-source-code" id="M000030-source">
183
+ <pre>
184
+ <span class="ruby-comment cmt"># File lib/svengali/ext_string.rb, line 8</span>
185
+ <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">path</span>()
186
+ <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@@command_accessor</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-ivar">@@path_accessor</span>
187
+ <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">init</span>()
188
+ <span class="ruby-keyword kw">end</span>
189
+
190
+ <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@@path_accessor</span>
191
+ <span class="ruby-keyword kw">end</span>
192
+ </pre>
193
+ </div>
194
+ </div>
195
+ </div>
196
+
197
+
198
+ </div>
199
+
200
+
201
+ </div>
202
+
203
+
204
+ <div id="validator-badges">
205
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
206
+ </div>
207
+
208
+ </body>
209
+ </html>
@@ -0,0 +1,183 @@
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: ExtStrAccessor</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">ExtStrAccessor</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../files/lib/svengali/ext_string_rb.html">
59
+ lib/svengali/ext_string.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="#M000029">[]</a>&nbsp;&nbsp;
90
+ <a href="#M000028">new</a>&nbsp;&nbsp;
91
+ </div>
92
+ </div>
93
+
94
+ </div>
95
+
96
+
97
+ <!-- if includes -->
98
+
99
+ <div id="section">
100
+
101
+
102
+
103
+
104
+
105
+
106
+
107
+
108
+ <!-- if method_list -->
109
+ <div id="methods">
110
+ <h3 class="section-bar">Public Class methods</h3>
111
+
112
+ <div id="method-M000028" class="method-detail">
113
+ <a name="M000028"></a>
114
+
115
+ <div class="method-heading">
116
+ <a href="#M000028" class="method-signature">
117
+ <span class="method-name">new</span><span class="method-args">(file_name_str,first_level_name)</span>
118
+ </a>
119
+ </div>
120
+
121
+ <div class="method-description">
122
+ <p><a class="source-toggle" href="#"
123
+ onclick="toggleCode('M000028-source');return false;">[Source]</a></p>
124
+ <div class="method-source-code" id="M000028-source">
125
+ <pre>
126
+ <span class="ruby-comment cmt"># File lib/svengali/ext_string.rb, line 36</span>
127
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">file_name_str</span>,<span class="ruby-identifier">first_level_name</span>)
128
+ <span class="ruby-ivar">@contents_hash</span> = <span class="ruby-constant">YAML</span>.<span class="ruby-identifier">load_file</span>( <span class="ruby-identifier">file_name_str</span> )
129
+ <span class="ruby-ivar">@first_level</span> = <span class="ruby-identifier">first_level_name</span>
130
+ <span class="ruby-keyword kw">end</span>
131
+ </pre>
132
+ </div>
133
+ </div>
134
+ </div>
135
+
136
+ <h3 class="section-bar">Public Instance methods</h3>
137
+
138
+ <div id="method-M000029" class="method-detail">
139
+ <a name="M000029"></a>
140
+
141
+ <div class="method-heading">
142
+ <a href="#M000029" class="method-signature">
143
+ <span class="method-name">[]</span><span class="method-args">(key)</span>
144
+ </a>
145
+ </div>
146
+
147
+ <div class="method-description">
148
+ <p><a class="source-toggle" href="#"
149
+ onclick="toggleCode('M000029-source');return false;">[Source]</a></p>
150
+ <div class="method-source-code" id="M000029-source">
151
+ <pre>
152
+ <span class="ruby-comment cmt"># File lib/svengali/ext_string.rb, line 41</span>
153
+ <span class="ruby-keyword kw">def</span> <span class="ruby-operator">[]</span>(<span class="ruby-identifier">key</span>)
154
+ <span class="ruby-identifier">val</span> = <span class="ruby-ivar">@contents_hash</span>[<span class="ruby-ivar">@first_level</span>][<span class="ruby-identifier">key</span>]
155
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">val</span>
156
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">val</span>
157
+ <span class="ruby-keyword kw">else</span>
158
+ <span class="ruby-identifier">default_val</span> = <span class="ruby-ivar">@contents_hash</span>[<span class="ruby-value str">&quot;default&quot;</span>][<span class="ruby-identifier">val</span>]
159
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">default_val</span>
160
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">default_val</span>
161
+ <span class="ruby-keyword kw">else</span>
162
+ <span class="ruby-identifier">debug_p</span> <span class="ruby-node">&quot;key( #{key.to_s} ) is not found on even default hash!&quot;</span>
163
+ <span class="ruby-keyword kw">end</span>
164
+ <span class="ruby-keyword kw">end</span>
165
+ <span class="ruby-keyword kw">end</span>
166
+ </pre>
167
+ </div>
168
+ </div>
169
+ </div>
170
+
171
+
172
+ </div>
173
+
174
+
175
+ </div>
176
+
177
+
178
+ <div id="validator-badges">
179
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
180
+ </div>
181
+
182
+ </body>
183
+ </html>
@@ -0,0 +1,415 @@
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: FileIO</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">FileIO</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../files/lib/svengali/file_io_rb.html">
59
+ lib/svengali/file_io.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="#M000073">get_contents_remote</a>&nbsp;&nbsp;
84
+ <a href="#M000072">is_exist</a>&nbsp;&nbsp;
85
+ <a href="#M000067">pull_a_file</a>&nbsp;&nbsp;
86
+ <a href="#M000071">pull_dir</a>&nbsp;&nbsp;
87
+ <a href="#M000069">pull_files</a>&nbsp;&nbsp;
88
+ <a href="#M000066">push_a_file</a>&nbsp;&nbsp;
89
+ <a href="#M000070">push_dir</a>&nbsp;&nbsp;
90
+ <a href="#M000068">push_files</a>&nbsp;&nbsp;
91
+ <a href="#M000074">write_contents_remote</a>&nbsp;&nbsp;
92
+ </div>
93
+ </div>
94
+
95
+ </div>
96
+
97
+
98
+ <!-- if includes -->
99
+
100
+ <div id="section">
101
+
102
+
103
+ <div id="constants-list">
104
+ <h3 class="section-bar">Constants</h3>
105
+
106
+ <div class="name-list">
107
+ <table summary="Constants">
108
+ <tr class="top-aligned-row context-row">
109
+ <td class="context-item-name">BUFFER_SIZE</td>
110
+ <td>=</td>
111
+ <td class="context-item-value">1024</td>
112
+ </tr>
113
+ </table>
114
+ </div>
115
+ </div>
116
+
117
+
118
+
119
+
120
+
121
+
122
+ <!-- if method_list -->
123
+ <div id="methods">
124
+ <h3 class="section-bar">Public Instance methods</h3>
125
+
126
+ <div id="method-M000073" class="method-detail">
127
+ <a name="M000073"></a>
128
+
129
+ <div class="method-heading">
130
+ <a href="#M000073" class="method-signature">
131
+ <span class="method-name">get_contents_remote</span><span class="method-args">(remote_filepath_str)</span>
132
+ </a>
133
+ </div>
134
+
135
+ <div class="method-description">
136
+ <p><a class="source-toggle" href="#"
137
+ onclick="toggleCode('M000073-source');return false;">[Source]</a></p>
138
+ <div class="method-source-code" id="M000073-source">
139
+ <pre>
140
+ <span class="ruby-comment cmt"># File lib/svengali/file_io.rb, line 84</span>
141
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_contents_remote</span>(<span class="ruby-identifier">remote_filepath_str</span>)
142
+ <span class="ruby-identifier">debug_p</span>(<span class="ruby-node">&quot;get_contents_remote from #{remote_filepath_str}&quot;</span>)
143
+ <span class="ruby-identifier">handle</span> = <span class="ruby-ivar">@sftp_session</span>.<span class="ruby-identifier">open!</span>(<span class="ruby-identifier">remote_filepath_str</span>)
144
+ <span class="ruby-identifier">contents</span> = <span class="ruby-constant">String</span>.<span class="ruby-identifier">new</span>()
145
+ <span class="ruby-identifier">offset</span> = <span class="ruby-value">0</span>
146
+ <span class="ruby-keyword kw">while</span> (<span class="ruby-identifier">data</span> = <span class="ruby-ivar">@sftp_session</span>.<span class="ruby-identifier">read!</span>(<span class="ruby-identifier">handle</span>, <span class="ruby-identifier">offset</span>, <span class="ruby-constant">BUFFER_SIZE</span>)) <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
147
+ <span class="ruby-identifier">contents</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">data</span>
148
+ <span class="ruby-identifier">offset</span> <span class="ruby-operator">+=</span> <span class="ruby-constant">BUFFER_SIZE</span>
149
+ <span class="ruby-keyword kw">end</span>
150
+ <span class="ruby-ivar">@sftp_session</span>.<span class="ruby-identifier">close!</span>(<span class="ruby-identifier">handle</span>)
151
+
152
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">contents</span>
153
+ <span class="ruby-keyword kw">end</span>
154
+ </pre>
155
+ </div>
156
+ </div>
157
+ </div>
158
+
159
+ <div id="method-M000072" class="method-detail">
160
+ <a name="M000072"></a>
161
+
162
+ <div class="method-heading">
163
+ <a href="#M000072" class="method-signature">
164
+ <span class="method-name">is_exist</span><span class="method-args">(remote_path)</span>
165
+ </a>
166
+ </div>
167
+
168
+ <div class="method-description">
169
+ <p>
170
+ return -&gt; boolean :
171
+ </p>
172
+ <p><a class="source-toggle" href="#"
173
+ onclick="toggleCode('M000072-source');return false;">[Source]</a></p>
174
+ <div class="method-source-code" id="M000072-source">
175
+ <pre>
176
+ <span class="ruby-comment cmt"># File lib/svengali/file_io.rb, line 72</span>
177
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">is_exist</span>(<span class="ruby-identifier">remote_path</span>)
178
+ <span class="ruby-keyword kw">begin</span>
179
+ <span class="ruby-ivar">@sftp_session</span>.<span class="ruby-identifier">stat!</span>(<span class="ruby-identifier">remote_path</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">response</span><span class="ruby-operator">|</span>
180
+ <span class="ruby-comment cmt">#returns whether exists or not</span>
181
+ <span class="ruby-keyword kw">next</span> <span class="ruby-identifier">response</span>.<span class="ruby-identifier">ok?</span>
182
+ }
183
+ <span class="ruby-keyword kw">rescue</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
184
+ <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span>
185
+ <span class="ruby-keyword kw">end</span>
186
+ <span class="ruby-keyword kw">end</span>
187
+ </pre>
188
+ </div>
189
+ </div>
190
+ </div>
191
+
192
+ <div id="method-M000067" class="method-detail">
193
+ <a name="M000067"></a>
194
+
195
+ <div class="method-heading">
196
+ <a href="#M000067" class="method-signature">
197
+ <span class="method-name">pull_a_file</span><span class="method-args">(remote_path,local_path)</span>
198
+ </a>
199
+ </div>
200
+
201
+ <div class="method-description">
202
+ <p><a class="source-toggle" href="#"
203
+ onclick="toggleCode('M000067-source');return false;">[Source]</a></p>
204
+ <div class="method-source-code" id="M000067-source">
205
+ <pre>
206
+ <span class="ruby-comment cmt"># File lib/svengali/file_io.rb, line 14</span>
207
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pull_a_file</span>(<span class="ruby-identifier">remote_path</span>,<span class="ruby-identifier">local_path</span>)
208
+ <span class="ruby-identifier">debug_p</span>(<span class="ruby-node">&quot;pull_a_file from #{remote_path} to #{local_path}&quot;</span>)
209
+
210
+ <span class="ruby-keyword kw">begin</span>
211
+ <span class="ruby-ivar">@sftp_session</span>.<span class="ruby-identifier">download!</span>(<span class="ruby-identifier">remote_path</span>,<span class="ruby-identifier">local_path</span>)
212
+ <span class="ruby-keyword kw">rescue</span>
213
+ <span class="ruby-identifier">debug_p</span> <span class="ruby-identifier">remote_path</span> <span class="ruby-operator">+</span> <span class="ruby-value str">&quot; is not found on remote!!&quot;</span>
214
+ <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span>
215
+ <span class="ruby-keyword kw">end</span>
216
+ <span class="ruby-keyword kw">end</span>
217
+ </pre>
218
+ </div>
219
+ </div>
220
+ </div>
221
+
222
+ <div id="method-M000071" class="method-detail">
223
+ <a name="M000071"></a>
224
+
225
+ <div class="method-heading">
226
+ <a href="#M000071" class="method-signature">
227
+ <span class="method-name">pull_dir</span><span class="method-args">(remote_path,local_path)</span>
228
+ </a>
229
+ </div>
230
+
231
+ <div class="method-description">
232
+ <p><a class="source-toggle" href="#"
233
+ onclick="toggleCode('M000071-source');return false;">[Source]</a></p>
234
+ <div class="method-source-code" id="M000071-source">
235
+ <pre>
236
+ <span class="ruby-comment cmt"># File lib/svengali/file_io.rb, line 61</span>
237
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pull_dir</span>(<span class="ruby-identifier">remote_path</span>,<span class="ruby-identifier">local_path</span>)
238
+ <span class="ruby-identifier">debug_p</span>(<span class="ruby-node">&quot;pull_dir from #{remote_path} to #{local_path}&quot;</span>)
239
+ <span class="ruby-keyword kw">begin</span>
240
+ <span class="ruby-ivar">@sftp_session</span>.<span class="ruby-identifier">download!</span>(<span class="ruby-identifier">remote_path</span>,<span class="ruby-identifier">local_path</span>,<span class="ruby-identifier">:recursive</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">true</span>)
241
+ <span class="ruby-keyword kw">rescue</span>
242
+ <span class="ruby-identifier">debug_p</span> <span class="ruby-identifier">remote_path</span> <span class="ruby-operator">+</span> <span class="ruby-value str">&quot; is not found on remote!!&quot;</span>
243
+ <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span>
244
+ <span class="ruby-keyword kw">end</span>
245
+ <span class="ruby-keyword kw">end</span>
246
+ </pre>
247
+ </div>
248
+ </div>
249
+ </div>
250
+
251
+ <div id="method-M000069" class="method-detail">
252
+ <a name="M000069"></a>
253
+
254
+ <div class="method-heading">
255
+ <a href="#M000069" class="method-signature">
256
+ <span class="method-name">pull_files</span><span class="method-args">(remote_path,local_path)</span>
257
+ </a>
258
+ </div>
259
+
260
+ <div class="method-description">
261
+ <p>
262
+ pull files on specified dir. only one level.
263
+ </p>
264
+ <p><a class="source-toggle" href="#"
265
+ onclick="toggleCode('M000069-source');return false;">[Source]</a></p>
266
+ <div class="method-source-code" id="M000069-source">
267
+ <pre>
268
+ <span class="ruby-comment cmt"># File lib/svengali/file_io.rb, line 38</span>
269
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pull_files</span>(<span class="ruby-identifier">remote_path</span>,<span class="ruby-identifier">local_path</span>)
270
+ <span class="ruby-identifier">debug_p</span>(<span class="ruby-node">&quot;pull_files from #{remote_path} to #{local_path}&quot;</span>)
271
+ <span class="ruby-ivar">@sftp_session</span>.<span class="ruby-identifier">dir</span>.<span class="ruby-identifier">foreach</span>(<span class="ruby-identifier">remote_path</span>){ <span class="ruby-operator">|</span><span class="ruby-identifier">path</span><span class="ruby-operator">|</span>
272
+ <span class="ruby-comment cmt">#unless path.name == &quot;.&quot; || path.name == &quot;..&quot;</span>
273
+ <span class="ruby-comment cmt">#not directory</span>
274
+ <span class="ruby-keyword kw">unless</span> <span class="ruby-regexp re">/^d/</span> <span class="ruby-operator">=~</span> <span class="ruby-identifier">path</span>.<span class="ruby-identifier">longname</span>
275
+ <span class="ruby-ivar">@sftp_session</span>.<span class="ruby-identifier">download!</span>(<span class="ruby-identifier">remote_path</span> <span class="ruby-operator">+</span> <span class="ruby-value str">&quot;/&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">path</span>.<span class="ruby-identifier">name</span>,<span class="ruby-identifier">local_path</span> <span class="ruby-operator">+</span> <span class="ruby-value str">&quot;/&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">path</span>.<span class="ruby-identifier">name</span>)
276
+ <span class="ruby-keyword kw">end</span>
277
+ <span class="ruby-comment cmt">#end</span>
278
+ }
279
+ <span class="ruby-keyword kw">end</span>
280
+ </pre>
281
+ </div>
282
+ </div>
283
+ </div>
284
+
285
+ <div id="method-M000066" class="method-detail">
286
+ <a name="M000066"></a>
287
+
288
+ <div class="method-heading">
289
+ <a href="#M000066" class="method-signature">
290
+ <span class="method-name">push_a_file</span><span class="method-args">(local_path,remote_path)</span>
291
+ </a>
292
+ </div>
293
+
294
+ <div class="method-description">
295
+ <p><a class="source-toggle" href="#"
296
+ onclick="toggleCode('M000066-source');return false;">[Source]</a></p>
297
+ <div class="method-source-code" id="M000066-source">
298
+ <pre>
299
+ <span class="ruby-comment cmt"># File lib/svengali/file_io.rb, line 9</span>
300
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">push_a_file</span>(<span class="ruby-identifier">local_path</span>,<span class="ruby-identifier">remote_path</span>)
301
+ <span class="ruby-identifier">debug_p</span>(<span class="ruby-node">&quot;push_a_file from #{local_path} to #{remote_path}&quot;</span>)
302
+ <span class="ruby-ivar">@sftp_session</span>.<span class="ruby-identifier">upload!</span>(<span class="ruby-identifier">local_path</span>,<span class="ruby-identifier">remote_path</span>)
303
+ <span class="ruby-keyword kw">end</span>
304
+ </pre>
305
+ </div>
306
+ </div>
307
+ </div>
308
+
309
+ <div id="method-M000070" class="method-detail">
310
+ <a name="M000070"></a>
311
+
312
+ <div class="method-heading">
313
+ <a href="#M000070" class="method-signature">
314
+ <span class="method-name">push_dir</span><span class="method-args">(local_path,remote_path)</span>
315
+ </a>
316
+ </div>
317
+
318
+ <div class="method-description">
319
+ <p>
320
+ Note: if there is a directory which has same name with <b>local_path</b>,
321
+ remote_directory is removed before coping directory
322
+ </p>
323
+ <p><a class="source-toggle" href="#"
324
+ onclick="toggleCode('M000070-source');return false;">[Source]</a></p>
325
+ <div class="method-source-code" id="M000070-source">
326
+ <pre>
327
+ <span class="ruby-comment cmt"># File lib/svengali/file_io.rb, line 51</span>
328
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">push_dir</span>(<span class="ruby-identifier">local_path</span>,<span class="ruby-identifier">remote_path</span>)
329
+ <span class="ruby-identifier">debug_p</span>(<span class="ruby-node">&quot;push_dir from #{local_path} to #{remote_path}&quot;</span>)
330
+ <span class="ruby-keyword kw">begin</span>
331
+ <span class="ruby-ivar">@sftp_session</span>.<span class="ruby-identifier">upload!</span>(<span class="ruby-identifier">local_path</span>,<span class="ruby-identifier">remote_path</span>)
332
+ <span class="ruby-keyword kw">rescue</span>
333
+ <span class="ruby-ivar">@ssh</span>.<span class="ruby-identifier">exec!</span>(<span class="ruby-node">&quot;rm -rf #{remote_path}&quot;</span>)
334
+ <span class="ruby-keyword kw">retry</span>
335
+ <span class="ruby-keyword kw">end</span>
336
+ <span class="ruby-keyword kw">end</span>
337
+ </pre>
338
+ </div>
339
+ </div>
340
+ </div>
341
+
342
+ <div id="method-M000068" class="method-detail">
343
+ <a name="M000068"></a>
344
+
345
+ <div class="method-heading">
346
+ <a href="#M000068" class="method-signature">
347
+ <span class="method-name">push_files</span><span class="method-args">(local_path,remote_path)</span>
348
+ </a>
349
+ </div>
350
+
351
+ <div class="method-description">
352
+ <p>
353
+ push files on specified dir. only one level. directories are not copied.
354
+ </p>
355
+ <p><a class="source-toggle" href="#"
356
+ onclick="toggleCode('M000068-source');return false;">[Source]</a></p>
357
+ <div class="method-source-code" id="M000068-source">
358
+ <pre>
359
+ <span class="ruby-comment cmt"># File lib/svengali/file_io.rb, line 27</span>
360
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">push_files</span>(<span class="ruby-identifier">local_path</span>,<span class="ruby-identifier">remote_path</span>)
361
+ <span class="ruby-identifier">debug_p</span>(<span class="ruby-node">&quot;push_files from #{local_path} to #{remote_path}&quot;</span>)
362
+ <span class="ruby-identifier">local_dir</span> = <span class="ruby-constant">Dir</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">local_path</span>)
363
+ <span class="ruby-identifier">local_dir</span>.<span class="ruby-identifier">each</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">path</span><span class="ruby-operator">|</span>
364
+ <span class="ruby-keyword kw">unless</span> <span class="ruby-constant">File</span><span class="ruby-operator">::</span><span class="ruby-identifier">ftype</span>(<span class="ruby-identifier">local_path</span> <span class="ruby-operator">+</span> <span class="ruby-value str">&quot;/&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">path</span>) <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;directory&quot;</span>
365
+ <span class="ruby-ivar">@sftp_session</span>.<span class="ruby-identifier">upload!</span>(<span class="ruby-identifier">local_path</span> <span class="ruby-operator">+</span> <span class="ruby-value str">&quot;/&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">path</span>,<span class="ruby-identifier">remote_path</span> <span class="ruby-operator">+</span> <span class="ruby-value str">&quot;/&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">path</span>)
366
+ <span class="ruby-keyword kw">end</span>
367
+ }
368
+ <span class="ruby-keyword kw">end</span>
369
+ </pre>
370
+ </div>
371
+ </div>
372
+ </div>
373
+
374
+ <div id="method-M000074" class="method-detail">
375
+ <a name="M000074"></a>
376
+
377
+ <div class="method-heading">
378
+ <a href="#M000074" class="method-signature">
379
+ <span class="method-name">write_contents_remote</span><span class="method-args">(remote_filepath_str,contents_str)</span>
380
+ </a>
381
+ </div>
382
+
383
+ <div class="method-description">
384
+ <p>
385
+ over writes contens from the start
386
+ </p>
387
+ <p><a class="source-toggle" href="#"
388
+ onclick="toggleCode('M000074-source');return false;">[Source]</a></p>
389
+ <div class="method-source-code" id="M000074-source">
390
+ <pre>
391
+ <span class="ruby-comment cmt"># File lib/svengali/file_io.rb, line 99</span>
392
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">write_contents_remote</span>(<span class="ruby-identifier">remote_filepath_str</span>,<span class="ruby-identifier">contents_str</span>)
393
+ <span class="ruby-identifier">debug_p</span>(<span class="ruby-node">&quot;write_contents_remote to #{remote_filepath_str}&quot;</span>)
394
+ <span class="ruby-identifier">handle</span> = <span class="ruby-ivar">@sftp_session</span>.<span class="ruby-identifier">open!</span>(<span class="ruby-identifier">remote_filepath_str</span>,<span class="ruby-value str">&quot;w&quot;</span>)
395
+ <span class="ruby-ivar">@sftp_session</span>.<span class="ruby-identifier">write!</span>(<span class="ruby-identifier">handle</span>, <span class="ruby-value">0</span>, <span class="ruby-identifier">contents_str</span>)
396
+ <span class="ruby-ivar">@sftp_session</span>.<span class="ruby-identifier">close!</span>(<span class="ruby-identifier">handle</span>)
397
+ <span class="ruby-keyword kw">end</span>
398
+ </pre>
399
+ </div>
400
+ </div>
401
+ </div>
402
+
403
+
404
+ </div>
405
+
406
+
407
+ </div>
408
+
409
+
410
+ <div id="validator-badges">
411
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
412
+ </div>
413
+
414
+ </body>
415
+ </html>