s3aps 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +6 -0
- data/Gemfile +3 -0
- data/README.rdoc +105 -0
- data/Rakefile +2 -0
- data/bin/s3aps +17 -0
- data/doc/S3aps.html +161 -0
- data/doc/S3aps/FileAdapter.html +335 -0
- data/doc/S3aps/Runner.html +363 -0
- data/doc/S3aps/S3Adapter.html +322 -0
- data/doc/S3aps/Sync.html +380 -0
- data/doc/created.rid +7 -0
- data/doc/index.html +87 -0
- data/doc/lib/s3aps/file_adapter_rb.html +52 -0
- data/doc/lib/s3aps/runner_rb.html +58 -0
- data/doc/lib/s3aps/s3_adapter_rb.html +56 -0
- data/doc/lib/s3aps/sync_rb.html +58 -0
- data/doc/lib/s3aps/version_rb.html +52 -0
- data/doc/lib/s3aps_rb.html +62 -0
- data/doc/rdoc.css +706 -0
- data/lib/s3aps.rb +5 -0
- data/lib/s3aps/file_adapter.rb +58 -0
- data/lib/s3aps/runner.rb +83 -0
- data/lib/s3aps/s3_adapter.rb +40 -0
- data/lib/s3aps/sync.rb +110 -0
- data/lib/s3aps/version.rb +3 -0
- data/s3aps.gemspec +23 -0
- metadata +103 -0
@@ -0,0 +1,363 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
3
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
4
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
5
|
+
<head>
|
6
|
+
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
|
7
|
+
|
8
|
+
<title>Class: S3aps::Runner</title>
|
9
|
+
|
10
|
+
<link rel="stylesheet" href="../rdoc.css" type="text/css" media="screen" />
|
11
|
+
|
12
|
+
<script src="../js/jquery.js" type="text/javascript"
|
13
|
+
charset="utf-8"></script>
|
14
|
+
<script src="../js/thickbox-compressed.js" type="text/javascript"
|
15
|
+
charset="utf-8"></script>
|
16
|
+
<script src="../js/quicksearch.js" type="text/javascript"
|
17
|
+
charset="utf-8"></script>
|
18
|
+
<script src="../js/darkfish.js" type="text/javascript"
|
19
|
+
charset="utf-8"></script>
|
20
|
+
|
21
|
+
</head>
|
22
|
+
<body class="class">
|
23
|
+
|
24
|
+
<div id="metadata">
|
25
|
+
<div id="home-metadata">
|
26
|
+
<div id="home-section" class="section">
|
27
|
+
<h3 class="section-header">
|
28
|
+
<a href="../index.html">Home</a>
|
29
|
+
<a href="../index.html#classes">Classes</a>
|
30
|
+
<a href="../index.html#methods">Methods</a>
|
31
|
+
</h3>
|
32
|
+
</div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="file-metadata">
|
36
|
+
<div id="file-list-section" class="section">
|
37
|
+
<h3 class="section-header">In Files</h3>
|
38
|
+
<div class="section-body">
|
39
|
+
<ul>
|
40
|
+
|
41
|
+
<li><a href="../lib/s3aps/runner_rb.html?TB_iframe=true&height=550&width=785"
|
42
|
+
class="thickbox" title="lib/s3aps/runner.rb">lib/s3aps/runner.rb</a></li>
|
43
|
+
|
44
|
+
</ul>
|
45
|
+
</div>
|
46
|
+
</div>
|
47
|
+
|
48
|
+
|
49
|
+
</div>
|
50
|
+
|
51
|
+
<div id="class-metadata">
|
52
|
+
|
53
|
+
<!-- Parent Class -->
|
54
|
+
|
55
|
+
<div id="parent-class-section" class="section">
|
56
|
+
<h3 class="section-header">Parent</h3>
|
57
|
+
|
58
|
+
<p class="link">Object</p>
|
59
|
+
|
60
|
+
</div>
|
61
|
+
|
62
|
+
|
63
|
+
<!-- Namespace Contents -->
|
64
|
+
|
65
|
+
|
66
|
+
<!-- Method Quickref -->
|
67
|
+
|
68
|
+
<div id="method-list-section" class="section">
|
69
|
+
<h3 class="section-header">Methods</h3>
|
70
|
+
<ul class="link-list">
|
71
|
+
|
72
|
+
<li><a href="#method-c-new">::new</a></li>
|
73
|
+
|
74
|
+
<li><a href="#method-i-list">#list</a></li>
|
75
|
+
|
76
|
+
<li><a href="#method-i-pull">#pull</a></li>
|
77
|
+
|
78
|
+
<li><a href="#method-i-push">#push</a></li>
|
79
|
+
|
80
|
+
</ul>
|
81
|
+
</div>
|
82
|
+
|
83
|
+
|
84
|
+
<!-- Included Modules -->
|
85
|
+
|
86
|
+
</div>
|
87
|
+
|
88
|
+
<div id="project-metadata">
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
<div id="classindex-section" class="section project-section">
|
93
|
+
<h3 class="section-header">Class Index
|
94
|
+
<span class="search-toggle"><img src="../images/find.png"
|
95
|
+
height="16" width="16" alt="[+]"
|
96
|
+
title="show/hide quicksearch" /></span></h3>
|
97
|
+
<form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
|
98
|
+
<fieldset>
|
99
|
+
<legend>Quicksearch</legend>
|
100
|
+
<input type="text" name="quicksearch" value=""
|
101
|
+
class="quicksearch-field" />
|
102
|
+
</fieldset>
|
103
|
+
</form>
|
104
|
+
|
105
|
+
<ul class="link-list">
|
106
|
+
|
107
|
+
<li><a href="../S3aps/FileAdapter.html">S3aps::FileAdapter</a></li>
|
108
|
+
|
109
|
+
<li><a href="../S3aps/Runner.html">S3aps::Runner</a></li>
|
110
|
+
|
111
|
+
<li><a href="../S3aps/S3Adapter.html">S3aps::S3Adapter</a></li>
|
112
|
+
|
113
|
+
<li><a href="../S3aps/Sync.html">S3aps::Sync</a></li>
|
114
|
+
|
115
|
+
</ul>
|
116
|
+
<div id="no-class-search-results" style="display: none;">No matching classes.</div>
|
117
|
+
</div>
|
118
|
+
|
119
|
+
|
120
|
+
</div>
|
121
|
+
</div>
|
122
|
+
|
123
|
+
<div id="documentation">
|
124
|
+
<h1 class="class">S3aps::Runner</h1>
|
125
|
+
|
126
|
+
<div id="description">
|
127
|
+
<p>
|
128
|
+
Allows you to run S3aps from the command line
|
129
|
+
</p>
|
130
|
+
|
131
|
+
</div>
|
132
|
+
|
133
|
+
<!-- Constants -->
|
134
|
+
|
135
|
+
|
136
|
+
<!-- Attributes -->
|
137
|
+
|
138
|
+
<div id="attribute-method-details" class="method-section section">
|
139
|
+
<h3 class="section-header">Attributes</h3>
|
140
|
+
|
141
|
+
|
142
|
+
<div id="argv-attribute-method" class="method-detail">
|
143
|
+
<a name="argv"></a>
|
144
|
+
|
145
|
+
<a name="argv="></a>
|
146
|
+
|
147
|
+
<div class="method-heading attribute-method-heading">
|
148
|
+
<span class="method-name">argv</span><span
|
149
|
+
class="attribute-access-type">[RW]</span>
|
150
|
+
</div>
|
151
|
+
|
152
|
+
<div class="method-description">
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
</div>
|
157
|
+
</div>
|
158
|
+
|
159
|
+
</div>
|
160
|
+
|
161
|
+
|
162
|
+
<!-- Methods -->
|
163
|
+
|
164
|
+
<div id="public-class-method-details" class="method-section section">
|
165
|
+
<h3 class="section-header">Public Class Methods</h3>
|
166
|
+
|
167
|
+
|
168
|
+
<div id="new-method" class="method-detail ">
|
169
|
+
<a name="method-c-new"></a>
|
170
|
+
|
171
|
+
<div class="method-heading">
|
172
|
+
|
173
|
+
<span class="method-name">new</span><span
|
174
|
+
class="method-args">(argv)</span>
|
175
|
+
<span class="method-click-advice">click to toggle source</span>
|
176
|
+
|
177
|
+
</div>
|
178
|
+
|
179
|
+
<div class="method-description">
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
<div class="method-source-code"
|
186
|
+
id="new-source">
|
187
|
+
<pre>
|
188
|
+
<span class="ruby-comment cmt"># File lib/s3aps/runner.rb, line 12</span>
|
189
|
+
12: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">argv</span>)
|
190
|
+
13: <span class="ruby-ivar">@options</span> = {}
|
191
|
+
14: <span class="ruby-ivar">@cmd</span> = <span class="ruby-value">:help</span>
|
192
|
+
15: <span class="ruby-ivar">@option_parser</span> = <span class="ruby-constant">OptionParser</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">o</span><span class="ruby-operator">|</span>
|
193
|
+
16: <span class="ruby-identifier">o</span>.<span class="ruby-identifier">banner</span> = <span class="ruby-value str">S3aps version #{S3aps::VERSION}Usage: s3aps (list|pull|push|version) [OPTIONS] list List files locally and remotely pull Pull new files from remote push Push new files to remote (be careful)</span>
|
194
|
+
17: <span class="ruby-identifier">o</span>.<span class="ruby-identifier">on</span>(<span class="ruby-value str">"-c"</span>, <span class="ruby-value str">"--config FILE"</span>, <span class="ruby-value str">"YAML file containing S3 credentials"</span>) {<span class="ruby-operator">|</span><span class="ruby-identifier">name</span><span class="ruby-operator">|</span> <span class="ruby-ivar">@options</span>[<span class="ruby-value">:config</span>] = <span class="ruby-identifier">name</span> }
|
195
|
+
18: <span class="ruby-identifier">o</span>.<span class="ruby-identifier">on</span>(<span class="ruby-value str">"-e"</span>, <span class="ruby-value str">"--env ENV"</span>, <span class="ruby-value str">"Section of YAML to use"</span>) {<span class="ruby-operator">|</span><span class="ruby-identifier">name</span><span class="ruby-operator">|</span> <span class="ruby-ivar">@options</span>[<span class="ruby-value">:env</span>] = <span class="ruby-identifier">name</span> }
|
196
|
+
19: <span class="ruby-identifier">o</span>.<span class="ruby-identifier">on</span>(<span class="ruby-value str">"-b"</span>, <span class="ruby-value str">"--bucket NAME"</span>, <span class="ruby-value str">"S3 bucket name"</span>) {<span class="ruby-operator">|</span><span class="ruby-identifier">name</span><span class="ruby-operator">|</span> <span class="ruby-ivar">@options</span>[<span class="ruby-value">:bucket</span>] = <span class="ruby-identifier">name</span> }
|
197
|
+
20: <span class="ruby-identifier">o</span>.<span class="ruby-identifier">on</span>(<span class="ruby-value str">"-k"</span>, <span class="ruby-value str">"--key KEY"</span>, <span class="ruby-value str">"S3 access key"</span>) {<span class="ruby-operator">|</span><span class="ruby-identifier">name</span><span class="ruby-operator">|</span> <span class="ruby-ivar">@options</span>[<span class="ruby-value">:key</span>] = <span class="ruby-identifier">name</span> }
|
198
|
+
21: <span class="ruby-identifier">o</span>.<span class="ruby-identifier">on</span>(<span class="ruby-value str">"-s"</span>, <span class="ruby-value str">"--secret KEY"</span>, <span class="ruby-value str">"S3 secret key"</span>) {<span class="ruby-operator">|</span><span class="ruby-identifier">name</span><span class="ruby-operator">|</span> <span class="ruby-ivar">@options</span>[<span class="ruby-value">:secret</span>] = <span class="ruby-identifier">name</span> }
|
199
|
+
22: <span class="ruby-identifier">o</span>.<span class="ruby-identifier">on</span>(<span class="ruby-value str">"-p"</span>, <span class="ruby-value str">"--path PATH"</span>, <span class="ruby-value str">"Local path"</span>) {<span class="ruby-operator">|</span><span class="ruby-identifier">name</span><span class="ruby-operator">|</span> <span class="ruby-ivar">@options</span>[<span class="ruby-value">:path</span>] = <span class="ruby-identifier">name</span> }
|
200
|
+
23: <span class="ruby-identifier">o</span>.<span class="ruby-identifier">parse!</span>(<span class="ruby-identifier">argv</span>)
|
201
|
+
24: <span class="ruby-keyword kw">end</span>
|
202
|
+
25: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">argv</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span> <span class="ruby-operator">&&</span> <span class="ruby-node">%(list push pull version)</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">argv</span>.<span class="ruby-identifier">first</span>)
|
203
|
+
26: <span class="ruby-ivar">@sync</span> = <span class="ruby-constant">S3aps</span><span class="ruby-operator">::</span><span class="ruby-constant">Sync</span>.<span class="ruby-identifier">new</span> <span class="ruby-ivar">@options</span>
|
204
|
+
27: <span class="ruby-ivar">@cmd</span> = <span class="ruby-identifier">argv</span>.<span class="ruby-identifier">first</span>
|
205
|
+
28: <span class="ruby-keyword kw">end</span>
|
206
|
+
29: <span class="ruby-keyword kw">end</span></pre>
|
207
|
+
</div>
|
208
|
+
|
209
|
+
</div>
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
|
214
|
+
</div>
|
215
|
+
|
216
|
+
|
217
|
+
</div>
|
218
|
+
|
219
|
+
<div id="public-instance-method-details" class="method-section section">
|
220
|
+
<h3 class="section-header">Public Instance Methods</h3>
|
221
|
+
|
222
|
+
|
223
|
+
<div id="list-method" class="method-detail ">
|
224
|
+
<a name="method-i-list"></a>
|
225
|
+
|
226
|
+
<div class="method-heading">
|
227
|
+
|
228
|
+
<span class="method-name">list</span><span
|
229
|
+
class="method-args">()</span>
|
230
|
+
<span class="method-click-advice">click to toggle source</span>
|
231
|
+
|
232
|
+
</div>
|
233
|
+
|
234
|
+
<div class="method-description">
|
235
|
+
|
236
|
+
<p>
|
237
|
+
Prints out a list of all remote and local files and shows which ones are
|
238
|
+
remote, local or both.
|
239
|
+
</p>
|
240
|
+
|
241
|
+
|
242
|
+
|
243
|
+
<div class="method-source-code"
|
244
|
+
id="list-source">
|
245
|
+
<pre>
|
246
|
+
<span class="ruby-comment cmt"># File lib/s3aps/runner.rb, line 53</span>
|
247
|
+
53: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">list</span>
|
248
|
+
54: <span class="ruby-identifier">array</span> = <span class="ruby-ivar">@sync</span>.<span class="ruby-identifier">list</span>
|
249
|
+
55: <span class="ruby-identifier">local_count</span> = <span class="ruby-value">0</span>
|
250
|
+
56: <span class="ruby-identifier">remote_count</span> = <span class="ruby-value">0</span>
|
251
|
+
57: <span class="ruby-identifier">array</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">item</span><span class="ruby-operator">|</span>
|
252
|
+
58: <span class="ruby-identifier">line</span> = <span class="ruby-identifier">item</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">' '</span>)
|
253
|
+
59: <span class="ruby-identifier">local_count</span> <span class="ruby-operator">+=</span><span class="ruby-value">1</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">line</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^L\s\s/</span>
|
254
|
+
60: <span class="ruby-identifier">remote_count</span> <span class="ruby-operator">+=</span><span class="ruby-value">1</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">line</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^\s\sR/</span>
|
255
|
+
61: <span class="ruby-identifier">puts</span> <span class="ruby-identifier">item</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">' '</span>)
|
256
|
+
62: <span class="ruby-keyword kw">end</span>
|
257
|
+
63: <span class="ruby-identifier">puts</span> <span class="ruby-node">"Found #{array.size} file(s): #{local_count} local only, #{remote_count} remote only, #{array.size - local_count - remote_count} common."</span>
|
258
|
+
64: <span class="ruby-keyword kw">end</span></pre>
|
259
|
+
</div>
|
260
|
+
|
261
|
+
</div>
|
262
|
+
|
263
|
+
|
264
|
+
|
265
|
+
|
266
|
+
</div>
|
267
|
+
|
268
|
+
|
269
|
+
<div id="pull-method" class="method-detail ">
|
270
|
+
<a name="method-i-pull"></a>
|
271
|
+
|
272
|
+
<div class="method-heading">
|
273
|
+
|
274
|
+
<span class="method-name">pull</span><span
|
275
|
+
class="method-args">()</span>
|
276
|
+
<span class="method-click-advice">click to toggle source</span>
|
277
|
+
|
278
|
+
</div>
|
279
|
+
|
280
|
+
<div class="method-description">
|
281
|
+
|
282
|
+
<p>
|
283
|
+
Pull files from S3
|
284
|
+
</p>
|
285
|
+
|
286
|
+
|
287
|
+
|
288
|
+
<div class="method-source-code"
|
289
|
+
id="pull-source">
|
290
|
+
<pre>
|
291
|
+
<span class="ruby-comment cmt"># File lib/s3aps/runner.rb, line 67</span>
|
292
|
+
67: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pull</span>
|
293
|
+
68: <span class="ruby-identifier">count</span>, <span class="ruby-identifier">total</span> = <span class="ruby-ivar">@sync</span>.<span class="ruby-identifier">pull</span>
|
294
|
+
69: <span class="ruby-identifier">puts</span> <span class="ruby-node">"\nPulled #{count}/#{total} file#{'s' unless count == 1} from S3"</span>
|
295
|
+
70: <span class="ruby-keyword kw">end</span></pre>
|
296
|
+
</div>
|
297
|
+
|
298
|
+
</div>
|
299
|
+
|
300
|
+
|
301
|
+
|
302
|
+
|
303
|
+
</div>
|
304
|
+
|
305
|
+
|
306
|
+
<div id="push-method" class="method-detail ">
|
307
|
+
<a name="method-i-push"></a>
|
308
|
+
|
309
|
+
<div class="method-heading">
|
310
|
+
|
311
|
+
<span class="method-name">push</span><span
|
312
|
+
class="method-args">()</span>
|
313
|
+
<span class="method-click-advice">click to toggle source</span>
|
314
|
+
|
315
|
+
</div>
|
316
|
+
|
317
|
+
<div class="method-description">
|
318
|
+
|
319
|
+
<p>
|
320
|
+
Push files to S3
|
321
|
+
</p>
|
322
|
+
|
323
|
+
|
324
|
+
|
325
|
+
<div class="method-source-code"
|
326
|
+
id="push-source">
|
327
|
+
<pre>
|
328
|
+
<span class="ruby-comment cmt"># File lib/s3aps/runner.rb, line 73</span>
|
329
|
+
73: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">push</span>
|
330
|
+
74: <span class="ruby-identifier">count</span>, <span class="ruby-identifier">total</span> = <span class="ruby-ivar">@sync</span>.<span class="ruby-identifier">push</span>
|
331
|
+
75: <span class="ruby-identifier">puts</span> <span class="ruby-node">"\nPushed #{count} file#{'s' unless count == 1} to S3"</span>
|
332
|
+
76: <span class="ruby-keyword kw">end</span></pre>
|
333
|
+
</div>
|
334
|
+
|
335
|
+
</div>
|
336
|
+
|
337
|
+
|
338
|
+
|
339
|
+
|
340
|
+
</div>
|
341
|
+
|
342
|
+
|
343
|
+
</div>
|
344
|
+
|
345
|
+
|
346
|
+
</div>
|
347
|
+
|
348
|
+
|
349
|
+
<div id="rdoc-debugging-section-dump" class="debugging-section">
|
350
|
+
|
351
|
+
<p>Disabled; run with --debug to generate this.</p>
|
352
|
+
|
353
|
+
</div>
|
354
|
+
|
355
|
+
<div id="validator-badges">
|
356
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
357
|
+
<p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
|
358
|
+
Rdoc Generator</a> 1.1.6</small>.</p>
|
359
|
+
</div>
|
360
|
+
|
361
|
+
</body>
|
362
|
+
</html>
|
363
|
+
|
@@ -0,0 +1,322 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
3
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
4
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
5
|
+
<head>
|
6
|
+
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
|
7
|
+
|
8
|
+
<title>Class: S3aps::S3Adapter</title>
|
9
|
+
|
10
|
+
<link rel="stylesheet" href="../rdoc.css" type="text/css" media="screen" />
|
11
|
+
|
12
|
+
<script src="../js/jquery.js" type="text/javascript"
|
13
|
+
charset="utf-8"></script>
|
14
|
+
<script src="../js/thickbox-compressed.js" type="text/javascript"
|
15
|
+
charset="utf-8"></script>
|
16
|
+
<script src="../js/quicksearch.js" type="text/javascript"
|
17
|
+
charset="utf-8"></script>
|
18
|
+
<script src="../js/darkfish.js" type="text/javascript"
|
19
|
+
charset="utf-8"></script>
|
20
|
+
|
21
|
+
</head>
|
22
|
+
<body class="class">
|
23
|
+
|
24
|
+
<div id="metadata">
|
25
|
+
<div id="home-metadata">
|
26
|
+
<div id="home-section" class="section">
|
27
|
+
<h3 class="section-header">
|
28
|
+
<a href="../index.html">Home</a>
|
29
|
+
<a href="../index.html#classes">Classes</a>
|
30
|
+
<a href="../index.html#methods">Methods</a>
|
31
|
+
</h3>
|
32
|
+
</div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="file-metadata">
|
36
|
+
<div id="file-list-section" class="section">
|
37
|
+
<h3 class="section-header">In Files</h3>
|
38
|
+
<div class="section-body">
|
39
|
+
<ul>
|
40
|
+
|
41
|
+
<li><a href="../lib/s3aps/s3_adapter_rb.html?TB_iframe=true&height=550&width=785"
|
42
|
+
class="thickbox" title="lib/s3aps/s3_adapter.rb">lib/s3aps/s3_adapter.rb</a></li>
|
43
|
+
|
44
|
+
</ul>
|
45
|
+
</div>
|
46
|
+
</div>
|
47
|
+
|
48
|
+
|
49
|
+
</div>
|
50
|
+
|
51
|
+
<div id="class-metadata">
|
52
|
+
|
53
|
+
<!-- Parent Class -->
|
54
|
+
|
55
|
+
<div id="parent-class-section" class="section">
|
56
|
+
<h3 class="section-header">Parent</h3>
|
57
|
+
|
58
|
+
<p class="link">Object</p>
|
59
|
+
|
60
|
+
</div>
|
61
|
+
|
62
|
+
|
63
|
+
<!-- Namespace Contents -->
|
64
|
+
|
65
|
+
|
66
|
+
<!-- Method Quickref -->
|
67
|
+
|
68
|
+
<div id="method-list-section" class="section">
|
69
|
+
<h3 class="section-header">Methods</h3>
|
70
|
+
<ul class="link-list">
|
71
|
+
|
72
|
+
<li><a href="#method-c-new">::new</a></li>
|
73
|
+
|
74
|
+
<li><a href="#method-i-list">#list</a></li>
|
75
|
+
|
76
|
+
<li><a href="#method-i-read">#read</a></li>
|
77
|
+
|
78
|
+
<li><a href="#method-i-write">#write</a></li>
|
79
|
+
|
80
|
+
</ul>
|
81
|
+
</div>
|
82
|
+
|
83
|
+
|
84
|
+
<!-- Included Modules -->
|
85
|
+
|
86
|
+
</div>
|
87
|
+
|
88
|
+
<div id="project-metadata">
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
<div id="classindex-section" class="section project-section">
|
93
|
+
<h3 class="section-header">Class Index
|
94
|
+
<span class="search-toggle"><img src="../images/find.png"
|
95
|
+
height="16" width="16" alt="[+]"
|
96
|
+
title="show/hide quicksearch" /></span></h3>
|
97
|
+
<form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
|
98
|
+
<fieldset>
|
99
|
+
<legend>Quicksearch</legend>
|
100
|
+
<input type="text" name="quicksearch" value=""
|
101
|
+
class="quicksearch-field" />
|
102
|
+
</fieldset>
|
103
|
+
</form>
|
104
|
+
|
105
|
+
<ul class="link-list">
|
106
|
+
|
107
|
+
<li><a href="../S3aps/FileAdapter.html">S3aps::FileAdapter</a></li>
|
108
|
+
|
109
|
+
<li><a href="../S3aps/Runner.html">S3aps::Runner</a></li>
|
110
|
+
|
111
|
+
<li><a href="../S3aps/S3Adapter.html">S3aps::S3Adapter</a></li>
|
112
|
+
|
113
|
+
<li><a href="../S3aps/Sync.html">S3aps::Sync</a></li>
|
114
|
+
|
115
|
+
</ul>
|
116
|
+
<div id="no-class-search-results" style="display: none;">No matching classes.</div>
|
117
|
+
</div>
|
118
|
+
|
119
|
+
|
120
|
+
</div>
|
121
|
+
</div>
|
122
|
+
|
123
|
+
<div id="documentation">
|
124
|
+
<h1 class="class">S3aps::S3Adapter</h1>
|
125
|
+
|
126
|
+
<div id="description">
|
127
|
+
<p>
|
128
|
+
Reads, writes and lists files on S3.
|
129
|
+
</p>
|
130
|
+
|
131
|
+
</div>
|
132
|
+
|
133
|
+
<!-- Constants -->
|
134
|
+
|
135
|
+
|
136
|
+
<!-- Attributes -->
|
137
|
+
|
138
|
+
|
139
|
+
<!-- Methods -->
|
140
|
+
|
141
|
+
<div id="public-class-method-details" class="method-section section">
|
142
|
+
<h3 class="section-header">Public Class Methods</h3>
|
143
|
+
|
144
|
+
|
145
|
+
<div id="new-method" class="method-detail ">
|
146
|
+
<a name="method-c-new"></a>
|
147
|
+
|
148
|
+
<div class="method-heading">
|
149
|
+
|
150
|
+
<span class="method-name">new</span><span
|
151
|
+
class="method-args">(options)</span>
|
152
|
+
<span class="method-click-advice">click to toggle source</span>
|
153
|
+
|
154
|
+
</div>
|
155
|
+
|
156
|
+
<div class="method-description">
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
|
162
|
+
<div class="method-source-code"
|
163
|
+
id="new-source">
|
164
|
+
<pre>
|
165
|
+
<span class="ruby-comment cmt"># File lib/s3aps/s3_adapter.rb, line 9</span>
|
166
|
+
9: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">options</span>)
|
167
|
+
10: <span class="ruby-ivar">@s3</span> = <span class="ruby-constant">RightAws</span><span class="ruby-operator">::</span><span class="ruby-constant">S3Interface</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">options</span>[<span class="ruby-value">:key</span>], <span class="ruby-identifier">options</span>[<span class="ruby-value">:secret</span>], <span class="ruby-value">:protocol</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'http'</span>, <span class="ruby-value">:port</span> =<span class="ruby-operator">></span> <span class="ruby-value">80</span>)
|
168
|
+
11: <span class="ruby-ivar">@bucket_name</span> = <span class="ruby-identifier">options</span>[<span class="ruby-value">:bucket</span>]
|
169
|
+
12: <span class="ruby-keyword kw">end</span></pre>
|
170
|
+
</div>
|
171
|
+
|
172
|
+
</div>
|
173
|
+
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
</div>
|
178
|
+
|
179
|
+
|
180
|
+
</div>
|
181
|
+
|
182
|
+
<div id="public-instance-method-details" class="method-section section">
|
183
|
+
<h3 class="section-header">Public Instance Methods</h3>
|
184
|
+
|
185
|
+
|
186
|
+
<div id="list-method" class="method-detail ">
|
187
|
+
<a name="method-i-list"></a>
|
188
|
+
|
189
|
+
<div class="method-heading">
|
190
|
+
|
191
|
+
<span class="method-name">list</span><span
|
192
|
+
class="method-args">()</span>
|
193
|
+
<span class="method-click-advice">click to toggle source</span>
|
194
|
+
|
195
|
+
</div>
|
196
|
+
|
197
|
+
<div class="method-description">
|
198
|
+
|
199
|
+
<p>
|
200
|
+
List the keys of all files in the bucket
|
201
|
+
</p>
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
<div class="method-source-code"
|
206
|
+
id="list-source">
|
207
|
+
<pre>
|
208
|
+
<span class="ruby-comment cmt"># File lib/s3aps/s3_adapter.rb, line 15</span>
|
209
|
+
15: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">list</span>
|
210
|
+
16: <span class="ruby-identifier">keys</span> = []
|
211
|
+
17: <span class="ruby-ivar">@s3</span>.<span class="ruby-identifier">incrementally_list_bucket</span>(<span class="ruby-ivar">@bucket_name</span>) {<span class="ruby-operator">|</span><span class="ruby-identifier">key_set</span><span class="ruby-operator">|</span>
|
212
|
+
18: <span class="ruby-identifier">keys</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">key_set</span>[<span class="ruby-value">:contents</span>].<span class="ruby-identifier">map</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">key</span><span class="ruby-operator">|</span>
|
213
|
+
19: <span class="ruby-identifier">key</span>
|
214
|
+
20: }
|
215
|
+
21: }
|
216
|
+
22: <span class="ruby-identifier">keys</span>.<span class="ruby-identifier">flatten</span>
|
217
|
+
23: <span class="ruby-keyword kw">end</span></pre>
|
218
|
+
</div>
|
219
|
+
|
220
|
+
</div>
|
221
|
+
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
</div>
|
226
|
+
|
227
|
+
|
228
|
+
<div id="read-method" class="method-detail ">
|
229
|
+
<a name="method-i-read"></a>
|
230
|
+
|
231
|
+
<div class="method-heading">
|
232
|
+
|
233
|
+
<span class="method-name">read</span><span
|
234
|
+
class="method-args">(key)</span>
|
235
|
+
<span class="method-click-advice">click to toggle source</span>
|
236
|
+
|
237
|
+
</div>
|
238
|
+
|
239
|
+
<div class="method-description">
|
240
|
+
|
241
|
+
|
242
|
+
|
243
|
+
|
244
|
+
|
245
|
+
<div class="method-source-code"
|
246
|
+
id="read-source">
|
247
|
+
<pre>
|
248
|
+
<span class="ruby-comment cmt"># File lib/s3aps/s3_adapter.rb, line 30</span>
|
249
|
+
30: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">read</span>(<span class="ruby-identifier">key</span>)
|
250
|
+
31: <span class="ruby-keyword kw">begin</span>
|
251
|
+
32: <span class="ruby-ivar">@s3</span>.<span class="ruby-identifier">get_object</span>(<span class="ruby-ivar">@bucket_name</span>, <span class="ruby-identifier">key</span>)
|
252
|
+
33: <span class="ruby-keyword kw">rescue</span>
|
253
|
+
34: <span class="ruby-identifier">raise</span> <span class="ruby-identifier">exc</span>
|
254
|
+
35: <span class="ruby-keyword kw">end</span>
|
255
|
+
36: <span class="ruby-keyword kw">end</span></pre>
|
256
|
+
</div>
|
257
|
+
|
258
|
+
</div>
|
259
|
+
|
260
|
+
|
261
|
+
|
262
|
+
|
263
|
+
</div>
|
264
|
+
|
265
|
+
|
266
|
+
<div id="write-method" class="method-detail ">
|
267
|
+
<a name="method-i-write"></a>
|
268
|
+
|
269
|
+
<div class="method-heading">
|
270
|
+
|
271
|
+
<span class="method-name">write</span><span
|
272
|
+
class="method-args">(s3_name, value)</span>
|
273
|
+
<span class="method-click-advice">click to toggle source</span>
|
274
|
+
|
275
|
+
</div>
|
276
|
+
|
277
|
+
<div class="method-description">
|
278
|
+
|
279
|
+
<p>
|
280
|
+
Write a value, potentially overwriting what is already there.
|
281
|
+
</p>
|
282
|
+
|
283
|
+
|
284
|
+
|
285
|
+
<div class="method-source-code"
|
286
|
+
id="write-source">
|
287
|
+
<pre>
|
288
|
+
<span class="ruby-comment cmt"># File lib/s3aps/s3_adapter.rb, line 26</span>
|
289
|
+
26: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">write</span>(<span class="ruby-identifier">s3_name</span>, <span class="ruby-identifier">value</span>)
|
290
|
+
27: <span class="ruby-ivar">@s3</span>.<span class="ruby-identifier">put</span>(<span class="ruby-ivar">@bucket_name</span>, <span class="ruby-identifier">s3_name</span>, <span class="ruby-identifier">value</span>)
|
291
|
+
28: <span class="ruby-keyword kw">end</span></pre>
|
292
|
+
</div>
|
293
|
+
|
294
|
+
</div>
|
295
|
+
|
296
|
+
|
297
|
+
|
298
|
+
|
299
|
+
</div>
|
300
|
+
|
301
|
+
|
302
|
+
</div>
|
303
|
+
|
304
|
+
|
305
|
+
</div>
|
306
|
+
|
307
|
+
|
308
|
+
<div id="rdoc-debugging-section-dump" class="debugging-section">
|
309
|
+
|
310
|
+
<p>Disabled; run with --debug to generate this.</p>
|
311
|
+
|
312
|
+
</div>
|
313
|
+
|
314
|
+
<div id="validator-badges">
|
315
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
316
|
+
<p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
|
317
|
+
Rdoc Generator</a> 1.1.6</small>.</p>
|
318
|
+
</div>
|
319
|
+
|
320
|
+
</body>
|
321
|
+
</html>
|
322
|
+
|