ratch 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/{log/history → CHANGES} +0 -0
- data/{log/todo → TODO} +0 -0
- data/bin/manifest +451 -0
- data/bin/ratch +3 -3
- data/demo/task/config.yaml +4 -0
- data/lib/ratch/{batch/argvutils.rb → dsl/argv.rb} +9 -4
- data/lib/ratch/dsl/batch.rb +226 -0
- data/lib/ratch/{batch → dsl}/build.rb +83 -4
- data/lib/ratch/{batch/consoleutils.rb → dsl/console.rb} +13 -5
- data/lib/ratch/{batch/emailutils.rb → dsl/email.rb} +21 -25
- data/lib/ratch/{batch/fileutils.rb → dsl/file.rb} +56 -56
- data/lib/ratch/dsl/meta.rb +132 -0
- data/lib/ratch/{batch → dsl}/options.rb +7 -5
- data/lib/ratch/dsl/setup.rb +124 -0
- data/lib/ratch/{support/signiture.rb → dsl/sign.rb} +9 -18
- data/lib/ratch/dsl/stage.rb +147 -0
- data/lib/ratch/dsl/task.rb +139 -0
- data/lib/ratch/{uploadutils.rb → dsl/upload.rb} +7 -5
- data/lib/ratch/{batch/task.rb → dsl/zip.rb} +30 -14
- data/lib/ratch/dsl.rb +52 -0
- data/lib/ratch/extra/email.rb +5 -0
- data/lib/ratch/extra/stage.rb +5 -0
- data/lib/ratch/extra/zip.rb +5 -0
- data/lib/ratch/manifest.rb +540 -0
- data/lib/ratch/{project → metadata}/information.rb +1 -0
- data/lib/ratch/{project → metadata}/package.rb +28 -2
- data/lib/ratch/{project → metadata}/project.rb +8 -16
- data/lib/ratch/{project → metadata}/release.rb +6 -6
- data/lib/ratch/support/errors.rb +4 -0
- data/lib/ratch/support/filename.rb +18 -0
- data/lib/ratch/toolset/ruby/compile +49 -0
- data/lib/ratch/toolset/ruby/pack/gem +26 -18
- data/lib/ratch/toolset/ruby/pack/tgz +25 -64
- data/lib/ratch/toolset/ruby/pack/zip +46 -0
- data/lib/ratch/toolset/ruby/publish +23 -24
- data/lib/ratch/toolset/ruby/release +8 -0
- data/lib/ratch/toolset/ruby/stamp +33 -0
- data/lib/ratch/toolset/sandbox +11 -0
- data/meta/MANIFEST +101 -23
- data/meta/ROLLRC +1 -1
- data/meta/config.yaml +10 -0
- data/meta/icli.yaml +2 -2
- data/meta/project.yaml +9 -10
- data/meta/xProjectInfo +41 -0
- data/task/release +1 -4
- metadata +82 -156
- data/demo/task/rdoc +0 -88
- data/demo/task/rdoc-old +0 -182
- data/doc/images/clipboard.jpg +0 -0
- data/doc/images/clipboard2.png +0 -0
- data/doc/images/milles-tn.jpg +0 -0
- data/doc/images/mints.png +0 -0
- data/doc/images/ratch2.png +0 -0
- data/doc/images/ruby-sm.png +0 -0
- data/doc/images/silver.gif +0 -0
- data/doc/images/toolbox.jpg +0 -0
- data/doc/index.html +0 -181
- data/doc/notes/original.rb +0 -308
- data/doc/rdoc/classes/Array.html +0 -194
- data/doc/rdoc/classes/Dir.html +0 -317
- data/doc/rdoc/classes/Hash.html +0 -217
- data/doc/rdoc/classes/Ratch/ArgvUtils/Ext.html +0 -285
- data/doc/rdoc/classes/Ratch/ArgvUtils.html +0 -173
- data/doc/rdoc/classes/Ratch/BatchFile.html +0 -207
- data/doc/rdoc/classes/Ratch/BatchManager.html +0 -250
- data/doc/rdoc/classes/Ratch/BatchScript.html +0 -127
- data/doc/rdoc/classes/Ratch/Batchable.html +0 -373
- data/doc/rdoc/classes/Ratch/Build.html +0 -321
- data/doc/rdoc/classes/Ratch/BuildManager.html +0 -319
- data/doc/rdoc/classes/Ratch/Buildable.html +0 -202
- data/doc/rdoc/classes/Ratch/ConfigUtils.html +0 -281
- data/doc/rdoc/classes/Ratch/ConsoleUtils.html +0 -189
- data/doc/rdoc/classes/Ratch/EmailUtils.html +0 -209
- data/doc/rdoc/classes/Ratch/FileUtils.html +0 -674
- data/doc/rdoc/classes/Ratch/GeneralOptions.html +0 -430
- data/doc/rdoc/classes/Ratch/Task.html +0 -201
- data/doc/rdoc/classes/Ratch/TaskManager.html +0 -330
- data/doc/rdoc/classes/Ratch/Taskable.html +0 -231
- data/doc/rdoc/classes/Ratch/UploadUtils.html +0 -566
- data/doc/rdoc/classes/Ratch.html +0 -201
- data/doc/rdoc/created.rid +0 -1
- data/doc/rdoc/files/COPYING.html +0 -1003
- data/doc/rdoc/files/README.html +0 -143
- data/doc/rdoc/files/lib/ratch/argvutils_rb.html +0 -131
- data/doc/rdoc/files/lib/ratch/batch_rb.html +0 -155
- data/doc/rdoc/files/lib/ratch/batchable_rb.html +0 -131
- data/doc/rdoc/files/lib/ratch/batchfile_rb.html +0 -148
- data/doc/rdoc/files/lib/ratch/buildable_rb.html +0 -131
- data/doc/rdoc/files/lib/ratch/consoleutils_rb.html +0 -131
- data/doc/rdoc/files/lib/ratch/emailutils_rb.html +0 -139
- data/doc/rdoc/files/lib/ratch/facets/multiglob_rb.html +0 -137
- data/doc/rdoc/files/lib/ratch/fileutils_rb.html +0 -139
- data/doc/rdoc/files/lib/ratch/options_rb.html +0 -131
- data/doc/rdoc/files/lib/ratch/taskable_rb.html +0 -131
- data/doc/rdoc/files/lib/ratch/uploadutils_rb.html +0 -150
- data/doc/rdoc/fr_class_index.html +0 -48
- data/doc/rdoc/fr_file_index.html +0 -41
- data/doc/rdoc/fr_method_index.html +0 -133
- data/doc/rdoc/index.html +0 -24
- data/doc/rdoc/rdoc-style.css +0 -208
- data/doc/scrap/flexihead-flip.jpg +0 -0
- data/doc/scrap/flexihead.jpg +0 -0
- data/doc/scrap/head1.jpg +0 -0
- data/doc/scrap/ratch.jpg +0 -0
- data/doc/scrap/ratch1.png +0 -0
- data/doc/scrap/ratch2.jpg +0 -0
- data/doc/scrap/ratch3.png +0 -0
- data/doc/scrap/red-ratch.jpg +0 -0
- data/doc/scrap/redratchet.jpg +0 -0
- data/doc/scrap/ruby-kit/ruby.png +0 -0
- data/doc/scrap/scrap.red +0 -256
- data/doc/sitemap.yaml +0 -10
- data/doc/siteparts/index.red +0 -100
- data/doc/siteparts/layout.rhtml +0 -56
- data/doc/siteparts/tutorial.red +0 -578
- data/doc/style.css +0 -112
- data/doc/tutorial.html +0 -722
- data/lib/ratch/batch.rb +0 -488
- data/lib/ratch/support/setuputils.rb +0 -124
- data/lib/ratch/support/stage.rb +0 -292
- data/lib/ratch/toolset/ruby/rdoc +0 -88
- data/task/rdoc +0 -6
- data/work/old/batchfile.rb +0 -95
- data/work/project-old.rb +0 -67
- data/work/scrap/install +0 -89
- data/work/scrap/install.0 +0 -49
- data/work/scrap/install.1 +0 -63
- data/work/scrap/ludo +0 -25
- data/work/scrap/oldtaskable.rb +0 -573
- data/work/scrap/ratch.man +0 -39
- data/work/scrap/taskable-simple.rb +0 -42
- data/work/scrap/taskable.rb +0 -120
@@ -1,566 +0,0 @@
|
|
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: Ratch::UploadUtils</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">Ratch::UploadUtils</td>
|
54
|
-
</tr>
|
55
|
-
<tr class="top-aligned-row">
|
56
|
-
<td><strong>In:</strong></td>
|
57
|
-
<td>
|
58
|
-
<a href="../../files/lib/ratch/uploadutils_rb.html">
|
59
|
-
lib/ratch/uploadutils.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
|
-
<div id="description">
|
76
|
-
<p>
|
77
|
-
Upload <a href="UploadUtils.html#M000063">files</a> to host. These means of
|
78
|
-
uploading are current supported: <a
|
79
|
-
href="UploadUtils.html#M000059">ftp</a>, <a
|
80
|
-
href="UploadUtils.html#M000060">sftp</a>, scp and <a
|
81
|
-
href="UploadUtils.html#M000061">rsync</a>.
|
82
|
-
</p>
|
83
|
-
<pre>
|
84
|
-
user Username for host.
|
85
|
-
host Host server's domain name.
|
86
|
-
root Document root path on host.
|
87
|
-
copy Directory of files to publish, or
|
88
|
-
Files to publish using from and to.
|
89
|
-
|
90
|
-
dryrun If true only pretend to upload.
|
91
|
-
quiet Supress all output.
|
92
|
-
verbose Provide extra details.
|
93
|
-
</pre>
|
94
|
-
<p>
|
95
|
-
The copy parameter allows you to simply specify a file or directory which
|
96
|
-
will be published to host‘s document root location.
|
97
|
-
</p>
|
98
|
-
<p>
|
99
|
-
If you need more control over which <a
|
100
|
-
href="UploadUtils.html#M000063">files</a> to publish where, you can use the
|
101
|
-
copy parameter instead. Provide an array of pattern strings in the form of
|
102
|
-
"{from} {to}". If the desitination is the host‘s document
|
103
|
-
root you do not need to specify the {to} part. For example:
|
104
|
-
</p>
|
105
|
-
<pre>
|
106
|
-
copy = [ 'web/*', 'doc/api/* doc/api' ]
|
107
|
-
</pre>
|
108
|
-
<p>
|
109
|
-
The first copies the <a href="UploadUtils.html#M000063">files</a> under
|
110
|
-
your project‘s web directory to the host‘s document root. The
|
111
|
-
second copies your projects doc/api <a
|
112
|
-
href="UploadUtils.html#M000063">files</a> to the doc/api location on the
|
113
|
-
host.
|
114
|
-
</p>
|
115
|
-
<p>
|
116
|
-
The internal template used for the outbound destination is
|
117
|
-
‘username@host:root/’.
|
118
|
-
</p>
|
119
|
-
|
120
|
-
</div>
|
121
|
-
|
122
|
-
|
123
|
-
</div>
|
124
|
-
|
125
|
-
<div id="method-list">
|
126
|
-
<h3 class="section-bar">Methods</h3>
|
127
|
-
|
128
|
-
<div class="name-list">
|
129
|
-
<a href="#M000063">files</a>
|
130
|
-
<a href="#M000059">ftp</a>
|
131
|
-
<a href="#M000061">rsync</a>
|
132
|
-
<a href="#M000060">sftp</a>
|
133
|
-
<a href="#M000065">stage_linkdir</a>
|
134
|
-
<a href="#M000064">stage_transfer</a>
|
135
|
-
<a href="#M000058">upload</a>
|
136
|
-
<a href="#M000062">upload_parameters</a>
|
137
|
-
</div>
|
138
|
-
</div>
|
139
|
-
|
140
|
-
</div>
|
141
|
-
|
142
|
-
|
143
|
-
<!-- if includes -->
|
144
|
-
|
145
|
-
<div id="section">
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
<!-- if method_list -->
|
155
|
-
<div id="methods">
|
156
|
-
<h3 class="section-bar">Public Instance methods</h3>
|
157
|
-
|
158
|
-
<div id="method-M000063" class="method-detail">
|
159
|
-
<a name="M000063"></a>
|
160
|
-
|
161
|
-
<div class="method-heading">
|
162
|
-
<a href="#M000063" class="method-signature">
|
163
|
-
<span class="method-name">files</span><span class="method-args">( dir, copy )</span>
|
164
|
-
</a>
|
165
|
-
</div>
|
166
|
-
|
167
|
-
<div class="method-description">
|
168
|
-
<p>
|
169
|
-
Put together the list of <a href="UploadUtils.html#M000063">files</a> to
|
170
|
-
copy.
|
171
|
-
</p>
|
172
|
-
<p><a class="source-toggle" href="#"
|
173
|
-
onclick="toggleCode('M000063-source');return false;">[Source]</a></p>
|
174
|
-
<div class="method-source-code" id="M000063-source">
|
175
|
-
<pre>
|
176
|
-
<span class="ruby-comment cmt"># File lib/ratch/uploadutils.rb, line 249</span>
|
177
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">files</span>( <span class="ruby-identifier">dir</span>, <span class="ruby-identifier">copy</span> )
|
178
|
-
<span class="ruby-constant">Dir</span>.<span class="ruby-identifier">chdir</span>(<span class="ruby-identifier">dir</span>) <span class="ruby-keyword kw">do</span>
|
179
|
-
<span class="ruby-identifier">del</span>, <span class="ruby-identifier">add</span> = <span class="ruby-identifier">copy</span>.<span class="ruby-identifier">partition</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span> <span class="ruby-regexp re">/^[-]/</span> <span class="ruby-operator">=~</span> <span class="ruby-identifier">f</span> }
|
180
|
-
|
181
|
-
<span class="ruby-comment cmt"># remove - and + prefixes</span>
|
182
|
-
<span class="ruby-identifier">del</span>.<span class="ruby-identifier">collect!</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span> <span class="ruby-identifier">f</span>.<span class="ruby-identifier">sub</span>(<span class="ruby-regexp re">/^[-]/</span>,<span class="ruby-value str">''</span>) }
|
183
|
-
<span class="ruby-identifier">add</span>.<span class="ruby-identifier">collect!</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span> <span class="ruby-identifier">f</span>.<span class="ruby-identifier">sub</span>(<span class="ruby-regexp re">/^[+]/</span>,<span class="ruby-value str">''</span>) }
|
184
|
-
|
185
|
-
<span class="ruby-comment cmt">#del.concat(must_exclude)</span>
|
186
|
-
|
187
|
-
<span class="ruby-identifier">files</span> = []
|
188
|
-
<span class="ruby-identifier">add</span>.<span class="ruby-identifier">each</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">g</span><span class="ruby-operator">|</span> <span class="ruby-identifier">files</span> <span class="ruby-operator">+=</span> <span class="ruby-constant">Dir</span>.<span class="ruby-identifier">multiglob</span>(<span class="ruby-identifier">g</span>) }
|
189
|
-
<span class="ruby-identifier">del</span>.<span class="ruby-identifier">each</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">g</span><span class="ruby-operator">|</span> <span class="ruby-identifier">files</span> <span class="ruby-operator">-=</span> <span class="ruby-constant">Dir</span>.<span class="ruby-identifier">multiglob</span>(<span class="ruby-identifier">g</span>) }
|
190
|
-
|
191
|
-
<span class="ruby-identifier">files</span>.<span class="ruby-identifier">collect!</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span> <span class="ruby-identifier">f</span>.<span class="ruby-identifier">sub</span>(<span class="ruby-regexp re">/^\//</span>,<span class="ruby-value str">''</span>) }
|
192
|
-
|
193
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">files</span>
|
194
|
-
<span class="ruby-keyword kw">end</span>
|
195
|
-
<span class="ruby-keyword kw">end</span>
|
196
|
-
</pre>
|
197
|
-
</div>
|
198
|
-
</div>
|
199
|
-
</div>
|
200
|
-
|
201
|
-
<div id="method-M000059" class="method-detail">
|
202
|
-
<a name="M000059"></a>
|
203
|
-
|
204
|
-
<div class="method-heading">
|
205
|
-
<a href="#M000059" class="method-signature">
|
206
|
-
<span class="method-name">ftp</span><span class="method-args">( keys )</span>
|
207
|
-
</a>
|
208
|
-
</div>
|
209
|
-
|
210
|
-
<div class="method-description">
|
211
|
-
<p>
|
212
|
-
Use <a href="UploadUtils.html#M000059">ftp</a> to <a
|
213
|
-
href="UploadUtils.html#M000058">upload</a> <a
|
214
|
-
href="UploadUtils.html#M000063">files</a>.
|
215
|
-
</p>
|
216
|
-
<p><a class="source-toggle" href="#"
|
217
|
-
onclick="toggleCode('M000059-source');return false;">[Source]</a></p>
|
218
|
-
<div class="method-source-code" id="M000059-source">
|
219
|
-
<pre>
|
220
|
-
<span class="ruby-comment cmt"># File lib/ratch/uploadutils.rb, line 85</span>
|
221
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">ftp</span>( <span class="ruby-identifier">keys</span> )
|
222
|
-
<span class="ruby-identifier">keys</span> = <span class="ruby-identifier">upload_parameters</span>(<span class="ruby-identifier">keys</span>)
|
223
|
-
|
224
|
-
<span class="ruby-comment cmt"># set transfer rules</span>
|
225
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">keys</span>.<span class="ruby-identifier">stage</span>
|
226
|
-
<span class="ruby-identifier">trans</span> = <span class="ruby-identifier">stage_transfer</span>(<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">stage</span>)
|
227
|
-
<span class="ruby-keyword kw">else</span>
|
228
|
-
<span class="ruby-identifier">files</span>(<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">dir</span>, <span class="ruby-identifier">keys</span>.<span class="ruby-identifier">copy</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">from</span><span class="ruby-operator">|</span>
|
229
|
-
<span class="ruby-identifier">trans</span> <span class="ruby-operator"><<</span> [<span class="ruby-identifier">from</span>,<span class="ruby-identifier">from</span>]
|
230
|
-
<span class="ruby-keyword kw">end</span>
|
231
|
-
<span class="ruby-keyword kw">end</span>
|
232
|
-
|
233
|
-
<span class="ruby-comment cmt"># append location of publication dir to from</span>
|
234
|
-
<span class="ruby-identifier">dir</span> = <span class="ruby-identifier">keys</span>.<span class="ruby-identifier">dir</span>
|
235
|
-
<span class="ruby-identifier">trans</span>.<span class="ruby-identifier">collect!</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">from</span>,<span class="ruby-identifier">to</span><span class="ruby-operator">|</span> [<span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">dir</span>,<span class="ruby-identifier">from</span>), <span class="ruby-identifier">to</span>] }
|
236
|
-
|
237
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">keys</span>.<span class="ruby-identifier">dryrun</span>
|
238
|
-
<span class="ruby-identifier">puts</span> <span class="ruby-node">"ftp open #{keys.user}@#{keys.host}:#{keys.root}/"</span>
|
239
|
-
<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">trans</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">f</span>, <span class="ruby-identifier">t</span><span class="ruby-operator">|</span>
|
240
|
-
<span class="ruby-identifier">puts</span> <span class="ruby-node">"ftp put #{f} #{t}"</span>
|
241
|
-
<span class="ruby-keyword kw">end</span>
|
242
|
-
<span class="ruby-keyword kw">else</span>
|
243
|
-
<span class="ruby-identifier">require</span> <span class="ruby-value str">'net/ftp'</span>
|
244
|
-
<span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">FTP</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">host</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">ftp</span><span class="ruby-operator">|</span>
|
245
|
-
<span class="ruby-identifier">ftp</span>.<span class="ruby-identifier">login</span>(<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">user</span>) <span class="ruby-comment cmt">#password?</span>
|
246
|
-
<span class="ruby-identifier">ftp</span>.<span class="ruby-identifier">chdir</span>(<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">root</span>)
|
247
|
-
<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">trans</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">f</span>, <span class="ruby-identifier">t</span><span class="ruby-operator">|</span>
|
248
|
-
<span class="ruby-identifier">puts</span> <span class="ruby-node">"ftp #{f} #{t}"</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">keys</span>.<span class="ruby-identifier">quiet</span>
|
249
|
-
<span class="ruby-identifier">ftp</span>.<span class="ruby-identifier">putbinaryfile</span>( <span class="ruby-identifier">f</span>, <span class="ruby-identifier">t</span>, <span class="ruby-value">1024</span> )
|
250
|
-
<span class="ruby-keyword kw">end</span>
|
251
|
-
<span class="ruby-keyword kw">end</span>
|
252
|
-
<span class="ruby-keyword kw">end</span>
|
253
|
-
<span class="ruby-keyword kw">end</span>
|
254
|
-
</pre>
|
255
|
-
</div>
|
256
|
-
</div>
|
257
|
-
</div>
|
258
|
-
|
259
|
-
<div id="method-M000061" class="method-detail">
|
260
|
-
<a name="M000061"></a>
|
261
|
-
|
262
|
-
<div class="method-heading">
|
263
|
-
<a href="#M000061" class="method-signature">
|
264
|
-
<span class="method-name">rsync</span><span class="method-args">( keys )</span>
|
265
|
-
</a>
|
266
|
-
</div>
|
267
|
-
|
268
|
-
<div class="method-description">
|
269
|
-
<p>
|
270
|
-
Use <a href="UploadUtils.html#M000061">rsync</a> to <a
|
271
|
-
href="UploadUtils.html#M000058">upload</a> <a
|
272
|
-
href="UploadUtils.html#M000063">files</a>.
|
273
|
-
</p>
|
274
|
-
<p><a class="source-toggle" href="#"
|
275
|
-
onclick="toggleCode('M000061-source');return false;">[Source]</a></p>
|
276
|
-
<div class="method-source-code" id="M000061-source">
|
277
|
-
<pre>
|
278
|
-
<span class="ruby-comment cmt"># File lib/ratch/uploadutils.rb, line 161</span>
|
279
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">rsync</span>( <span class="ruby-identifier">keys</span> )
|
280
|
-
<span class="ruby-identifier">keys</span> = <span class="ruby-identifier">upload_parameters</span>(<span class="ruby-identifier">keys</span>)
|
281
|
-
|
282
|
-
<span class="ruby-identifier">flags</span> = []
|
283
|
-
<span class="ruby-identifier">flags</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">"-n"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">keys</span>.<span class="ruby-identifier">dryrun</span>
|
284
|
-
<span class="ruby-identifier">flags</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">"-q"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">keys</span>.<span class="ruby-identifier">quiet</span>
|
285
|
-
<span class="ruby-identifier">flags</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">"-v"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">keys</span>.<span class="ruby-identifier">verbose</span>
|
286
|
-
<span class="ruby-identifier">flags</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">"--progress"</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">keys</span>.<span class="ruby-identifier">quiet</span>
|
287
|
-
<span class="ruby-identifier">flags</span> = <span class="ruby-identifier">flags</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">' '</span>).<span class="ruby-identifier">strip</span>
|
288
|
-
<span class="ruby-identifier">flags</span> = <span class="ruby-value str">' '</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">flags</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">flags</span>.<span class="ruby-identifier">empty?</span>
|
289
|
-
|
290
|
-
<span class="ruby-identifier">manfile</span> = <span class="ruby-value str">'Publish.txt'</span>
|
291
|
-
|
292
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">keys</span>.<span class="ruby-identifier">stage</span>
|
293
|
-
<span class="ruby-identifier">dir</span> = <span class="ruby-identifier">stage_linkdir</span>(<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">dir</span>, <span class="ruby-identifier">keys</span>.<span class="ruby-identifier">stage</span>)
|
294
|
-
<span class="ruby-constant">Dir</span>.<span class="ruby-identifier">chdir</span>(<span class="ruby-identifier">dir</span>) <span class="ruby-keyword kw">do</span>
|
295
|
-
<span class="ruby-identifier">cpy</span> = <span class="ruby-identifier">files</span>(<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">copy</span>)
|
296
|
-
<span class="ruby-keyword kw">end</span>
|
297
|
-
<span class="ruby-identifier">manifest</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">dir</span>,<span class="ruby-identifier">manfile</span>)
|
298
|
-
<span class="ruby-identifier">cmd</span> = <span class="ruby-node">%{rsync#{flags} -L -arz --files-from='#{manifest}' #{dir} #{keys.user}@#{keys.host}:/#{keys.root}}</span>
|
299
|
-
<span class="ruby-keyword kw">else</span>
|
300
|
-
<span class="ruby-identifier">dir</span> = <span class="ruby-identifier">keys</span>.<span class="ruby-identifier">dir</span>
|
301
|
-
<span class="ruby-identifier">cpy</span> = <span class="ruby-identifier">files</span>(<span class="ruby-identifier">dir</span>, <span class="ruby-identifier">keys</span>.<span class="ruby-identifier">copy</span>)
|
302
|
-
<span class="ruby-identifier">manifest</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">dir</span>,<span class="ruby-identifier">manfile</span>)
|
303
|
-
<span class="ruby-identifier">cmd</span> = <span class="ruby-node">%{rsync#{flags} -arz --files-from='#{manifest}' #{dir} #{keys.user}@#{keys.host}:/#{keys.root}}</span>
|
304
|
-
<span class="ruby-keyword kw">end</span>
|
305
|
-
|
306
|
-
<span class="ruby-comment cmt">#Dir.chdir(keys.dir) do</span>
|
307
|
-
<span class="ruby-keyword kw">begin</span>
|
308
|
-
<span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">manifest</span>, <span class="ruby-value str">'w'</span>){ <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span> <span class="ruby-identifier">f</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">cpy</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">"\n"</span>) }
|
309
|
-
<span class="ruby-constant">ENV</span>[<span class="ruby-value str">'RSYNC_PASSWORD'</span>] = <span class="ruby-identifier">keys</span>.<span class="ruby-identifier">pass</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">keys</span>.<span class="ruby-identifier">pass</span>
|
310
|
-
<span class="ruby-identifier">puts</span> <span class="ruby-identifier">cmd</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">keys</span>.<span class="ruby-identifier">quiet</span>
|
311
|
-
<span class="ruby-identifier">system</span> <span class="ruby-identifier">cmd</span>
|
312
|
-
<span class="ruby-keyword kw">ensure</span>
|
313
|
-
<span class="ruby-constant">ENV</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value str">'RSYNC_PASSWORD'</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">keys</span>.<span class="ruby-identifier">pass</span>
|
314
|
-
<span class="ruby-keyword kw">end</span>
|
315
|
-
<span class="ruby-comment cmt">#end</span>
|
316
|
-
|
317
|
-
<span class="ruby-keyword kw">end</span>
|
318
|
-
</pre>
|
319
|
-
</div>
|
320
|
-
</div>
|
321
|
-
</div>
|
322
|
-
|
323
|
-
<div id="method-M000060" class="method-detail">
|
324
|
-
<a name="M000060"></a>
|
325
|
-
|
326
|
-
<div class="method-heading">
|
327
|
-
<a href="#M000060" class="method-signature">
|
328
|
-
<span class="method-name">sftp</span><span class="method-args">( keys )</span>
|
329
|
-
</a>
|
330
|
-
</div>
|
331
|
-
|
332
|
-
<div class="method-description">
|
333
|
-
<p>
|
334
|
-
Use <a href="UploadUtils.html#M000060">sftp</a> to <a
|
335
|
-
href="UploadUtils.html#M000058">upload</a> <a
|
336
|
-
href="UploadUtils.html#M000063">files</a>.
|
337
|
-
</p>
|
338
|
-
<p><a class="source-toggle" href="#"
|
339
|
-
onclick="toggleCode('M000060-source');return false;">[Source]</a></p>
|
340
|
-
<div class="method-source-code" id="M000060-source">
|
341
|
-
<pre>
|
342
|
-
<span class="ruby-comment cmt"># File lib/ratch/uploadutils.rb, line 123</span>
|
343
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sftp</span>( <span class="ruby-identifier">keys</span> )
|
344
|
-
<span class="ruby-identifier">keys</span> = <span class="ruby-identifier">upload_parameters</span>(<span class="ruby-identifier">keys</span>)
|
345
|
-
|
346
|
-
<span class="ruby-comment cmt"># set transfer rules</span>
|
347
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">keys</span>.<span class="ruby-identifier">stage</span>
|
348
|
-
<span class="ruby-identifier">trans</span> = <span class="ruby-identifier">stage_transfer</span>(<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">stage</span>)
|
349
|
-
<span class="ruby-keyword kw">else</span>
|
350
|
-
<span class="ruby-identifier">files</span>(<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">dir</span>, <span class="ruby-identifier">keys</span>.<span class="ruby-identifier">copy</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">from</span><span class="ruby-operator">|</span>
|
351
|
-
<span class="ruby-identifier">trans</span> <span class="ruby-operator"><<</span> [<span class="ruby-identifier">from</span>,<span class="ruby-identifier">from</span>]
|
352
|
-
<span class="ruby-keyword kw">end</span>
|
353
|
-
<span class="ruby-keyword kw">end</span>
|
354
|
-
|
355
|
-
<span class="ruby-comment cmt"># append location of publication dir to from</span>
|
356
|
-
<span class="ruby-identifier">dir</span> = <span class="ruby-identifier">keys</span>.<span class="ruby-identifier">dir</span>
|
357
|
-
<span class="ruby-identifier">trans</span>.<span class="ruby-identifier">collect!</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">from</span>,<span class="ruby-identifier">to</span><span class="ruby-operator">|</span> [<span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">dir</span>,<span class="ruby-identifier">from</span>), <span class="ruby-identifier">to</span>] }
|
358
|
-
|
359
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">keys</span>.<span class="ruby-identifier">dryrun</span>
|
360
|
-
<span class="ruby-identifier">puts</span> <span class="ruby-node">"sftp open #{keys.user}@#{keys.host}:#{keys.root}/"</span>
|
361
|
-
<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">trans</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">f</span>,<span class="ruby-identifier">t</span><span class="ruby-operator">|</span>
|
362
|
-
<span class="ruby-identifier">puts</span> <span class="ruby-node">"sftp put #{f} #{t}"</span>
|
363
|
-
<span class="ruby-keyword kw">end</span>
|
364
|
-
<span class="ruby-keyword kw">else</span>
|
365
|
-
<span class="ruby-identifier">require</span> <span class="ruby-value str">'net/sftp'</span>
|
366
|
-
<span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">SFTP</span>.<span class="ruby-identifier">start</span>(<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">host</span>, <span class="ruby-identifier">keys</span>.<span class="ruby-identifier">user</span>, <span class="ruby-identifier">keys</span>.<span class="ruby-identifier">pass</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">sftp</span><span class="ruby-operator">|</span>
|
367
|
-
<span class="ruby-comment cmt">#sftp.login( user )</span>
|
368
|
-
<span class="ruby-identifier">sftp</span>.<span class="ruby-identifier">chdir</span>(<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">root</span>)
|
369
|
-
<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">trans</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">f</span>,<span class="ruby-identifier">t</span><span class="ruby-operator">|</span>
|
370
|
-
<span class="ruby-identifier">puts</span> <span class="ruby-node">"sftp #{f} #{t}"</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">keys</span>.<span class="ruby-identifier">quiet</span>
|
371
|
-
<span class="ruby-identifier">sftp</span>.<span class="ruby-identifier">put_file</span>(<span class="ruby-identifier">f</span>,<span class="ruby-identifier">t</span>) <span class="ruby-comment cmt">#, 1024 )</span>
|
372
|
-
<span class="ruby-keyword kw">end</span>
|
373
|
-
<span class="ruby-keyword kw">end</span>
|
374
|
-
<span class="ruby-keyword kw">end</span>
|
375
|
-
<span class="ruby-keyword kw">end</span>
|
376
|
-
</pre>
|
377
|
-
</div>
|
378
|
-
</div>
|
379
|
-
</div>
|
380
|
-
|
381
|
-
<div id="method-M000065" class="method-detail">
|
382
|
-
<a name="M000065"></a>
|
383
|
-
|
384
|
-
<div class="method-heading">
|
385
|
-
<a href="#M000065" class="method-signature">
|
386
|
-
<span class="method-name">stage_linkdir</span><span class="method-args">( dir, list )</span>
|
387
|
-
</a>
|
388
|
-
</div>
|
389
|
-
|
390
|
-
<div class="method-description">
|
391
|
-
<p>
|
392
|
-
When using stage options this will create temporary linked location.
|
393
|
-
</p>
|
394
|
-
<p><a class="source-toggle" href="#"
|
395
|
-
onclick="toggleCode('M000065-source');return false;">[Source]</a></p>
|
396
|
-
<div class="method-source-code" id="M000065-source">
|
397
|
-
<pre>
|
398
|
-
<span class="ruby-comment cmt"># File lib/ratch/uploadutils.rb, line 295</span>
|
399
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">stage_linkdir</span>( <span class="ruby-identifier">dir</span>, <span class="ruby-identifier">list</span> )
|
400
|
-
<span class="ruby-identifier">folder</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">Dir</span>.<span class="ruby-identifier">tmpdir</span>, <span class="ruby-value str">'ratchets'</span>, <span class="ruby-value str">'project'</span>, <span class="ruby-identifier">object_id</span>.<span class="ruby-identifier">abs</span>.<span class="ruby-identifier">to_s</span>)
|
401
|
-
<span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">mkdir_p</span>(<span class="ruby-identifier">folder</span>)
|
402
|
-
|
403
|
-
<span class="ruby-constant">Dir</span>.<span class="ruby-identifier">chdir</span>(<span class="ruby-identifier">dir</span>) <span class="ruby-keyword kw">do</span>
|
404
|
-
<span class="ruby-identifier">stage_transfer</span>(<span class="ruby-identifier">list</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">file</span>, <span class="ruby-identifier">to</span><span class="ruby-operator">|</span>
|
405
|
-
<span class="ruby-identifier">link</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">folder</span>,<span class="ruby-identifier">to</span>)
|
406
|
-
<span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">ln_s</span>(<span class="ruby-identifier">link</span>,<span class="ruby-identifier">file</span>)
|
407
|
-
<span class="ruby-keyword kw">end</span>
|
408
|
-
<span class="ruby-keyword kw">end</span>
|
409
|
-
|
410
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">folder</span>
|
411
|
-
<span class="ruby-keyword kw">end</span>
|
412
|
-
</pre>
|
413
|
-
</div>
|
414
|
-
</div>
|
415
|
-
</div>
|
416
|
-
|
417
|
-
<div id="method-M000064" class="method-detail">
|
418
|
-
<a name="M000064"></a>
|
419
|
-
|
420
|
-
<div class="method-heading">
|
421
|
-
<a href="#M000064" class="method-signature">
|
422
|
-
<span class="method-name">stage_transfer</span><span class="method-args">( list )</span>
|
423
|
-
</a>
|
424
|
-
</div>
|
425
|
-
|
426
|
-
<div class="method-description">
|
427
|
-
<p>
|
428
|
-
Combine three part stage list into a two part from->to list.
|
429
|
-
</p>
|
430
|
-
<p>
|
431
|
-
Using the stage list of three space separated fields.
|
432
|
-
</p>
|
433
|
-
<pre>
|
434
|
-
fromdir file todir
|
435
|
-
</pre>
|
436
|
-
<p>
|
437
|
-
This is used to generate a from -> to list of the form:
|
438
|
-
</p>
|
439
|
-
<pre>
|
440
|
-
fromdir/file todir/file
|
441
|
-
</pre>
|
442
|
-
<p><a class="source-toggle" href="#"
|
443
|
-
onclick="toggleCode('M000064-source');return false;">[Source]</a></p>
|
444
|
-
<div class="method-source-code" id="M000064-source">
|
445
|
-
<pre>
|
446
|
-
<span class="ruby-comment cmt"># File lib/ratch/uploadutils.rb, line 280</span>
|
447
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">stage_transfer</span>( <span class="ruby-identifier">list</span> )
|
448
|
-
<span class="ruby-identifier">trans</span> = []
|
449
|
-
<span class="ruby-identifier">list</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">line</span><span class="ruby-operator">|</span>
|
450
|
-
<span class="ruby-identifier">trans</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">Shellwords</span>.<span class="ruby-identifier">shellwords</span>(<span class="ruby-identifier">line</span>)
|
451
|
-
<span class="ruby-keyword kw">end</span>
|
452
|
-
|
453
|
-
<span class="ruby-identifier">trans</span>.<span class="ruby-identifier">collect!</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">from</span>, <span class="ruby-identifier">base</span>, <span class="ruby-identifier">to</span><span class="ruby-operator">|</span>
|
454
|
-
<span class="ruby-identifier">file</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">from</span>,<span class="ruby-identifier">base</span>)
|
455
|
-
<span class="ruby-identifier">to</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">to</span>,<span class="ruby-identifier">base</span>)
|
456
|
-
[<span class="ruby-identifier">from</span>, <span class="ruby-identifier">to</span>]
|
457
|
-
<span class="ruby-keyword kw">end</span>
|
458
|
-
<span class="ruby-keyword kw">end</span>
|
459
|
-
</pre>
|
460
|
-
</div>
|
461
|
-
</div>
|
462
|
-
</div>
|
463
|
-
|
464
|
-
<div id="method-M000058" class="method-detail">
|
465
|
-
<a name="M000058"></a>
|
466
|
-
|
467
|
-
<div class="method-heading">
|
468
|
-
<a href="#M000058" class="method-signature">
|
469
|
-
<span class="method-name">upload</span><span class="method-args">( protocol, opts )</span>
|
470
|
-
</a>
|
471
|
-
</div>
|
472
|
-
|
473
|
-
<div class="method-description">
|
474
|
-
<p>
|
475
|
-
Upload via given protocol.
|
476
|
-
</p>
|
477
|
-
<p><a class="source-toggle" href="#"
|
478
|
-
onclick="toggleCode('M000058-source');return false;">[Source]</a></p>
|
479
|
-
<div class="method-source-code" id="M000058-source">
|
480
|
-
<pre>
|
481
|
-
<span class="ruby-comment cmt"># File lib/ratch/uploadutils.rb, line 77</span>
|
482
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">upload</span>( <span class="ruby-identifier">protocol</span>, <span class="ruby-identifier">opts</span> )
|
483
|
-
<span class="ruby-identifier">send</span>(<span class="ruby-identifier">protocol</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">downcase</span>,<span class="ruby-identifier">opts</span>)
|
484
|
-
<span class="ruby-keyword kw">end</span>
|
485
|
-
</pre>
|
486
|
-
</div>
|
487
|
-
</div>
|
488
|
-
</div>
|
489
|
-
|
490
|
-
<div id="method-M000062" class="method-detail">
|
491
|
-
<a name="M000062"></a>
|
492
|
-
|
493
|
-
<div class="method-heading">
|
494
|
-
<a href="#M000062" class="method-signature">
|
495
|
-
<span class="method-name">upload_parameters</span><span class="method-args">( keys )</span>
|
496
|
-
</a>
|
497
|
-
</div>
|
498
|
-
|
499
|
-
<div class="method-description">
|
500
|
-
<p>
|
501
|
-
parse publishing options.
|
502
|
-
</p>
|
503
|
-
<p><a class="source-toggle" href="#"
|
504
|
-
onclick="toggleCode('M000062-source');return false;">[Source]</a></p>
|
505
|
-
<div class="method-source-code" id="M000062-source">
|
506
|
-
<pre>
|
507
|
-
<span class="ruby-comment cmt"># File lib/ratch/uploadutils.rb, line 205</span>
|
508
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">upload_parameters</span>( <span class="ruby-identifier">keys</span> )
|
509
|
-
<span class="ruby-identifier">keys</span> = <span class="ruby-constant">OpenObject</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">keys</span>)
|
510
|
-
|
511
|
-
<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">copy</span> = <span class="ruby-identifier">keys</span>.<span class="ruby-identifier">copy</span> <span class="ruby-operator">||</span> <span class="ruby-value str">'**/*'</span>
|
512
|
-
<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">host</span> = <span class="ruby-identifier">keys</span>.<span class="ruby-identifier">host</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">keys</span>.<span class="ruby-identifier">domain</span>
|
513
|
-
<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">user</span> = <span class="ruby-identifier">keys</span>.<span class="ruby-identifier">user</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">keys</span>.<span class="ruby-identifier">username</span>
|
514
|
-
<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">root</span> = <span class="ruby-identifier">keys</span>.<span class="ruby-identifier">root</span> <span class="ruby-operator">||</span> <span class="ruby-value str">'/'</span>
|
515
|
-
<span class="ruby-comment cmt">#keys.pass = keys.pass || keys.password</span>
|
516
|
-
|
517
|
-
<span class="ruby-comment cmt"># validate</span>
|
518
|
-
<span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">"missing publish parameter -- dir"</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">keys</span>.<span class="ruby-identifier">dir</span>
|
519
|
-
<span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">"missing publish parameter -- host"</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">keys</span>.<span class="ruby-identifier">host</span>
|
520
|
-
<span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">"missing publish parameter -- user"</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">keys</span>.<span class="ruby-identifier">user</span>
|
521
|
-
<span class="ruby-comment cmt">#raise ArgumentError, "missing publish parameter -- copy" unless keys.copy</span>
|
522
|
-
<span class="ruby-comment cmt">#raise ArgumentError, "missing publish parameter -- root" unless keys.root</span>
|
523
|
-
|
524
|
-
<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">root</span> = <span class="ruby-value str">''</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">keys</span>.<span class="ruby-identifier">root</span>.<span class="ruby-identifier">nil?</span>
|
525
|
-
<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">root</span>.<span class="ruby-identifier">sub!</span>(<span class="ruby-regexp re">/^\//</span>,<span class="ruby-value str">''</span>)
|
526
|
-
|
527
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-constant">String</span><span class="ruby-operator">===</span><span class="ruby-identifier">keys</span>.<span class="ruby-identifier">copy</span> <span class="ruby-keyword kw">and</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">directory?</span>(<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">copy</span>)
|
528
|
-
<span class="ruby-identifier">copy</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">copy</span>, <span class="ruby-value str">'*'</span>)
|
529
|
-
<span class="ruby-keyword kw">end</span>
|
530
|
-
<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">copy</span> = [<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">copy</span>].<span class="ruby-identifier">flatten</span>.<span class="ruby-identifier">compact</span>
|
531
|
-
|
532
|
-
<span class="ruby-comment cmt"># trans = []</span>
|
533
|
-
<span class="ruby-comment cmt"># keys.copy.each do |from|</span>
|
534
|
-
<span class="ruby-comment cmt"># #from, to = *Shellwords.shellwords(c)</span>
|
535
|
-
<span class="ruby-comment cmt"># #to = from if to.nil?</span>
|
536
|
-
<span class="ruby-comment cmt"># #to = to[1..-1] if to[0,1] == '/'</span>
|
537
|
-
<span class="ruby-comment cmt"># from.sub('*','**/*') unless from =~ /\*\*/</span>
|
538
|
-
<span class="ruby-comment cmt"># files = Dir.glob(from)</span>
|
539
|
-
<span class="ruby-comment cmt"># files.each do |f|</span>
|
540
|
-
<span class="ruby-comment cmt"># #t = File.join(to,File.basename(f))</span>
|
541
|
-
<span class="ruby-comment cmt"># #t = t[1..-1] if t[0,1] == '/'</span>
|
542
|
-
<span class="ruby-comment cmt"># trans << [f,f]</span>
|
543
|
-
<span class="ruby-comment cmt"># end</span>
|
544
|
-
<span class="ruby-comment cmt"># end</span>
|
545
|
-
<span class="ruby-comment cmt"># keys.trans = trans</span>
|
546
|
-
|
547
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">keys</span>
|
548
|
-
<span class="ruby-keyword kw">end</span>
|
549
|
-
</pre>
|
550
|
-
</div>
|
551
|
-
</div>
|
552
|
-
</div>
|
553
|
-
|
554
|
-
|
555
|
-
</div>
|
556
|
-
|
557
|
-
|
558
|
-
</div>
|
559
|
-
|
560
|
-
|
561
|
-
<div id="validator-badges">
|
562
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
563
|
-
</div>
|
564
|
-
|
565
|
-
</body>
|
566
|
-
</html>
|