sprout 1.1.15.pre → 1.1.16.pre
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of sprout might be problematic. Click here for more details.
- data/VERSION +1 -1
- data/lib/sprout/executable/base.rb +7 -7
- metadata +101 -252
- data/Gemfile.lock +0 -50
- data/doc/Dir.html +0 -288
- data/doc/Rake/Task.html +0 -184
- data/doc/Sprout.html +0 -740
- data/doc/Sprout/ArchiveUnpacker.html +0 -1246
- data/doc/Sprout/CommandLine.html +0 -520
- data/doc/Sprout/Concern.html +0 -351
- data/doc/Sprout/Errors.html +0 -101
- data/doc/Sprout/Errors/ArchiveUnpackerError.html +0 -125
- data/doc/Sprout/Errors/DestinationExistsError.html +0 -133
- data/doc/Sprout/Errors/DuplicateMemberError.html +0 -132
- data/doc/Sprout/Errors/ExecutableError.html +0 -125
- data/doc/Sprout/Errors/ExecutableRegistrationError.html +0 -132
- data/doc/Sprout/Errors/ExecutionError.html +0 -121
- data/doc/Sprout/Errors/GeneratorError.html +0 -125
- data/doc/Sprout/Errors/InvalidArgumentError.html +0 -132
- data/doc/Sprout/Errors/LoadError.html +0 -121
- data/doc/Sprout/Errors/MissingArgumentError.html +0 -132
- data/doc/Sprout/Errors/MissingExecutableError.html +0 -132
- data/doc/Sprout/Errors/MissingGeneratorError.html +0 -132
- data/doc/Sprout/Errors/MissingTemplateError.html +0 -132
- data/doc/Sprout/Errors/ProcessRunnerError.html +0 -121
- data/doc/Sprout/Errors/RemoteFileLoaderError.html +0 -110
- data/doc/Sprout/Errors/SproutError.html +0 -114
- data/doc/Sprout/Errors/UnknownArchiveType.html +0 -122
- data/doc/Sprout/Errors/UsageError.html +0 -121
- data/doc/Sprout/Errors/ValidationError.html +0 -121
- data/doc/Sprout/Errors/VersionRequirementNotMetError.html +0 -121
- data/doc/Sprout/Executable.html +0 -169
- data/doc/Sprout/Executable/Base.html +0 -2813
- data/doc/Sprout/Executable/Boolean.html +0 -534
- data/doc/Sprout/Executable/CollectionParam.html +0 -483
- data/doc/Sprout/Executable/FileParam.html +0 -484
- data/doc/Sprout/Executable/Files.html +0 -292
- data/doc/Sprout/Executable/Number.html +0 -141
- data/doc/Sprout/Executable/Param.html +0 -2874
- data/doc/Sprout/Executable/ParameterFactory.html +0 -232
- data/doc/Sprout/Executable/Path.html +0 -223
- data/doc/Sprout/Executable/Paths.html +0 -253
- data/doc/Sprout/Executable/Session.html +0 -1513
- data/doc/Sprout/Executable/StringParam.html +0 -213
- data/doc/Sprout/Executable/Strings.html +0 -167
- data/doc/Sprout/Executable/Url.html +0 -160
- data/doc/Sprout/Executable/Urls.html +0 -170
- data/doc/Sprout/FileTarget.html +0 -1109
- data/doc/Sprout/Generator.html +0 -750
- data/doc/Sprout/Generator/Base.html +0 -1902
- data/doc/Sprout/Generator/Command.html +0 -690
- data/doc/Sprout/Generator/DirectoryManifest.html +0 -476
- data/doc/Sprout/Generator/FileManifest.html +0 -643
- data/doc/Sprout/Generator/Manifest.html +0 -377
- data/doc/Sprout/Generator/TemplateManifest.html +0 -194
- data/doc/Sprout/GeneratorGenerator.html +0 -1115
- data/doc/Sprout/Library.html +0 -1146
- data/doc/Sprout/LibraryGenerator.html +0 -331
- data/doc/Sprout/OutputBuffer.html +0 -445
- data/doc/Sprout/Platform.html +0 -714
- data/doc/Sprout/ProcessRunner.html +0 -1707
- data/doc/Sprout/ProgressBar.html +0 -366
- data/doc/Sprout/ProgressBarImpl.html +0 -2109
- data/doc/Sprout/ProgressBarManager.html +0 -424
- data/doc/Sprout/ProgressBarOutputStream.html +0 -406
- data/doc/Sprout/RDocParser.html +0 -211
- data/doc/Sprout/RemoteFileLoader.html +0 -172
- data/doc/Sprout/RemoteFileTarget.html +0 -679
- data/doc/Sprout/ReversedProgressBar.html +0 -184
- data/doc/Sprout/RubyFeature.html +0 -155
- data/doc/Sprout/RubyFeature/ClassMethods.html +0 -1065
- data/doc/Sprout/RubyGenerator.html +0 -786
- data/doc/Sprout/Specification.html +0 -767
- data/doc/Sprout/System.html +0 -191
- data/doc/Sprout/System/BaseSystem.html +0 -1660
- data/doc/Sprout/System/JavaSystem.html +0 -122
- data/doc/Sprout/System/OSXSystem.html +0 -335
- data/doc/Sprout/System/ThreadMock.html +0 -183
- data/doc/Sprout/System/UnixSystem.html +0 -584
- data/doc/Sprout/System/VistaSystem.html +0 -251
- data/doc/Sprout/System/WinNixSystem.html +0 -325
- data/doc/Sprout/System/WinSystem.html +0 -571
- data/doc/Sprout/TestHelper.html +0 -2165
- data/doc/Sprout/ToolGenerator.html +0 -953
- data/doc/Sprout/VERSION.html +0 -118
- data/doc/String.html +0 -290
- data/doc/_index.html +0 -820
- data/doc/class_list.html +0 -36
- data/doc/css/common.css +0 -1
- data/doc/css/full_list.css +0 -53
- data/doc/css/style.css +0 -310
- data/doc/file.README.html +0 -96
- data/doc/file_list.html +0 -41
- data/doc/frames.html +0 -13
- data/doc/index.html +0 -96
- data/doc/js/app.js +0 -202
- data/doc/js/full_list.js +0 -149
- data/doc/js/jquery.js +0 -154
- data/doc/method_list.html +0 -3603
- data/doc/top-level-namespace.html +0 -192
- data/test/fixtures/library/archive/Archive.swc +0 -0
@@ -1,1246 +0,0 @@
|
|
1
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
-
<head>
|
5
|
-
<meta name="Content-Type" content="text/html; charset=utf-8" />
|
6
|
-
<title>Class: Sprout::ArchiveUnpacker</title>
|
7
|
-
<link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" charset="utf-8" />
|
8
|
-
<link rel="stylesheet" href="../css/common.css" type="text/css" media="screen" charset="utf-8" />
|
9
|
-
|
10
|
-
<script type="text/javascript" charset="utf-8">
|
11
|
-
relpath = '..';
|
12
|
-
if (relpath != '') relpath += '/';
|
13
|
-
</script>
|
14
|
-
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
15
|
-
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
16
|
-
|
17
|
-
</head>
|
18
|
-
<body>
|
19
|
-
<script type="text/javascript" charset="utf-8">
|
20
|
-
if (window.top.frames.main) document.body.className = 'frames';
|
21
|
-
</script>
|
22
|
-
|
23
|
-
<div id="header">
|
24
|
-
<div id="menu">
|
25
|
-
|
26
|
-
<a href="../_index.html">Index (A)</a> »
|
27
|
-
<span class='title'><span class='object_link'><a href="../Sprout.html" title="Sprout (module)">Sprout</a></span></span>
|
28
|
-
»
|
29
|
-
<span class="title">ArchiveUnpacker</span>
|
30
|
-
|
31
|
-
|
32
|
-
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
33
|
-
</div>
|
34
|
-
|
35
|
-
<div id="search">
|
36
|
-
<a id="class_list_link" href="#">Class List</a>
|
37
|
-
<a id="method_list_link" href="#">Method List</a>
|
38
|
-
<a id ="file_list_link" href="#">File List</a>
|
39
|
-
</div>
|
40
|
-
|
41
|
-
<div class="clear"></div>
|
42
|
-
</div>
|
43
|
-
|
44
|
-
<iframe id="search_frame"></iframe>
|
45
|
-
|
46
|
-
<div id="content"><h1>Class: Sprout::ArchiveUnpacker
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
</h1>
|
51
|
-
|
52
|
-
<dl class="box">
|
53
|
-
|
54
|
-
<dt class="r1">Inherits:</dt>
|
55
|
-
<dd class="r1">
|
56
|
-
<span class="inheritName">Object</span>
|
57
|
-
|
58
|
-
<ul class="fullTree">
|
59
|
-
<li>Object</li>
|
60
|
-
|
61
|
-
<li class="next">Sprout::ArchiveUnpacker</li>
|
62
|
-
|
63
|
-
</ul>
|
64
|
-
<a href="#" class="inheritanceTree">show all</a>
|
65
|
-
|
66
|
-
</dd>
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
<dt class="r2 last">Defined in:</dt>
|
77
|
-
<dd class="r2 last">lib/sprout/archive_unpacker.rb</dd>
|
78
|
-
|
79
|
-
</dl>
|
80
|
-
<div class="clear"></div>
|
81
|
-
|
82
|
-
<h2>Overview</h2><div class="docstring">
|
83
|
-
<div class="discussion">
|
84
|
-
|
85
|
-
<p>Given a source, destination and archive type (or ability to infer it),
|
86
|
-
unpack the provided archive.</p>
|
87
|
-
|
88
|
-
<pre class="code"><span class='id unpacker'>unpacker</span> <span class='op'>=</span> <span class='const'>Sprout</span><span class='op'>::</span><span class='const'>ArchiveUnpacker</span><span class='period'>.</span><span class='id new'>new</span>
|
89
|
-
<span class='id unpacker'>unpacker</span><span class='period'>.</span><span class='id unpack'>unpack</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Foo.zip</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>unpacked/</span><span class='tstring_end'>"</span></span></pre>
|
90
|
-
|
91
|
-
|
92
|
-
</div>
|
93
|
-
</div>
|
94
|
-
<div class="tags">
|
95
|
-
|
96
|
-
</div>
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
<h2>
|
101
|
-
Instance Method Summary
|
102
|
-
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
103
|
-
</h2>
|
104
|
-
|
105
|
-
<ul class="summary">
|
106
|
-
|
107
|
-
<li class="public ">
|
108
|
-
<span class="summary_signature">
|
109
|
-
|
110
|
-
<a href="#copy_file-instance_method" title="#copy_file (instance method)">- (File) <strong>copy_file</strong>(file, destination, clobber = nil) </a>
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
</span>
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
<span class="summary_desc"><div class='inline'>
|
124
|
-
<p>Rather than unpacking, safely copy the file from one location to another.</p>
|
125
|
-
</div></span>
|
126
|
-
|
127
|
-
</li>
|
128
|
-
|
129
|
-
|
130
|
-
<li class="public ">
|
131
|
-
<span class="summary_signature">
|
132
|
-
|
133
|
-
<a href="#is_darwin%3F-instance_method" title="#is_darwin? (instance method)">- (Boolean) <strong>is_darwin?</strong> </a>
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
</span>
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
<span class="summary_desc"><div class='inline'>
|
147
|
-
<p>Return true if we're on a Darwin native system (OSX).</p>
|
148
|
-
</div></span>
|
149
|
-
|
150
|
-
</li>
|
151
|
-
|
152
|
-
|
153
|
-
<li class="public ">
|
154
|
-
<span class="summary_signature">
|
155
|
-
|
156
|
-
<a href="#is_exe%3F-instance_method" title="#is_exe? (instance method)">- (Boolean) <strong>is_exe?</strong>(archive, type = nil) </a>
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
</span>
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
<span class="summary_desc"><div class='inline'>
|
170
|
-
<p>Return true if the downloaded archive is a .exe file or the <tt>type</tt>
|
171
|
-
argument is <tt>:exe</tt>.</p>
|
172
|
-
</div></span>
|
173
|
-
|
174
|
-
</li>
|
175
|
-
|
176
|
-
|
177
|
-
<li class="public ">
|
178
|
-
<span class="summary_signature">
|
179
|
-
|
180
|
-
<a href="#is_rb%3F-instance_method" title="#is_rb? (instance method)">- (Boolean) <strong>is_rb?</strong>(archive, type = nil) </a>
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
</span>
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
<span class="summary_desc"><div class='inline'>
|
194
|
-
<p>Return true if the downloaded archive is a .rb file or the <tt>type</tt>
|
195
|
-
argument is <tt>:rb</tt>.</p>
|
196
|
-
</div></span>
|
197
|
-
|
198
|
-
</li>
|
199
|
-
|
200
|
-
|
201
|
-
<li class="public ">
|
202
|
-
<span class="summary_signature">
|
203
|
-
|
204
|
-
<a href="#is_swc%3F-instance_method" title="#is_swc? (instance method)">- (Boolean) <strong>is_swc?</strong>(archive, type = nil) </a>
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
</span>
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
<span class="summary_desc"><div class='inline'>
|
218
|
-
<p>Return true if the downloaded archive is a .swc file or the <tt>type</tt>
|
219
|
-
argument is <tt>:swc</tt>.</p>
|
220
|
-
</div></span>
|
221
|
-
|
222
|
-
</li>
|
223
|
-
|
224
|
-
|
225
|
-
<li class="public ">
|
226
|
-
<span class="summary_signature">
|
227
|
-
|
228
|
-
<a href="#is_tgz%3F-instance_method" title="#is_tgz? (instance method)">- (Boolean) <strong>is_tgz?</strong>(archive, type = nil) </a>
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
</span>
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
<span class="summary_desc"><div class='inline'>
|
242
|
-
<p>Return true if the provided file name looks like a tar.gz file or the
|
243
|
-
<tt>type</tt> argument is <tt>:tgz</tt>.</p>
|
244
|
-
</div></span>
|
245
|
-
|
246
|
-
</li>
|
247
|
-
|
248
|
-
|
249
|
-
<li class="public ">
|
250
|
-
<span class="summary_signature">
|
251
|
-
|
252
|
-
<a href="#is_zip%3F-instance_method" title="#is_zip? (instance method)">- (Boolean) <strong>is_zip?</strong>(archive, type = nil) </a>
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
</span>
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
<span class="summary_desc"><div class='inline'>
|
266
|
-
<p>Returns true if the provided file name looks like a zip file or the
|
267
|
-
<tt>type</tt> argument is <tt>:zip</tt>.</p>
|
268
|
-
</div></span>
|
269
|
-
|
270
|
-
</li>
|
271
|
-
|
272
|
-
|
273
|
-
<li class="public ">
|
274
|
-
<span class="summary_signature">
|
275
|
-
|
276
|
-
<a href="#unpack-instance_method" title="#unpack (instance method)">- (String) <strong>unpack</strong>(archive, destination, type = nil, clobber = nil) </a>
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
</span>
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
<span class="summary_desc"><div class='inline'>
|
290
|
-
<p>Unpack the provided <tt>archive</tt> into the provided
|
291
|
-
<tt>destination</tt>.</p>
|
292
|
-
</div></span>
|
293
|
-
|
294
|
-
</li>
|
295
|
-
|
296
|
-
|
297
|
-
<li class="public ">
|
298
|
-
<span class="summary_signature">
|
299
|
-
|
300
|
-
<a href="#unpack_tgz-instance_method" title="#unpack_tgz (instance method)">- (File) <strong>unpack_tgz</strong>(archive, destination, clobber = nil) </a>
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
</span>
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
<span class="summary_desc"><div class='inline'>
|
314
|
-
<p>Unpack tar.gz or .tgz files on any platform.</p>
|
315
|
-
</div></span>
|
316
|
-
|
317
|
-
</li>
|
318
|
-
|
319
|
-
|
320
|
-
<li class="public ">
|
321
|
-
<span class="summary_signature">
|
322
|
-
|
323
|
-
<a href="#unpack_zip-instance_method" title="#unpack_zip (instance method)">- (File) <strong>unpack_zip</strong>(archive, destination, clobber = nil) </a>
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
</span>
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
<span class="summary_desc"><div class='inline'>
|
337
|
-
<p>Unpack zip archives on any platform using whatever strategy is most
|
338
|
-
efficient and reliable.</p>
|
339
|
-
</div></span>
|
340
|
-
|
341
|
-
</li>
|
342
|
-
|
343
|
-
|
344
|
-
<li class="public ">
|
345
|
-
<span class="summary_signature">
|
346
|
-
|
347
|
-
<a href="#unpack_zip_on_darwin-instance_method" title="#unpack_zip_on_darwin (instance method)">- (File) <strong>unpack_zip_on_darwin</strong>(archive, destination, clobber) </a>
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
</span>
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
<span class="summary_desc"><div class='inline'>
|
361
|
-
<p>Optimization for zip files on OSX.</p>
|
362
|
-
</div></span>
|
363
|
-
|
364
|
-
</li>
|
365
|
-
|
366
|
-
|
367
|
-
</ul>
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
<div id="instance_method_details" class="method_details_list">
|
373
|
-
<h2>Instance Method Details</h2>
|
374
|
-
|
375
|
-
|
376
|
-
<div class="method_details first">
|
377
|
-
<p class="signature first" id="copy_file-instance_method">
|
378
|
-
|
379
|
-
- (<tt>File</tt>) <strong>copy_file</strong>(file, destination, clobber = nil)
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
</p><div class="docstring">
|
384
|
-
<div class="discussion">
|
385
|
-
|
386
|
-
<p>Rather than unpacking, safely copy the file from one location to another.
|
387
|
-
This method is generally used when .exe files are downloaded directly.</p>
|
388
|
-
|
389
|
-
|
390
|
-
</div>
|
391
|
-
</div>
|
392
|
-
<div class="tags">
|
393
|
-
<h3>Returns:</h3>
|
394
|
-
<ul class="return">
|
395
|
-
|
396
|
-
<li>
|
397
|
-
|
398
|
-
<span class='type'>(<tt>File</tt>)</span>
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
—
|
404
|
-
<div class='inline'>
|
405
|
-
<p>the file or directory that was created.</p>
|
406
|
-
</div>
|
407
|
-
|
408
|
-
</li>
|
409
|
-
|
410
|
-
</ul>
|
411
|
-
|
412
|
-
</div><table class="source_code">
|
413
|
-
<tr>
|
414
|
-
<td>
|
415
|
-
<pre class="lines">
|
416
|
-
|
417
|
-
|
418
|
-
125
|
419
|
-
126
|
420
|
-
127
|
421
|
-
128
|
422
|
-
129
|
423
|
-
130
|
424
|
-
131
|
425
|
-
132
|
426
|
-
133
|
427
|
-
134
|
428
|
-
135</pre>
|
429
|
-
</td>
|
430
|
-
<td>
|
431
|
-
<pre class="code"><span class="info file"># File 'lib/sprout/archive_unpacker.rb', line 125</span>
|
432
|
-
|
433
|
-
<span class='kw'>def</span> <span class='id copy_file'>copy_file</span> <span class='id file'>file</span><span class='comma'>,</span> <span class='id destination'>destination</span><span class='comma'>,</span> <span class='id clobber'>clobber</span><span class='op'>=</span><span class='kw'>nil</span>
|
434
|
-
<span class='id validate'>validate</span> <span class='id file'>file</span><span class='comma'>,</span> <span class='id destination'>destination</span>
|
435
|
-
<span class='id target'>target</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id expand_path'>expand_path</span><span class='lparen'>(</span> <span class='const'>File</span><span class='period'>.</span><span class='id join'>join</span><span class='lparen'>(</span><span class='id destination'>destination</span><span class='comma'>,</span> <span class='const'>File</span><span class='period'>.</span><span class='id basename'>basename</span><span class='lparen'>(</span><span class='id file'>file</span><span class='rparen'>)</span><span class='rparen'>)</span> <span class='rparen'>)</span>
|
436
|
-
<span class='kw'>if</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id exists?'>exists?</span><span class='lparen'>(</span><span class='id target'>target</span><span class='rparen'>)</span> <span class='op'>&&</span> <span class='id clobber'>clobber</span> <span class='op'>!=</span> <span class='symbol'>:clobber</span><span class='rparen'>)</span>
|
437
|
-
<span class='id raise'>raise</span> <span class='const'>Sprout</span><span class='op'>::</span><span class='const'>Errors</span><span class='op'>::</span><span class='const'>DestinationExistsError</span><span class='period'>.</span><span class='id new'>new</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Unable to copy </span><span class='embexpr_beg'>#{</span><span class='id file'>file</span><span class='rbrace'>}</span><span class='tstring_content'> to </span><span class='embexpr_beg'>#{</span><span class='id target'>target</span><span class='rbrace'>}</span><span class='tstring_content'> because target already exists and we were not asked to :clobber it</span><span class='tstring_end'>"</span></span>
|
438
|
-
<span class='kw'>end</span>
|
439
|
-
<span class='const'>FileUtils</span><span class='period'>.</span><span class='id mkdir_p'>mkdir_p</span> <span class='id destination'>destination</span>
|
440
|
-
<span class='const'>FileUtils</span><span class='period'>.</span><span class='id cp_r'>cp_r</span> <span class='id file'>file</span><span class='comma'>,</span> <span class='id destination'>destination</span>
|
441
|
-
|
442
|
-
<span class='id destination'>destination</span>
|
443
|
-
<span class='kw'>end</span></pre>
|
444
|
-
</td>
|
445
|
-
</tr>
|
446
|
-
</table>
|
447
|
-
</div>
|
448
|
-
|
449
|
-
<div class="method_details ">
|
450
|
-
<p class="signature " id="is_darwin?-instance_method">
|
451
|
-
|
452
|
-
- (<tt>Boolean</tt>) <strong>is_darwin?</strong>
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
</p><div class="docstring">
|
457
|
-
<div class="discussion">
|
458
|
-
|
459
|
-
<p>Return true if we're on a Darwin native system (OSX).</p>
|
460
|
-
|
461
|
-
|
462
|
-
</div>
|
463
|
-
</div>
|
464
|
-
<div class="tags">
|
465
|
-
<h3>Returns:</h3>
|
466
|
-
<ul class="return">
|
467
|
-
|
468
|
-
<li>
|
469
|
-
|
470
|
-
<span class='type'>(<tt>Boolean</tt>)</span>
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
</li>
|
476
|
-
|
477
|
-
</ul>
|
478
|
-
|
479
|
-
</div><table class="source_code">
|
480
|
-
<tr>
|
481
|
-
<td>
|
482
|
-
<pre class="lines">
|
483
|
-
|
484
|
-
|
485
|
-
72
|
486
|
-
73
|
487
|
-
74</pre>
|
488
|
-
</td>
|
489
|
-
<td>
|
490
|
-
<pre class="code"><span class="info file"># File 'lib/sprout/archive_unpacker.rb', line 72</span>
|
491
|
-
|
492
|
-
<span class='kw'>def</span> <span class='id is_darwin?'>is_darwin?</span>
|
493
|
-
<span class='const'>Sprout</span><span class='period'>.</span><span class='id current_system'>current_system</span><span class='period'>.</span><span class='id is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Sprout</span><span class='op'>::</span><span class='const'>System</span><span class='op'>::</span><span class='const'>OSXSystem</span><span class='rparen'>)</span>
|
494
|
-
<span class='kw'>end</span></pre>
|
495
|
-
</td>
|
496
|
-
</tr>
|
497
|
-
</table>
|
498
|
-
</div>
|
499
|
-
|
500
|
-
<div class="method_details ">
|
501
|
-
<p class="signature " id="is_exe?-instance_method">
|
502
|
-
|
503
|
-
- (<tt>Boolean</tt>) <strong>is_exe?</strong>(archive, type = nil)
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
</p><div class="docstring">
|
508
|
-
<div class="discussion">
|
509
|
-
|
510
|
-
<p>Return true if the downloaded archive is a .exe file or the <tt>type</tt>
|
511
|
-
argument is <tt>:exe</tt>.</p>
|
512
|
-
|
513
|
-
|
514
|
-
</div>
|
515
|
-
</div>
|
516
|
-
<div class="tags">
|
517
|
-
<h3>Returns:</h3>
|
518
|
-
<ul class="return">
|
519
|
-
|
520
|
-
<li>
|
521
|
-
|
522
|
-
<span class='type'>(<tt>Boolean</tt>)</span>
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
</li>
|
528
|
-
|
529
|
-
</ul>
|
530
|
-
|
531
|
-
</div><table class="source_code">
|
532
|
-
<tr>
|
533
|
-
<td>
|
534
|
-
<pre class="lines">
|
535
|
-
|
536
|
-
|
537
|
-
154
|
538
|
-
155
|
539
|
-
156</pre>
|
540
|
-
</td>
|
541
|
-
<td>
|
542
|
-
<pre class="code"><span class="info file"># File 'lib/sprout/archive_unpacker.rb', line 154</span>
|
543
|
-
|
544
|
-
<span class='kw'>def</span> <span class='id is_exe?'>is_exe?</span> <span class='id archive'>archive</span><span class='comma'>,</span> <span class='id type'>type</span><span class='op'>=</span><span class='kw'>nil</span>
|
545
|
-
<span class='id type'>type</span> <span class='op'>==</span> <span class='symbol'>:exe</span> <span class='op'>||</span> <span class='op'>!</span><span class='id archive'>archive</span><span class='period'>.</span><span class='id match'>match</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>\.exe$</span><span class='regexp_end'>/</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id nil?'>nil?</span>
|
546
|
-
<span class='kw'>end</span></pre>
|
547
|
-
</td>
|
548
|
-
</tr>
|
549
|
-
</table>
|
550
|
-
</div>
|
551
|
-
|
552
|
-
<div class="method_details ">
|
553
|
-
<p class="signature " id="is_rb?-instance_method">
|
554
|
-
|
555
|
-
- (<tt>Boolean</tt>) <strong>is_rb?</strong>(archive, type = nil)
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
</p><div class="docstring">
|
560
|
-
<div class="discussion">
|
561
|
-
|
562
|
-
<p>Return true if the downloaded archive is a .rb file or the <tt>type</tt>
|
563
|
-
argument is <tt>:rb</tt>.</p>
|
564
|
-
|
565
|
-
|
566
|
-
</div>
|
567
|
-
</div>
|
568
|
-
<div class="tags">
|
569
|
-
<h3>Returns:</h3>
|
570
|
-
<ul class="return">
|
571
|
-
|
572
|
-
<li>
|
573
|
-
|
574
|
-
<span class='type'>(<tt>Boolean</tt>)</span>
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
</li>
|
580
|
-
|
581
|
-
</ul>
|
582
|
-
|
583
|
-
</div><table class="source_code">
|
584
|
-
<tr>
|
585
|
-
<td>
|
586
|
-
<pre class="lines">
|
587
|
-
|
588
|
-
|
589
|
-
168
|
590
|
-
169
|
591
|
-
170</pre>
|
592
|
-
</td>
|
593
|
-
<td>
|
594
|
-
<pre class="code"><span class="info file"># File 'lib/sprout/archive_unpacker.rb', line 168</span>
|
595
|
-
|
596
|
-
<span class='kw'>def</span> <span class='id is_rb?'>is_rb?</span> <span class='id archive'>archive</span><span class='comma'>,</span> <span class='id type'>type</span><span class='op'>=</span><span class='kw'>nil</span>
|
597
|
-
<span class='id type'>type</span> <span class='op'>==</span> <span class='symbol'>:rb</span> <span class='op'>||</span> <span class='op'>!</span><span class='id archive'>archive</span><span class='period'>.</span><span class='id match'>match</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>\.rb$</span><span class='regexp_end'>/</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id nil?'>nil?</span>
|
598
|
-
<span class='kw'>end</span></pre>
|
599
|
-
</td>
|
600
|
-
</tr>
|
601
|
-
</table>
|
602
|
-
</div>
|
603
|
-
|
604
|
-
<div class="method_details ">
|
605
|
-
<p class="signature " id="is_swc?-instance_method">
|
606
|
-
|
607
|
-
- (<tt>Boolean</tt>) <strong>is_swc?</strong>(archive, type = nil)
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
</p><div class="docstring">
|
612
|
-
<div class="discussion">
|
613
|
-
|
614
|
-
<p>Return true if the downloaded archive is a .swc file or the <tt>type</tt>
|
615
|
-
argument is <tt>:swc</tt>.</p>
|
616
|
-
|
617
|
-
|
618
|
-
</div>
|
619
|
-
</div>
|
620
|
-
<div class="tags">
|
621
|
-
<h3>Returns:</h3>
|
622
|
-
<ul class="return">
|
623
|
-
|
624
|
-
<li>
|
625
|
-
|
626
|
-
<span class='type'>(<tt>Boolean</tt>)</span>
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
</li>
|
632
|
-
|
633
|
-
</ul>
|
634
|
-
|
635
|
-
</div><table class="source_code">
|
636
|
-
<tr>
|
637
|
-
<td>
|
638
|
-
<pre class="lines">
|
639
|
-
|
640
|
-
|
641
|
-
161
|
642
|
-
162
|
643
|
-
163</pre>
|
644
|
-
</td>
|
645
|
-
<td>
|
646
|
-
<pre class="code"><span class="info file"># File 'lib/sprout/archive_unpacker.rb', line 161</span>
|
647
|
-
|
648
|
-
<span class='kw'>def</span> <span class='id is_swc?'>is_swc?</span> <span class='id archive'>archive</span><span class='comma'>,</span> <span class='id type'>type</span><span class='op'>=</span><span class='kw'>nil</span>
|
649
|
-
<span class='id type'>type</span> <span class='op'>==</span> <span class='symbol'>:swc</span> <span class='op'>||</span> <span class='op'>!</span><span class='id archive'>archive</span><span class='period'>.</span><span class='id match'>match</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>\.swc$</span><span class='regexp_end'>/</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id nil?'>nil?</span>
|
650
|
-
<span class='kw'>end</span></pre>
|
651
|
-
</td>
|
652
|
-
</tr>
|
653
|
-
</table>
|
654
|
-
</div>
|
655
|
-
|
656
|
-
<div class="method_details ">
|
657
|
-
<p class="signature " id="is_tgz?-instance_method">
|
658
|
-
|
659
|
-
- (<tt>Boolean</tt>) <strong>is_tgz?</strong>(archive, type = nil)
|
660
|
-
|
661
|
-
|
662
|
-
|
663
|
-
</p><div class="docstring">
|
664
|
-
<div class="discussion">
|
665
|
-
|
666
|
-
<p>Return true if the provided file name looks like a tar.gz file or the
|
667
|
-
<tt>type</tt> argument is <tt>:tgz</tt>.</p>
|
668
|
-
|
669
|
-
|
670
|
-
</div>
|
671
|
-
</div>
|
672
|
-
<div class="tags">
|
673
|
-
<h3>Returns:</h3>
|
674
|
-
<ul class="return">
|
675
|
-
|
676
|
-
<li>
|
677
|
-
|
678
|
-
<span class='type'>(<tt>Boolean</tt>)</span>
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
</li>
|
684
|
-
|
685
|
-
</ul>
|
686
|
-
|
687
|
-
</div><table class="source_code">
|
688
|
-
<tr>
|
689
|
-
<td>
|
690
|
-
<pre class="lines">
|
691
|
-
|
692
|
-
|
693
|
-
147
|
694
|
-
148
|
695
|
-
149</pre>
|
696
|
-
</td>
|
697
|
-
<td>
|
698
|
-
<pre class="code"><span class="info file"># File 'lib/sprout/archive_unpacker.rb', line 147</span>
|
699
|
-
|
700
|
-
<span class='kw'>def</span> <span class='id is_tgz?'>is_tgz?</span> <span class='id archive'>archive</span><span class='comma'>,</span> <span class='id type'>type</span><span class='op'>=</span><span class='kw'>nil</span>
|
701
|
-
<span class='id type'>type</span> <span class='op'>==</span> <span class='symbol'>:tgz</span> <span class='op'>||</span> <span class='op'>!</span><span class='id archive'>archive</span><span class='period'>.</span><span class='id match'>match</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>\.tgz$</span><span class='regexp_end'>/</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id nil?'>nil?</span> <span class='op'>||</span> <span class='op'>!</span><span class='id archive'>archive</span><span class='period'>.</span><span class='id match'>match</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>\.tar.gz$</span><span class='regexp_end'>/</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id nil?'>nil?</span>
|
702
|
-
<span class='kw'>end</span></pre>
|
703
|
-
</td>
|
704
|
-
</tr>
|
705
|
-
</table>
|
706
|
-
</div>
|
707
|
-
|
708
|
-
<div class="method_details ">
|
709
|
-
<p class="signature " id="is_zip?-instance_method">
|
710
|
-
|
711
|
-
- (<tt>Boolean</tt>) <strong>is_zip?</strong>(archive, type = nil)
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
</p><div class="docstring">
|
716
|
-
<div class="discussion">
|
717
|
-
|
718
|
-
<p>Returns true if the provided file name looks like a zip file or the
|
719
|
-
<tt>type</tt> argument is <tt>:zip</tt>.</p>
|
720
|
-
|
721
|
-
|
722
|
-
</div>
|
723
|
-
</div>
|
724
|
-
<div class="tags">
|
725
|
-
<h3>Returns:</h3>
|
726
|
-
<ul class="return">
|
727
|
-
|
728
|
-
<li>
|
729
|
-
|
730
|
-
<span class='type'>(<tt>Boolean</tt>)</span>
|
731
|
-
|
732
|
-
|
733
|
-
|
734
|
-
|
735
|
-
</li>
|
736
|
-
|
737
|
-
</ul>
|
738
|
-
|
739
|
-
</div><table class="source_code">
|
740
|
-
<tr>
|
741
|
-
<td>
|
742
|
-
<pre class="lines">
|
743
|
-
|
744
|
-
|
745
|
-
140
|
746
|
-
141
|
747
|
-
142</pre>
|
748
|
-
</td>
|
749
|
-
<td>
|
750
|
-
<pre class="code"><span class="info file"># File 'lib/sprout/archive_unpacker.rb', line 140</span>
|
751
|
-
|
752
|
-
<span class='kw'>def</span> <span class='id is_zip?'>is_zip?</span> <span class='id archive'>archive</span><span class='comma'>,</span> <span class='id type'>type</span><span class='op'>=</span><span class='kw'>nil</span>
|
753
|
-
<span class='id type'>type</span> <span class='op'>==</span> <span class='symbol'>:zip</span> <span class='op'>||</span> <span class='op'>!</span><span class='id archive'>archive</span><span class='period'>.</span><span class='id match'>match</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>\.zip$</span><span class='regexp_end'>/</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id nil?'>nil?</span>
|
754
|
-
<span class='kw'>end</span></pre>
|
755
|
-
</td>
|
756
|
-
</tr>
|
757
|
-
</table>
|
758
|
-
</div>
|
759
|
-
|
760
|
-
<div class="method_details ">
|
761
|
-
<p class="signature " id="unpack-instance_method">
|
762
|
-
|
763
|
-
- (<tt><span class='object_link'><a href="../String.html" title="String (class)">String</a></span></tt>) <strong>unpack</strong>(archive, destination, type = nil, clobber = nil)
|
764
|
-
|
765
|
-
|
766
|
-
|
767
|
-
</p><div class="docstring">
|
768
|
-
<div class="discussion">
|
769
|
-
|
770
|
-
<p>Unpack the provided <tt>archive</tt> into the provided
|
771
|
-
<tt>destination</tt>.</p>
|
772
|
-
|
773
|
-
<p>If a <tt>type</tt> is not provided, a type will be inferred from the file
|
774
|
-
name suffix.</p>
|
775
|
-
|
776
|
-
|
777
|
-
</div>
|
778
|
-
</div>
|
779
|
-
<div class="tags">
|
780
|
-
<h3>Parameters:</h3>
|
781
|
-
<ul class="param">
|
782
|
-
|
783
|
-
<li>
|
784
|
-
|
785
|
-
<span class='type'>(<tt>File</tt>)</span>
|
786
|
-
|
787
|
-
|
788
|
-
<span class='name'>archive</span>
|
789
|
-
|
790
|
-
|
791
|
-
|
792
|
-
—
|
793
|
-
<div class='inline'>
|
794
|
-
<p>Path to the archive that will be unpacked (or copied)</p>
|
795
|
-
</div>
|
796
|
-
|
797
|
-
</li>
|
798
|
-
|
799
|
-
<li>
|
800
|
-
|
801
|
-
<span class='type'>(<tt>Path</tt>)</span>
|
802
|
-
|
803
|
-
|
804
|
-
<span class='name'>destination</span>
|
805
|
-
|
806
|
-
|
807
|
-
|
808
|
-
—
|
809
|
-
<div class='inline'>
|
810
|
-
<p>Path to the folder where unpacked files should be placed (or copied).</p>
|
811
|
-
</div>
|
812
|
-
|
813
|
-
</li>
|
814
|
-
|
815
|
-
<li>
|
816
|
-
|
817
|
-
<span class='type'>(<tt>Symbol</tt>)</span>
|
818
|
-
|
819
|
-
|
820
|
-
<span class='name'>type</span>
|
821
|
-
|
822
|
-
|
823
|
-
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
824
|
-
|
825
|
-
|
826
|
-
—
|
827
|
-
<div class='inline'>
|
828
|
-
<p>The type of the archive in cases where it can't be inferred from the name.
|
829
|
-
Acceptable values are: :zip, :tgz, :swc, :exe or :rb</p>
|
830
|
-
</div>
|
831
|
-
|
832
|
-
</li>
|
833
|
-
|
834
|
-
<li>
|
835
|
-
|
836
|
-
<span class='type'>(<tt>Boolean</tt>)</span>
|
837
|
-
|
838
|
-
|
839
|
-
<span class='name'>clobber</span>
|
840
|
-
|
841
|
-
|
842
|
-
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
843
|
-
|
844
|
-
|
845
|
-
—
|
846
|
-
<div class='inline'>
|
847
|
-
<p>If the destination already contains the expected file(s), the unpacker
|
848
|
-
will not run unless <tt>clobber</tt> is true.</p>
|
849
|
-
</div>
|
850
|
-
|
851
|
-
</li>
|
852
|
-
|
853
|
-
</ul>
|
854
|
-
<h3>Returns:</h3>
|
855
|
-
<ul class="return">
|
856
|
-
|
857
|
-
<li>
|
858
|
-
|
859
|
-
<span class='type'>(<tt><span class='object_link'><a href="../String.html" title="String (class)">String</a></span></tt>)</span>
|
860
|
-
|
861
|
-
|
862
|
-
|
863
|
-
|
864
|
-
—
|
865
|
-
<div class='inline'>
|
866
|
-
<p>path to the unpacked files (usually same as destination).</p>
|
867
|
-
</div>
|
868
|
-
|
869
|
-
</li>
|
870
|
-
|
871
|
-
</ul>
|
872
|
-
<h3>Raises:</h3>
|
873
|
-
<ul class="raise">
|
874
|
-
|
875
|
-
<li>
|
876
|
-
|
877
|
-
<span class='type'></span>
|
878
|
-
|
879
|
-
|
880
|
-
|
881
|
-
|
882
|
-
|
883
|
-
<div class='inline'>
|
884
|
-
<p>Sprout::Errors::UnknownArchiveType If the archive type cannot be inferred
|
885
|
-
and a valid type is not provided.</p>
|
886
|
-
</div>
|
887
|
-
|
888
|
-
</li>
|
889
|
-
|
890
|
-
</ul>
|
891
|
-
|
892
|
-
</div><table class="source_code">
|
893
|
-
<tr>
|
894
|
-
<td>
|
895
|
-
<pre class="lines">
|
896
|
-
|
897
|
-
|
898
|
-
27
|
899
|
-
28
|
900
|
-
29
|
901
|
-
30
|
902
|
-
31
|
903
|
-
32
|
904
|
-
33
|
905
|
-
34
|
906
|
-
35
|
907
|
-
36
|
908
|
-
37
|
909
|
-
38</pre>
|
910
|
-
</td>
|
911
|
-
<td>
|
912
|
-
<pre class="code"><span class="info file"># File 'lib/sprout/archive_unpacker.rb', line 27</span>
|
913
|
-
|
914
|
-
<span class='kw'>def</span> <span class='id unpack'>unpack</span> <span class='id archive'>archive</span><span class='comma'>,</span> <span class='id destination'>destination</span><span class='comma'>,</span> <span class='id type'>type</span><span class='op'>=</span><span class='kw'>nil</span><span class='comma'>,</span> <span class='id clobber'>clobber</span><span class='op'>=</span><span class='kw'>nil</span>
|
915
|
-
<span class='kw'>return</span> <span class='id unpack_zip'>unpack_zip</span><span class='lparen'>(</span><span class='id archive'>archive</span><span class='comma'>,</span> <span class='id destination'>destination</span><span class='comma'>,</span> <span class='id clobber'>clobber</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id is_zip?'>is_zip?</span><span class='lparen'>(</span><span class='id archive'>archive</span><span class='comma'>,</span> <span class='id type'>type</span><span class='rparen'>)</span>
|
916
|
-
<span class='kw'>return</span> <span class='id unpack_tgz'>unpack_tgz</span><span class='lparen'>(</span><span class='id archive'>archive</span><span class='comma'>,</span> <span class='id destination'>destination</span><span class='comma'>,</span> <span class='id clobber'>clobber</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id is_tgz?'>is_tgz?</span><span class='lparen'>(</span><span class='id archive'>archive</span><span class='comma'>,</span> <span class='id type'>type</span><span class='rparen'>)</span>
|
917
|
-
|
918
|
-
<span class='comment'># This is definitely debatable, should we copy the file even if it's
|
919
|
-
</span> <span class='comment'># not an archive that we're about to unpack?
|
920
|
-
</span> <span class='comment'># If so, why would we only do this with some subset of file types?
|
921
|
-
</span> <span class='comment'># Opinions welcome here...
|
922
|
-
</span> <span class='kw'>return</span> <span class='id copy_file'>copy_file</span><span class='lparen'>(</span><span class='id archive'>archive</span><span class='comma'>,</span> <span class='id destination'>destination</span><span class='comma'>,</span> <span class='id clobber'>clobber</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id is_copyable?'>is_copyable?</span><span class='lparen'>(</span><span class='id archive'>archive</span><span class='rparen'>)</span>
|
923
|
-
|
924
|
-
<span class='id raise'>raise</span> <span class='const'>Sprout</span><span class='op'>::</span><span class='const'>Errors</span><span class='op'>::</span><span class='const'>UnknownArchiveType</span><span class='period'>.</span><span class='id new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Unsupported or unknown archive type encountered with: </span><span class='embexpr_beg'>#{</span><span class='id archive'>archive</span><span class='rbrace'>}</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
925
|
-
<span class='kw'>end</span></pre>
|
926
|
-
</td>
|
927
|
-
</tr>
|
928
|
-
</table>
|
929
|
-
</div>
|
930
|
-
|
931
|
-
<div class="method_details ">
|
932
|
-
<p class="signature " id="unpack_tgz-instance_method">
|
933
|
-
|
934
|
-
- (<tt>File</tt>) <strong>unpack_tgz</strong>(archive, destination, clobber = nil)
|
935
|
-
|
936
|
-
|
937
|
-
|
938
|
-
</p><div class="docstring">
|
939
|
-
<div class="discussion">
|
940
|
-
|
941
|
-
<p>Unpack tar.gz or .tgz files on any platform.</p>
|
942
|
-
|
943
|
-
|
944
|
-
</div>
|
945
|
-
</div>
|
946
|
-
<div class="tags">
|
947
|
-
<h3>Returns:</h3>
|
948
|
-
<ul class="return">
|
949
|
-
|
950
|
-
<li>
|
951
|
-
|
952
|
-
<span class='type'>(<tt>File</tt>)</span>
|
953
|
-
|
954
|
-
|
955
|
-
|
956
|
-
|
957
|
-
—
|
958
|
-
<div class='inline'>
|
959
|
-
<p>the file or directory that was created.</p>
|
960
|
-
</div>
|
961
|
-
|
962
|
-
</li>
|
963
|
-
|
964
|
-
</ul>
|
965
|
-
|
966
|
-
</div><table class="source_code">
|
967
|
-
<tr>
|
968
|
-
<td>
|
969
|
-
<pre class="lines">
|
970
|
-
|
971
|
-
|
972
|
-
97
|
973
|
-
98
|
974
|
-
99
|
975
|
-
100
|
976
|
-
101
|
977
|
-
102
|
978
|
-
103
|
979
|
-
104
|
980
|
-
105
|
981
|
-
106
|
982
|
-
107
|
983
|
-
108
|
984
|
-
109
|
985
|
-
110
|
986
|
-
111
|
987
|
-
112
|
988
|
-
113
|
989
|
-
114
|
990
|
-
115
|
991
|
-
116</pre>
|
992
|
-
</td>
|
993
|
-
<td>
|
994
|
-
<pre class="code"><span class="info file"># File 'lib/sprout/archive_unpacker.rb', line 97</span>
|
995
|
-
|
996
|
-
<span class='kw'>def</span> <span class='id unpack_tgz'>unpack_tgz</span> <span class='id archive'>archive</span><span class='comma'>,</span> <span class='id destination'>destination</span><span class='comma'>,</span> <span class='id clobber'>clobber</span><span class='op'>=</span><span class='kw'>nil</span>
|
997
|
-
<span class='id validate'>validate</span> <span class='id archive'>archive</span><span class='comma'>,</span> <span class='id destination'>destination</span>
|
998
|
-
|
999
|
-
<span class='id tar'>tar</span> <span class='op'>=</span> <span class='const'>Zlib</span><span class='op'>::</span><span class='const'>GzipReader</span><span class='period'>.</span><span class='id new'>new</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id open'>open</span><span class='lparen'>(</span><span class='id archive'>archive</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>rb</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
|
1000
|
-
<span class='kw'>if</span><span class='lparen'>(</span><span class='op'>!</span><span class='id should_unpack_tgz?'>should_unpack_tgz?</span><span class='lparen'>(</span><span class='id destination'>destination</span><span class='comma'>,</span> <span class='id clobber'>clobber</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
1001
|
-
<span class='id raise'>raise</span> <span class='const'>Sprout</span><span class='op'>::</span><span class='const'>Errors</span><span class='op'>::</span><span class='const'>DestinationExistsError</span><span class='period'>.</span><span class='id new'>new</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Unable to unpack </span><span class='embexpr_beg'>#{</span><span class='id archive'>archive</span><span class='rbrace'>}</span><span class='tstring_content'> into </span><span class='embexpr_beg'>#{</span><span class='id destination'>destination</span><span class='rbrace'>}</span><span class='tstring_content'> without explicit :clobber argument</span><span class='tstring_end'>"</span></span>
|
1002
|
-
<span class='kw'>end</span>
|
1003
|
-
|
1004
|
-
<span class='const'>Archive</span><span class='op'>::</span><span class='const'>Tar</span><span class='op'>::</span><span class='const'>Minitar</span><span class='period'>.</span><span class='id unpack'>unpack</span><span class='lparen'>(</span><span class='id tar'>tar</span><span class='comma'>,</span> <span class='id destination'>destination</span><span class='rparen'>)</span>
|
1005
|
-
|
1006
|
-
<span class='comment'># Recurse and unpack gzipped children (Adobe did this double
|
1007
|
-
</span> <span class='comment'># gzip with the Linux FlashPlayer for some weird reason)
|
1008
|
-
</span> <span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id destination'>destination</span><span class='rbrace'>}</span><span class='tstring_content'>/**/*.tgz</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id destination'>destination</span><span class='rbrace'>}</span><span class='tstring_content'>/**/*.tar.gz</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id pattern'>pattern</span><span class='op'>|</span>
|
1009
|
-
<span class='const'>Dir</span><span class='period'>.</span><span class='id glob'>glob</span><span class='lparen'>(</span><span class='id pattern'>pattern</span><span class='rparen'>)</span><span class='period'>.</span><span class='id each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id child'>child</span><span class='op'>|</span>
|
1010
|
-
<span class='kw'>if</span><span class='lparen'>(</span><span class='id child'>child</span> <span class='op'>!=</span> <span class='id archive'>archive</span> <span class='op'>&&</span> <span class='id dir'>dir</span> <span class='op'>!=</span> <span class='const'>File</span><span class='period'>.</span><span class='id dirname'>dirname</span><span class='lparen'>(</span><span class='id child'>child</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
1011
|
-
<span class='id unpack_tgz'>unpack_tgz</span><span class='lparen'>(</span><span class='id child'>child</span><span class='comma'>,</span> <span class='const'>File</span><span class='period'>.</span><span class='id dirname'>dirname</span><span class='lparen'>(</span><span class='id child'>child</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
1012
|
-
<span class='kw'>end</span>
|
1013
|
-
<span class='kw'>end</span>
|
1014
|
-
<span class='kw'>end</span>
|
1015
|
-
<span class='kw'>end</span></pre>
|
1016
|
-
</td>
|
1017
|
-
</tr>
|
1018
|
-
</table>
|
1019
|
-
</div>
|
1020
|
-
|
1021
|
-
<div class="method_details ">
|
1022
|
-
<p class="signature " id="unpack_zip-instance_method">
|
1023
|
-
|
1024
|
-
- (<tt>File</tt>) <strong>unpack_zip</strong>(archive, destination, clobber = nil)
|
1025
|
-
|
1026
|
-
|
1027
|
-
|
1028
|
-
</p><div class="docstring">
|
1029
|
-
<div class="discussion">
|
1030
|
-
|
1031
|
-
<p>Unpack zip archives on any platform using whatever strategy is most
|
1032
|
-
efficient and reliable.</p>
|
1033
|
-
|
1034
|
-
|
1035
|
-
</div>
|
1036
|
-
</div>
|
1037
|
-
<div class="tags">
|
1038
|
-
<h3>Parameters:</h3>
|
1039
|
-
<ul class="param">
|
1040
|
-
|
1041
|
-
<li>
|
1042
|
-
|
1043
|
-
<span class='type'>(<tt>File</tt>)</span>
|
1044
|
-
|
1045
|
-
|
1046
|
-
<span class='name'>archive</span>
|
1047
|
-
|
1048
|
-
|
1049
|
-
|
1050
|
-
—
|
1051
|
-
<div class='inline'>
|
1052
|
-
<p>Path to the archive that will be unpacked.</p>
|
1053
|
-
</div>
|
1054
|
-
|
1055
|
-
</li>
|
1056
|
-
|
1057
|
-
<li>
|
1058
|
-
|
1059
|
-
<span class='type'>(<tt>Path</tt>)</span>
|
1060
|
-
|
1061
|
-
|
1062
|
-
<span class='name'>destination</span>
|
1063
|
-
|
1064
|
-
|
1065
|
-
|
1066
|
-
—
|
1067
|
-
<div class='inline'>
|
1068
|
-
<p>Path to the folder where unpacked files should be placed.</p>
|
1069
|
-
</div>
|
1070
|
-
|
1071
|
-
</li>
|
1072
|
-
|
1073
|
-
<li>
|
1074
|
-
|
1075
|
-
<span class='type'>(<tt>Boolean</tt>)</span>
|
1076
|
-
|
1077
|
-
|
1078
|
-
<span class='name'>clobber</span>
|
1079
|
-
|
1080
|
-
|
1081
|
-
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
1082
|
-
|
1083
|
-
|
1084
|
-
—
|
1085
|
-
<div class='inline'>
|
1086
|
-
<p>If the destination already contains the expected file(s), the unpacker
|
1087
|
-
will not run unless <tt>clobber</tt> is true.</p>
|
1088
|
-
</div>
|
1089
|
-
|
1090
|
-
</li>
|
1091
|
-
|
1092
|
-
</ul>
|
1093
|
-
<h3>Returns:</h3>
|
1094
|
-
<ul class="return">
|
1095
|
-
|
1096
|
-
<li>
|
1097
|
-
|
1098
|
-
<span class='type'>(<tt>File</tt>)</span>
|
1099
|
-
|
1100
|
-
|
1101
|
-
|
1102
|
-
|
1103
|
-
—
|
1104
|
-
<div class='inline'>
|
1105
|
-
<p>the file or directory that was created.</p>
|
1106
|
-
</div>
|
1107
|
-
|
1108
|
-
</li>
|
1109
|
-
|
1110
|
-
</ul>
|
1111
|
-
|
1112
|
-
</div><table class="source_code">
|
1113
|
-
<tr>
|
1114
|
-
<td>
|
1115
|
-
<pre class="lines">
|
1116
|
-
|
1117
|
-
|
1118
|
-
49
|
1119
|
-
50
|
1120
|
-
51
|
1121
|
-
52
|
1122
|
-
53
|
1123
|
-
54
|
1124
|
-
55
|
1125
|
-
56
|
1126
|
-
57
|
1127
|
-
58
|
1128
|
-
59
|
1129
|
-
60
|
1130
|
-
61
|
1131
|
-
62
|
1132
|
-
63
|
1133
|
-
64
|
1134
|
-
65
|
1135
|
-
66
|
1136
|
-
67</pre>
|
1137
|
-
</td>
|
1138
|
-
<td>
|
1139
|
-
<pre class="code"><span class="info file"># File 'lib/sprout/archive_unpacker.rb', line 49</span>
|
1140
|
-
|
1141
|
-
<span class='kw'>def</span> <span class='id unpack_zip'>unpack_zip</span> <span class='id archive'>archive</span><span class='comma'>,</span> <span class='id destination'>destination</span><span class='comma'>,</span> <span class='id clobber'>clobber</span><span class='op'>=</span><span class='kw'>nil</span>
|
1142
|
-
<span class='id validate'>validate</span> <span class='id archive'>archive</span><span class='comma'>,</span> <span class='id destination'>destination</span>
|
1143
|
-
|
1144
|
-
<span class='comment'>##
|
1145
|
-
</span> <span class='comment'># As it turns out, the Rubyzip library corrupts
|
1146
|
-
</span> <span class='comment'># binary files (like the Flash Player) on OSX and is also
|
1147
|
-
</span> <span class='comment'># horribly slow for large archives (like the ~120MB Flex SDK)
|
1148
|
-
</span> <span class='comment'># on all platforms.
|
1149
|
-
</span> <span class='kw'>if</span> <span class='id is_darwin?'>is_darwin?</span>
|
1150
|
-
<span class='id unpack_zip_on_darwin'>unpack_zip_on_darwin</span> <span class='id archive'>archive</span><span class='comma'>,</span> <span class='id destination'>destination</span><span class='comma'>,</span> <span class='id clobber'>clobber</span>
|
1151
|
-
<span class='kw'>else</span>
|
1152
|
-
<span class='const'>Zip</span><span class='op'>::</span><span class='const'>ZipFile</span><span class='period'>.</span><span class='id open'>open</span> <span class='id archive'>archive</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id zipfile'>zipfile</span><span class='op'>|</span>
|
1153
|
-
<span class='id zipfile'>zipfile</span><span class='period'>.</span><span class='id each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id entry'>entry</span><span class='op'>|</span>
|
1154
|
-
<span class='kw'>next</span> <span class='kw'>if</span> <span class='id entry'>entry</span><span class='period'>.</span><span class='id name'>name</span> <span class='op'>=~</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>__MACOSX</span><span class='regexp_end'>/</span></span> <span class='kw'>or</span> <span class='id entry'>entry</span><span class='period'>.</span><span class='id name'>name</span> <span class='op'>=~</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>\.DS_Store</span><span class='regexp_end'>/</span></span>
|
1155
|
-
<span class='id unpack_zip_entry'>unpack_zip_entry</span> <span class='id entry'>entry</span><span class='comma'>,</span> <span class='id destination'>destination</span><span class='comma'>,</span> <span class='id clobber'>clobber</span>
|
1156
|
-
<span class='kw'>end</span>
|
1157
|
-
<span class='kw'>end</span>
|
1158
|
-
<span class='kw'>end</span>
|
1159
|
-
<span class='kw'>end</span></pre>
|
1160
|
-
</td>
|
1161
|
-
</tr>
|
1162
|
-
</table>
|
1163
|
-
</div>
|
1164
|
-
|
1165
|
-
<div class="method_details ">
|
1166
|
-
<p class="signature " id="unpack_zip_on_darwin-instance_method">
|
1167
|
-
|
1168
|
-
- (<tt>File</tt>) <strong>unpack_zip_on_darwin</strong>(archive, destination, clobber)
|
1169
|
-
|
1170
|
-
|
1171
|
-
|
1172
|
-
</p><div class="docstring">
|
1173
|
-
<div class="discussion">
|
1174
|
-
|
1175
|
-
<p>Optimization for zip files on OSX. Uses the native 'unzip' utility which is
|
1176
|
-
much faster (and more reliable) than Ruby for large archives (like the
|
1177
|
-
Flex SDK) and binaries that Ruby corrupts (like the Flash Player).</p>
|
1178
|
-
|
1179
|
-
|
1180
|
-
</div>
|
1181
|
-
</div>
|
1182
|
-
<div class="tags">
|
1183
|
-
<h3>Returns:</h3>
|
1184
|
-
<ul class="return">
|
1185
|
-
|
1186
|
-
<li>
|
1187
|
-
|
1188
|
-
<span class='type'>(<tt>File</tt>)</span>
|
1189
|
-
|
1190
|
-
|
1191
|
-
|
1192
|
-
|
1193
|
-
—
|
1194
|
-
<div class='inline'>
|
1195
|
-
<p>the file or directory that was created.</p>
|
1196
|
-
</div>
|
1197
|
-
|
1198
|
-
</li>
|
1199
|
-
|
1200
|
-
</ul>
|
1201
|
-
|
1202
|
-
</div><table class="source_code">
|
1203
|
-
<tr>
|
1204
|
-
<td>
|
1205
|
-
<pre class="lines">
|
1206
|
-
|
1207
|
-
|
1208
|
-
83
|
1209
|
-
84
|
1210
|
-
85
|
1211
|
-
86
|
1212
|
-
87
|
1213
|
-
88
|
1214
|
-
89
|
1215
|
-
90
|
1216
|
-
91</pre>
|
1217
|
-
</td>
|
1218
|
-
<td>
|
1219
|
-
<pre class="code"><span class="info file"># File 'lib/sprout/archive_unpacker.rb', line 83</span>
|
1220
|
-
|
1221
|
-
<span class='kw'>def</span> <span class='id unpack_zip_on_darwin'>unpack_zip_on_darwin</span> <span class='id archive'>archive</span><span class='comma'>,</span> <span class='id destination'>destination</span><span class='comma'>,</span> <span class='id clobber'>clobber</span>
|
1222
|
-
<span class='comment'># Unzipping on OS X
|
1223
|
-
</span> <span class='const'>FileUtils</span><span class='period'>.</span><span class='id makedirs'>makedirs</span> <span class='id destination'>destination</span>
|
1224
|
-
<span class='id zip_dir'>zip_dir</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id expand_path'>expand_path</span> <span class='const'>File</span><span class='period'>.</span><span class='id dirname'>dirname</span><span class='lparen'>(</span><span class='id archive'>archive</span><span class='rparen'>)</span>
|
1225
|
-
<span class='id zip_name'>zip_name</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id basename'>basename</span> <span class='id archive'>archive</span>
|
1226
|
-
<span class='id output'>output</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id expand_path'>expand_path</span> <span class='id destination'>destination</span>
|
1227
|
-
<span class='comment'># puts ">> zip_dir: #{zip_dir} zip_name: #{zip_name} output: #{output}"
|
1228
|
-
</span> <span class='backtick'>%x(</span><span class='tstring_content'>cd </span><span class='embexpr_beg'>#{</span><span class='id zip_dir'>zip_dir</span><span class='rbrace'>}</span><span class='tstring_content'>;unzip </span><span class='embexpr_beg'>#{</span><span class='id zip_name'>zip_name</span><span class='rbrace'>}</span><span class='tstring_content'> -d </span><span class='embexpr_beg'>#{</span><span class='id output'>output</span><span class='rbrace'>}</span><span class='tstring_end'>)</span></span>
|
1229
|
-
<span class='kw'>end</span></pre>
|
1230
|
-
</td>
|
1231
|
-
</tr>
|
1232
|
-
</table>
|
1233
|
-
</div>
|
1234
|
-
|
1235
|
-
</div>
|
1236
|
-
|
1237
|
-
</div>
|
1238
|
-
|
1239
|
-
<div id="footer">
|
1240
|
-
Generated on Fri Apr 29 18:33:08 2011 by
|
1241
|
-
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1242
|
-
0.6.3 (ruby-1.9.2).
|
1243
|
-
</div>
|
1244
|
-
|
1245
|
-
</body>
|
1246
|
-
</html>
|