swift-manager 0.0.4
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/.gitignore +2 -0
- data/Gemfile +19 -0
- data/LICENSE +201 -0
- data/README.md +56 -0
- data/README.rdoc +8 -0
- data/Rakefile +38 -0
- data/bin/swift-manager +337 -0
- data/docs/examples.txt +407 -0
- data/html/CloudShell.html +308 -0
- data/html/CloudShell/Context.html +403 -0
- data/html/Configurator.html +270 -0
- data/html/Formatter.html +272 -0
- data/html/Object.html +165 -0
- data/html/Parser.html +291 -0
- data/html/README_rdoc.html +102 -0
- data/html/SwiftClient.html +656 -0
- data/html/SwiftManager.html +181 -0
- data/html/bin/swift-manager.html +103 -0
- data/html/created.rid +9 -0
- data/html/images/brick.png +0 -0
- data/html/images/brick_link.png +0 -0
- data/html/images/bug.png +0 -0
- data/html/images/bullet_black.png +0 -0
- data/html/images/bullet_toggle_minus.png +0 -0
- data/html/images/bullet_toggle_plus.png +0 -0
- data/html/images/date.png +0 -0
- data/html/images/find.png +0 -0
- data/html/images/loadingAnimation.gif +0 -0
- data/html/images/macFFBgHack.png +0 -0
- data/html/images/package.png +0 -0
- data/html/images/page_green.png +0 -0
- data/html/images/page_white_text.png +0 -0
- data/html/images/page_white_width.png +0 -0
- data/html/images/plugin.png +0 -0
- data/html/images/ruby.png +0 -0
- data/html/images/tag_green.png +0 -0
- data/html/images/wrench.png +0 -0
- data/html/images/wrench_orange.png +0 -0
- data/html/images/zoom.png +0 -0
- data/html/index.html +119 -0
- data/html/js/darkfish.js +116 -0
- data/html/js/jquery.js +32 -0
- data/html/js/quicksearch.js +114 -0
- data/html/js/thickbox-compressed.js +10 -0
- data/html/lib/cloud_shell_rb.html +75 -0
- data/html/lib/configurator_rb.html +75 -0
- data/html/lib/formatter_rb.html +75 -0
- data/html/lib/parser_rb.html +75 -0
- data/html/lib/swift-manager_version_rb.html +75 -0
- data/html/lib/swift_client_rb.html +75 -0
- data/html/rdoc.css +763 -0
- data/lib/cloud_shell.rb +127 -0
- data/lib/configurator.rb +69 -0
- data/lib/formatter.rb +42 -0
- data/lib/parser.rb +60 -0
- data/lib/swift-manager_version.rb +21 -0
- data/lib/swift_client.rb +172 -0
- data/swift-manager.gemspec +48 -0
- data/swift-manager.rdoc +2 -0
- data/test/tc_nothing.rb +14 -0
- metadata +174 -0
data/docs/examples.txt
ADDED
@@ -0,0 +1,407 @@
|
|
1
|
+
➜ ~ swift-manager
|
2
|
+
|
3
|
+
[ OpenStack Swift Manager ]
|
4
|
+
|
5
|
+
usage: swift-manager [global options] command [command options]
|
6
|
+
|
7
|
+
Version: 0.0.3
|
8
|
+
|
9
|
+
Global Options:
|
10
|
+
--help - Show this message
|
11
|
+
|
12
|
+
Commands:
|
13
|
+
create - Create Object Storage
|
14
|
+
delete - Delete Object Storage
|
15
|
+
generate - Generate auth configurations
|
16
|
+
help - Shows list of commands or help for one command
|
17
|
+
list - List: configs, storage. Read examples.txt for more information
|
18
|
+
run - Run batch jobs. Type 'swift-manager help run' to see options
|
19
|
+
shell - Interactive Shell (Read-Only)
|
20
|
+
show - Show Configuration Parameters
|
21
|
+
➜ ~
|
22
|
+
|
23
|
+
INSTALL:
|
24
|
+
|
25
|
+
gem install swift-manager
|
26
|
+
|
27
|
+
|
28
|
+
CREATING AN AUTH CONFIG:
|
29
|
+
|
30
|
+
➜ ~ swift-manager help generate
|
31
|
+
|
32
|
+
generate [command options] config
|
33
|
+
Generate auth configurations
|
34
|
+
|
35
|
+
Command Options:
|
36
|
+
-a, --access_key_id=arg - Access Key ID or Swift Username: <user>:<user>
|
37
|
+
-i, --ip=arg - Auth URL ip address: Swift
|
38
|
+
-k, --secret_access_key=arg - Secret Access Key or Swift API Key
|
39
|
+
-p, --provider=arg - Provider: aws, rackspace (for swift)
|
40
|
+
-s, --service=arg - Service: s3, swift
|
41
|
+
-t, --type=arg - Type: auth
|
42
|
+
--tag=arg - Tag: Assign a tag for later use
|
43
|
+
➜ ~
|
44
|
+
|
45
|
+
➜ ~ swift-manager generate config -t auth -a test:tester -i 172.16.75.133 -k testing -p rackspace -s swift --tag=swift1
|
46
|
+
|
47
|
+
Looks like this is the first time you are running swift-manager. Let's setup the env...
|
48
|
+
|
49
|
+
|
50
|
+
[##########################################################################################################################] [100/100] [100%] [00:00] [00:00] [162.72/s]
|
51
|
+
|
52
|
+
Adding authentication info to /Users/rajum/.swift-manager/authentication/auth_config_swift1.json
|
53
|
+
|
54
|
+
➜ ~
|
55
|
+
|
56
|
+
|
57
|
+
LIST AVAILABLE AUTH CONFIGS:
|
58
|
+
|
59
|
+
➜ ~ swift-manager help list
|
60
|
+
|
61
|
+
list [command options] config, storage
|
62
|
+
List: configs, storage. Read examples.txt for more information
|
63
|
+
|
64
|
+
Command Options:
|
65
|
+
-f, --file=arg - Authentication file (auth_file.json)
|
66
|
+
-i, --item=arg - Item: container, files
|
67
|
+
-n, --name=arg - Name: container name used only when listing files
|
68
|
+
-t, --type=arg - Type: auth, s3, swift
|
69
|
+
➜ ~
|
70
|
+
|
71
|
+
|
72
|
+
➜ ~ swift-manager list config -t auth
|
73
|
+
|
74
|
+
+--------------------+
|
75
|
+
| Auth Config |
|
76
|
+
+--------------------+
|
77
|
+
| auth_config_swift1 |
|
78
|
+
+--------------------+
|
79
|
+
|
80
|
+
➜ ~
|
81
|
+
|
82
|
+
SHOW AUTH CONFIG PARAMETERS:
|
83
|
+
|
84
|
+
➜ swift-manager help show
|
85
|
+
|
86
|
+
show [command options] config
|
87
|
+
Show Configuration Parameters
|
88
|
+
|
89
|
+
Command Options:
|
90
|
+
-f, --file=arg - File: config file
|
91
|
+
-t, --type=arg - Type: auth
|
92
|
+
|
93
|
+
|
94
|
+
➜ swift-manager show config -t auth -f auth_config_swift1
|
95
|
+
|
96
|
+
+--------+-----------+---------+-------------------+---------------+---------------+
|
97
|
+
| Tag | Provider | Service | Secret Access Key | Access Key ID | Auth URL IP |
|
98
|
+
+--------+-----------+---------+-------------------+---------------+---------------+
|
99
|
+
| swift1 | rackspace | swift | testing | test:tester | 172.16.75.133 |
|
100
|
+
+--------+-----------+---------+-------------------+---------------+---------------+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
CREATE A CONTAINER:
|
106
|
+
|
107
|
+
➜ ~ swift-manager help create
|
108
|
+
|
109
|
+
create [command options] storage
|
110
|
+
Create Object Storage
|
111
|
+
|
112
|
+
Command Options:
|
113
|
+
-f, --file=arg - Auth Config
|
114
|
+
-i, --item=arg - Item: container, file
|
115
|
+
-n, --name=arg - Name: a prefix for the container. The result will be [prefix+timestamp] to be unique
|
116
|
+
-t, --type=arg - Type: s3 or swift
|
117
|
+
➜ ~
|
118
|
+
|
119
|
+
➜ ~ swift-manager create storage -f auth_config_swift1 -i container -n appliv -t swift
|
120
|
+
|
121
|
+
Connecting to OpenStack Swift...
|
122
|
+
|
123
|
+
+-------+-------+-------------------+
|
124
|
+
| bytes | count | key |
|
125
|
+
+-------+-------+-------------------+
|
126
|
+
| 0 | 0 | appliv-1333979649 |
|
127
|
+
+-------+-------+-------------------+
|
128
|
+
|
129
|
+
+-------+-------+-------------------+
|
130
|
+
| bytes | count | key |
|
131
|
+
+-------+-------+-------------------+
|
132
|
+
| 0 | 0 | appliv-1333979649 |
|
133
|
+
+-------+-------+-------------------+
|
134
|
+
➜ ~
|
135
|
+
|
136
|
+
|
137
|
+
CREATING 5 MORE CONTAINERS:
|
138
|
+
|
139
|
+
➜ ~ swift-manager help run
|
140
|
+
|
141
|
+
run [command options] job
|
142
|
+
Run batch jobs. Type 'swift-manager help run' to see options
|
143
|
+
|
144
|
+
Command Options:
|
145
|
+
-d, --destination=arg - Name of container to backup to. Run 'swift-manager list storage -t s3 -f <auth> -i container'
|
146
|
+
-f, --file=arg - Auth Config
|
147
|
+
-j, --job=arg - Job: clean, create-containers, create-objects
|
148
|
+
-n, --number=arg - N number
|
149
|
+
-p, --prefix=arg - Prefix for containers or files
|
150
|
+
-s, --source=arg - Source: Path to local directory containing the files. Make sure to include "" for the path
|
151
|
+
-t, --type=arg - Type: s3, swift
|
152
|
+
|
153
|
+
|
154
|
+
➜ ~ swift-manager run job -j create-containers -f auth_config_swift1 -t swift -n 5 -p appliv
|
155
|
+
|
156
|
+
Connecting to OpenStack Swift...
|
157
|
+
|
158
|
+
Creating 5 containers...please wait
|
159
|
+
+-------+-------+-------------------+
|
160
|
+
| bytes | count | key |
|
161
|
+
+-------+-------+-------------------+
|
162
|
+
| 0 | 0 | appliv-1333979649 |
|
163
|
+
+-------+-------+-------------------+
|
164
|
+
| 0 | 0 | appliv-1333979802 |
|
165
|
+
+-------+-------+-------------------+
|
166
|
+
|
167
|
+
Time elapsed to create 1 containers: 1.1871819496154785 seconds
|
168
|
+
+-------+-------+-------------------+
|
169
|
+
| bytes | count | key |
|
170
|
+
+-------+-------+-------------------+
|
171
|
+
| 0 | 0 | appliv-1333979649 |
|
172
|
+
+-------+-------+-------------------+
|
173
|
+
| 0 | 0 | appliv-1333979802 |
|
174
|
+
+-------+-------+-------------------+
|
175
|
+
| 0 | 0 | appliv-1333979803 |
|
176
|
+
+-------+-------+-------------------+
|
177
|
+
|
178
|
+
Time elapsed to create 2 containers: 2.3424289226531982 seconds
|
179
|
+
+-------+-------+-------------------+
|
180
|
+
| bytes | count | key |
|
181
|
+
+-------+-------+-------------------+
|
182
|
+
| 0 | 0 | appliv-1333979649 |
|
183
|
+
+-------+-------+-------------------+
|
184
|
+
| 0 | 0 | appliv-1333979802 |
|
185
|
+
+-------+-------+-------------------+
|
186
|
+
| 0 | 0 | appliv-1333979803 |
|
187
|
+
+-------+-------+-------------------+
|
188
|
+
| 0 | 0 | appliv-1333979805 |
|
189
|
+
+-------+-------+-------------------+
|
190
|
+
|
191
|
+
Time elapsed to create 3 containers: 3.4233920574188232 seconds
|
192
|
+
+-------+-------+-------------------+
|
193
|
+
| bytes | count | key |
|
194
|
+
+-------+-------+-------------------+
|
195
|
+
| 0 | 0 | appliv-1333979649 |
|
196
|
+
+-------+-------+-------------------+
|
197
|
+
| 0 | 0 | appliv-1333979802 |
|
198
|
+
+-------+-------+-------------------+
|
199
|
+
| 0 | 0 | appliv-1333979803 |
|
200
|
+
+-------+-------+-------------------+
|
201
|
+
| 0 | 0 | appliv-1333979805 |
|
202
|
+
+-------+-------+-------------------+
|
203
|
+
| 0 | 0 | appliv-1333979806 |
|
204
|
+
+-------+-------+-------------------+
|
205
|
+
|
206
|
+
Time elapsed to create 4 containers: 4.517287015914917 seconds
|
207
|
+
+-------+-------+-------------------+
|
208
|
+
| bytes | count | key |
|
209
|
+
+-------+-------+-------------------+
|
210
|
+
| 0 | 0 | appliv-1333979649 |
|
211
|
+
+-------+-------+-------------------+
|
212
|
+
| 0 | 0 | appliv-1333979802 |
|
213
|
+
+-------+-------+-------------------+
|
214
|
+
| 0 | 0 | appliv-1333979803 |
|
215
|
+
+-------+-------+-------------------+
|
216
|
+
| 0 | 0 | appliv-1333979805 |
|
217
|
+
+-------+-------+-------------------+
|
218
|
+
| 0 | 0 | appliv-1333979806 |
|
219
|
+
+-------+-------+-------------------+
|
220
|
+
| 0 | 0 | appliv-1333979807 |
|
221
|
+
+-------+-------+-------------------+
|
222
|
+
|
223
|
+
Time elapsed to create 5 containers: 5.588828086853027 seconds
|
224
|
+
|
225
|
+
Create containers completed
|
226
|
+
|
227
|
+
➜ ~
|
228
|
+
|
229
|
+
UPLOAD OBJECTS TO A CONTAINER:
|
230
|
+
|
231
|
+
➜ ~ swift-manager help run
|
232
|
+
|
233
|
+
run [command options] job
|
234
|
+
Run batch jobs. Type 'swift-manager help run' to see options
|
235
|
+
|
236
|
+
Command Options:
|
237
|
+
-d, --destination=arg - Name of container to backup to. Run 'swift-manager list storage -t s3 -f <auth> -i container'
|
238
|
+
-f, --file=arg - Auth Config
|
239
|
+
-j, --job=arg - Job: clean, create-containers, create-objects
|
240
|
+
-n, --number=arg - N number
|
241
|
+
-p, --prefix=arg - Prefix for containers or files
|
242
|
+
-s, --source=arg - Source: Path to local directory containing the files. Make sure to include "" for the path
|
243
|
+
-t, --type=arg - Type: s3, swift
|
244
|
+
➜ ~
|
245
|
+
|
246
|
+
➜ ~ swift-manager run job -j create-objects -s "/Users/rajum/Desktop/backuptest/*" -d appliv-1333979807 -t swift -f auth_config_swift1
|
247
|
+
|
248
|
+
Connecting to OpenStack Swift...
|
249
|
+
|
250
|
+
Uploading file file1.txt to appliv-1333979807
|
251
|
+
Uploading file file2.txt to appliv-1333979807
|
252
|
+
Uploading file file3.txt to appliv-1333979807
|
253
|
+
Uploading file file4.txt to appliv-1333979807
|
254
|
+
Uploading file HadoopinAction.epub to appliv-1333979807
|
255
|
+
Uploading file HBase_The_Definitive_Guide.epub to appliv-1333979807
|
256
|
+
Uploading file Machine_Learning_for_Hackers.epub to appliv-1333979807
|
257
|
+
Uploading file programming-clojure_b5_0.epub to appliv-1333979807
|
258
|
+
Uploading file ServiceOrientedDesignwithRubyandRails.epub to appliv-1333979807
|
259
|
+
Uploading file SinatraUpandRunning.epub to appliv-1333979807
|
260
|
+
Uploading file Working With Unix Processes.epub to appliv-1333979807
|
261
|
+
|
262
|
+
Creating objects complete
|
263
|
+
|
264
|
+
➜ ~
|
265
|
+
|
266
|
+
|
267
|
+
LISTING OBJECTS IN A CONTAINER:
|
268
|
+
|
269
|
+
|
270
|
+
➜ ~ swift-manager help list
|
271
|
+
|
272
|
+
list [command options] config, storage
|
273
|
+
List: configs, storage. Read examples.txt for more information
|
274
|
+
|
275
|
+
Command Options:
|
276
|
+
-f, --file=arg - Authentication file (auth_file.json)
|
277
|
+
-i, --item=arg - Item: container, objects
|
278
|
+
-n, --name=arg - Name: container name used only when listing objects
|
279
|
+
-t, --type=arg - Type: auth, s3, swift
|
280
|
+
➜ ~
|
281
|
+
|
282
|
+
|
283
|
+
|
284
|
+
➜ ~ swift-manager list storage -i objects -f auth_config_swift1 -t swift -n appliv-1333981630
|
285
|
+
|
286
|
+
Connecting to OpenStack Swift...
|
287
|
+
|
288
|
+
+-----------------------------------------------------------+---------------------------+----------------+
|
289
|
+
| key | last_modified | content_length |
|
290
|
+
+-----------------------------------------------------------+---------------------------+----------------+
|
291
|
+
| HBase_The_Definitive_Guide.epub | 2012-04-09 14:27:55 -0400 | 4600618 |
|
292
|
+
+-----------------------------------------------------------+---------------------------+----------------+
|
293
|
+
| HadoopinAction.epub | 2012-04-09 14:27:55 -0400 | 2605556 |
|
294
|
+
+-----------------------------------------------------------+---------------------------+----------------+
|
295
|
+
| Machine_Learning_for_Hackers.epub | 2012-04-09 14:27:56 -0400 | 16791025 |
|
296
|
+
+-----------------------------------------------------------+---------------------------+----------------+
|
297
|
+
| ServiceOrientedDesignwithRubyandRails.epub | 2012-04-09 14:27:58 -0400 | 10366450 |
|
298
|
+
+-----------------------------------------------------------+---------------------------+----------------+
|
299
|
+
| SinatraUpandRunning.epub | 2012-04-09 14:28:00 -0400 | 2513193 |
|
300
|
+
+-----------------------------------------------------------+---------------------------+----------------+
|
301
|
+
| Working With Unix Processes.epub | 2012-04-09 14:28:00 -0400 | 442992 |
|
302
|
+
+-----------------------------------------------------------+---------------------------+----------------+
|
303
|
+
| file1.txt | 2012-04-09 14:27:54 -0400 | 33 |
|
304
|
+
+-----------------------------------------------------------+---------------------------+----------------+
|
305
|
+
| file2.txt | 2012-04-09 14:27:55 -0400 | 33 |
|
306
|
+
+-----------------------------------------------------------+---------------------------+----------------+
|
307
|
+
| file3.txt | 2012-04-09 14:27:55 -0400 | 33 |
|
308
|
+
+-----------------------------------------------------------+---------------------------+----------------+
|
309
|
+
| file4.txt | 2012-04-09 14:27:55 -0400 | 33 |
|
310
|
+
+-----------------------------------------------------------+---------------------------+----------------+
|
311
|
+
| programming-clojure_b5_0.epub | 2012-04-09 14:27:58 -0400 | 712220 |
|
312
|
+
+-----------------------------------------------------------+---------------------------+----------------+
|
313
|
+
|
314
|
+
➜ ~
|
315
|
+
|
316
|
+
BROWSING CONTAINERS (JSON TREE) USING THE SHELL:
|
317
|
+
|
318
|
+
➜ ~ swift-manager shell container -t swift -f auth_config_swift1
|
319
|
+
|
320
|
+
Connecting to OpenStack Swift...
|
321
|
+
|
322
|
+
swift> <TAB>
|
323
|
+
0 1 2 3 4 5
|
324
|
+
swift> cd 5
|
325
|
+
swift> ls
|
326
|
+
key count bytes
|
327
|
+
swift> cat key
|
328
|
+
"appliv-1333979807"
|
329
|
+
swift> cat count
|
330
|
+
0
|
331
|
+
swift> cat bytes
|
332
|
+
0
|
333
|
+
swift> cd ..
|
334
|
+
swift> ls
|
335
|
+
0 1 2 3 4 5
|
336
|
+
swift>
|
337
|
+
|
338
|
+
|
339
|
+
CLEAN UP (DELETE CONTAINERS WITH OR WITHOUT OBJECTS):
|
340
|
+
|
341
|
+
➜ ~ swift-manager help run
|
342
|
+
|
343
|
+
run [command options] job
|
344
|
+
Run batch jobs. Type 'swift-manager help run' to see options
|
345
|
+
|
346
|
+
Command Options:
|
347
|
+
-d, --destination=arg - Name of container to backup to. Run 'swift-manager list storage -t s3 -f <auth> -i container'
|
348
|
+
-f, --file=arg - Auth Config
|
349
|
+
-j, --job=arg - Job: clean, create-containers, create-objects
|
350
|
+
-n, --number=arg - N number
|
351
|
+
-p, --prefix=arg - Prefix for containers or files
|
352
|
+
-s, --source=arg - Source: Path to local directory containing the files. Make sure to include "" for the path
|
353
|
+
-t, --type=arg - Type: s3, swift
|
354
|
+
➜ ~
|
355
|
+
|
356
|
+
➜ ~ swift-manager run job -j clean -f auth_config_swift1 -t swift
|
357
|
+
|
358
|
+
Connecting to OpenStack Swift...
|
359
|
+
|
360
|
+
|
361
|
+
*Deleting all files in container appliv-1333979649
|
362
|
+
Deleting container appliv-1333979649...
|
363
|
+
|
364
|
+
*Deleting all files in container appliv-1333979802
|
365
|
+
Deleting container appliv-1333979802...
|
366
|
+
|
367
|
+
*Deleting all files in container appliv-1333979803
|
368
|
+
Deleting container appliv-1333979803...
|
369
|
+
|
370
|
+
*Deleting all files in container appliv-1333979805
|
371
|
+
Deleting container appliv-1333979805...
|
372
|
+
|
373
|
+
*Deleting all files in container appliv-1333979806
|
374
|
+
Deleting container appliv-1333979806...
|
375
|
+
|
376
|
+
*Deleting all files in container appliv-1333979807
|
377
|
+
Deleting container appliv-1333979807...
|
378
|
+
|
379
|
+
Time elapsed to delete 6 containers: 0.7386581897735596 seconds
|
380
|
+
|
381
|
+
➜ ~
|
382
|
+
|
383
|
+
|
384
|
+
|
385
|
+
|
386
|
+
|
387
|
+
|
388
|
+
|
389
|
+
|
390
|
+
|
391
|
+
|
392
|
+
|
393
|
+
|
394
|
+
|
395
|
+
|
396
|
+
|
397
|
+
|
398
|
+
|
399
|
+
|
400
|
+
|
401
|
+
|
402
|
+
|
403
|
+
|
404
|
+
|
405
|
+
|
406
|
+
|
407
|
+
|
@@ -0,0 +1,308 @@
|
|
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: CloudShell</title>
|
9
|
+
|
10
|
+
<link rel="stylesheet" href="./rdoc.css" type="text/css" media="screen" />
|
11
|
+
|
12
|
+
<script src="./js/jquery.js" type="text/javascript" charset="utf-8"></script>
|
13
|
+
<script src="./js/thickbox-compressed.js" type="text/javascript" charset="utf-8"></script>
|
14
|
+
<script src="./js/quicksearch.js" type="text/javascript" charset="utf-8"></script>
|
15
|
+
<script src="./js/darkfish.js" type="text/javascript" charset="utf-8"></script>
|
16
|
+
|
17
|
+
</head>
|
18
|
+
<body id="top" class="class">
|
19
|
+
|
20
|
+
<div id="metadata">
|
21
|
+
<div id="home-metadata">
|
22
|
+
<div id="home-section" class="section">
|
23
|
+
<h3 class="section-header">
|
24
|
+
<a href="./index.html">Home</a>
|
25
|
+
<a href="./index.html#classes">Classes</a>
|
26
|
+
<a href="./index.html#methods">Methods</a>
|
27
|
+
</h3>
|
28
|
+
</div>
|
29
|
+
</div>
|
30
|
+
|
31
|
+
<div id="file-metadata">
|
32
|
+
<div id="file-list-section" class="section">
|
33
|
+
<h3 class="section-header">In Files</h3>
|
34
|
+
<div class="section-body">
|
35
|
+
<ul>
|
36
|
+
|
37
|
+
<li><a href="./lib/cloud_shell_rb.html?TB_iframe=true&height=550&width=785"
|
38
|
+
class="thickbox" title="lib/cloud_shell.rb">lib/cloud_shell.rb</a></li>
|
39
|
+
|
40
|
+
</ul>
|
41
|
+
</div>
|
42
|
+
</div>
|
43
|
+
|
44
|
+
|
45
|
+
</div>
|
46
|
+
|
47
|
+
<div id="class-metadata">
|
48
|
+
|
49
|
+
<!-- Parent Class -->
|
50
|
+
<div id="parent-class-section" class="section">
|
51
|
+
<h3 class="section-header">Parent</h3>
|
52
|
+
|
53
|
+
<p class="link"><a href="Object.html">Object</a></p>
|
54
|
+
|
55
|
+
</div>
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
<!-- Namespace Contents -->
|
62
|
+
<div id="namespace-list-section" class="section">
|
63
|
+
<h3 class="section-header">Namespace</h3>
|
64
|
+
<ul class="link-list">
|
65
|
+
|
66
|
+
<li><span class="type">CLASS</span> <a href="CloudShell/Context.html">CloudShell::Context</a></li>
|
67
|
+
|
68
|
+
</ul>
|
69
|
+
</div>
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
<!-- Method Quickref -->
|
74
|
+
<div id="method-list-section" class="section">
|
75
|
+
<h3 class="section-header">Methods</h3>
|
76
|
+
<ul class="link-list">
|
77
|
+
|
78
|
+
<li><a href="#method-i-execute_command">#execute_command</a></li>
|
79
|
+
|
80
|
+
<li><a href="#method-i-run">#run</a></li>
|
81
|
+
|
82
|
+
</ul>
|
83
|
+
</div>
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
</div>
|
88
|
+
|
89
|
+
<div id="project-metadata">
|
90
|
+
|
91
|
+
|
92
|
+
<div id="fileindex-section" class="section project-section">
|
93
|
+
<h3 class="section-header">Files</h3>
|
94
|
+
<ul>
|
95
|
+
|
96
|
+
<li class="file"><a href="./README_rdoc.html">README.rdoc</a></li>
|
97
|
+
|
98
|
+
</ul>
|
99
|
+
</div>
|
100
|
+
|
101
|
+
|
102
|
+
<div id="classindex-section" class="section project-section">
|
103
|
+
<h3 class="section-header">Class/Module Index
|
104
|
+
<span class="search-toggle"><img src="./images/find.png"
|
105
|
+
height="16" width="16" alt="[+]"
|
106
|
+
title="show/hide quicksearch" /></span></h3>
|
107
|
+
<form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
|
108
|
+
<fieldset>
|
109
|
+
<legend>Quicksearch</legend>
|
110
|
+
<input type="text" name="quicksearch" value=""
|
111
|
+
class="quicksearch-field" />
|
112
|
+
</fieldset>
|
113
|
+
</form>
|
114
|
+
|
115
|
+
<ul class="link-list">
|
116
|
+
|
117
|
+
<li><a href="./CloudShell.html">CloudShell</a></li>
|
118
|
+
|
119
|
+
<li><a href="./CloudShell/Context.html">CloudShell::Context</a></li>
|
120
|
+
|
121
|
+
<li><a href="./Configurator.html">Configurator</a></li>
|
122
|
+
|
123
|
+
<li><a href="./Formatter.html">Formatter</a></li>
|
124
|
+
|
125
|
+
<li><a href="./Object.html">Object</a></li>
|
126
|
+
|
127
|
+
<li><a href="./Parser.html">Parser</a></li>
|
128
|
+
|
129
|
+
<li><a href="./SwiftClient.html">SwiftClient</a></li>
|
130
|
+
|
131
|
+
<li><a href="./SwiftManager.html">SwiftManager</a></li>
|
132
|
+
|
133
|
+
</ul>
|
134
|
+
<div id="no-class-search-results" style="display: none;">No matching classes.</div>
|
135
|
+
</div>
|
136
|
+
|
137
|
+
|
138
|
+
</div>
|
139
|
+
</div>
|
140
|
+
|
141
|
+
<div id="documentation">
|
142
|
+
<h1 class="class">CloudShell</h1>
|
143
|
+
|
144
|
+
<div id="description" class="description">
|
145
|
+
<table class="rdoc-list"><tr><td class="rdoc-term"><p>Author</p></td>
|
146
|
+
<td>
|
147
|
+
<p>Murali Raju (<murali.raju@appliv.com>)</p>
|
148
|
+
</td></tr><tr><td class="rdoc-term"><p>Copyright</p></td>
|
149
|
+
<td>
|
150
|
+
<p>Copyright © 2011 Murali Raju.</p>
|
151
|
+
</td></tr><tr><td class="rdoc-term"><p>License</p></td>
|
152
|
+
<td>
|
153
|
+
<p>Apache License, Version 2.0</p>
|
154
|
+
</td></tr></table>
|
155
|
+
|
156
|
+
<p>Licensed under the Apache License, Version 2.0 (the “License”); you may not
|
157
|
+
use this file except in compliance with the License. You may obtain a copy
|
158
|
+
of the License at</p>
|
159
|
+
|
160
|
+
<p><a
|
161
|
+
href="http://www.apache.org/licenses/LICENSE-2.0">www.apache.org/licenses/LICENSE-2.0</a></p>
|
162
|
+
|
163
|
+
<p>Unless required by applicable law or agreed to in writing, software
|
164
|
+
distributed under the License is distributed on an “AS IS” BASIS, WITHOUT
|
165
|
+
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
166
|
+
License for the specific language governing permissions and limitations
|
167
|
+
under the License.</p>
|
168
|
+
|
169
|
+
</div><!-- description -->
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
|
174
|
+
<div id="5Buntitled-5D" class="documentation-section">
|
175
|
+
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
<!-- Methods -->
|
184
|
+
|
185
|
+
<div id="public-instance-method-details" class="method-section section">
|
186
|
+
<h3 class="section-header">Public Instance Methods</h3>
|
187
|
+
|
188
|
+
|
189
|
+
<div id="execute_command-method" class="method-detail ">
|
190
|
+
<a name="method-i-execute_command"></a>
|
191
|
+
|
192
|
+
|
193
|
+
<div class="method-heading">
|
194
|
+
<span class="method-name">execute_command</span><span
|
195
|
+
class="method-args">(command,current_context)</span>
|
196
|
+
<span class="method-click-advice">click to toggle source</span>
|
197
|
+
</div>
|
198
|
+
|
199
|
+
|
200
|
+
<div class="method-description">
|
201
|
+
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
|
206
|
+
<div class="method-source-code" id="execute_command-source">
|
207
|
+
<pre>
|
208
|
+
<span class="ruby-comment"># File lib/cloud_shell.rb, line 42</span>
|
209
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">execute_command</span>(<span class="ruby-identifier">command</span>,<span class="ruby-identifier">current_context</span>)
|
210
|
+
<span class="ruby-keyword">case</span> <span class="ruby-identifier">command</span>
|
211
|
+
<span class="ruby-keyword">when</span> <span class="ruby-regexp">/^ls$/</span>
|
212
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-identifier">current_context</span>.<span class="ruby-identifier">to_s</span>
|
213
|
+
<span class="ruby-keyword">when</span> <span class="ruby-regexp">/^cd (.*$)/</span>
|
214
|
+
<span class="ruby-identifier">new_context</span> = <span class="ruby-identifier">current_context</span>.<span class="ruby-identifier">cd</span>(<span class="ruby-node">$1</span>)
|
215
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">new_context</span>.<span class="ruby-identifier">nil?</span>
|
216
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-node">"No such key #{$1}"</span>
|
217
|
+
<span class="ruby-keyword">else</span>
|
218
|
+
<span class="ruby-identifier">current_context</span> = <span class="ruby-identifier">new_context</span>
|
219
|
+
<span class="ruby-keyword">end</span>
|
220
|
+
<span class="ruby-keyword">when</span> <span class="ruby-regexp">/^cat (.*)$/</span>
|
221
|
+
<span class="ruby-identifier">item</span> = <span class="ruby-identifier">current_context</span>.<span class="ruby-identifier">cat</span>(<span class="ruby-node">$1</span>)
|
222
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">item</span>.<span class="ruby-identifier">nil?</span>
|
223
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-node">"No such item #{$1}"</span>
|
224
|
+
<span class="ruby-keyword">else</span>
|
225
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-identifier">item</span>.<span class="ruby-identifier">inspect</span>
|
226
|
+
<span class="ruby-keyword">end</span>
|
227
|
+
<span class="ruby-keyword">when</span> <span class="ruby-regexp">/^help$/</span>
|
228
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-string">"cat <item> - print the contents of <item> in the current context"</span>
|
229
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-string">"cd <item> - change context to the context of <item>"</span>
|
230
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-string">"cd .. - change up one level"</span>
|
231
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-string">"ls - list available items in the current context"</span>
|
232
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-string">"exit - exit shell"</span>
|
233
|
+
<span class="ruby-keyword">end</span>
|
234
|
+
<span class="ruby-identifier">current_context</span>
|
235
|
+
<span class="ruby-keyword">end</span></pre>
|
236
|
+
</div><!-- execute_command-source -->
|
237
|
+
|
238
|
+
</div>
|
239
|
+
|
240
|
+
|
241
|
+
|
242
|
+
|
243
|
+
</div><!-- execute_command-method -->
|
244
|
+
|
245
|
+
|
246
|
+
<div id="run-method" class="method-detail ">
|
247
|
+
<a name="method-i-run"></a>
|
248
|
+
|
249
|
+
|
250
|
+
<div class="method-heading">
|
251
|
+
<span class="method-name">run</span><span
|
252
|
+
class="method-args">(json_file)</span>
|
253
|
+
<span class="method-click-advice">click to toggle source</span>
|
254
|
+
</div>
|
255
|
+
|
256
|
+
|
257
|
+
<div class="method-description">
|
258
|
+
|
259
|
+
<p>A basic read-only shell-like interface for browsing S3 or Swift JSON
|
260
|
+
objects via fog.to_json using readline</p>
|
261
|
+
|
262
|
+
|
263
|
+
|
264
|
+
<div class="method-source-code" id="run-source">
|
265
|
+
<pre>
|
266
|
+
<span class="ruby-comment"># File lib/cloud_shell.rb, line 24</span>
|
267
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">run</span>(<span class="ruby-identifier">json_file</span>)
|
268
|
+
<span class="ruby-identifier">root</span> = <span class="ruby-constant">JSON</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">json_file</span>)
|
269
|
+
<span class="ruby-identifier">command</span> = <span class="ruby-keyword">nil</span>
|
270
|
+
|
271
|
+
<span class="ruby-identifier">current_context</span> = <span class="ruby-constant">Context</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">root</span>,<span class="ruby-keyword">nil</span>)
|
272
|
+
|
273
|
+
<span class="ruby-constant">Readline</span>.<span class="ruby-identifier">completion_proc</span> = <span class="ruby-identifier">proc</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">input</span><span class="ruby-operator">|</span>
|
274
|
+
<span class="ruby-identifier">current_context</span>.<span class="ruby-identifier">completions</span>(<span class="ruby-identifier">input</span>)
|
275
|
+
}
|
276
|
+
|
277
|
+
<span class="ruby-keyword">while</span> <span class="ruby-identifier">command</span> <span class="ruby-operator">!=</span> <span class="ruby-string">'exit'</span>
|
278
|
+
<span class="ruby-identifier">command</span> = <span class="ruby-constant">Readline</span>.<span class="ruby-identifier">readline</span>(<span class="ruby-string">"swift> "</span>,<span class="ruby-keyword">true</span>)
|
279
|
+
<span class="ruby-keyword">break</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">command</span>.<span class="ruby-identifier">nil?</span>
|
280
|
+
<span class="ruby-identifier">current_context</span> = <span class="ruby-identifier">execute_command</span>(<span class="ruby-identifier">command</span>.<span class="ruby-identifier">strip</span>,<span class="ruby-identifier">current_context</span>)
|
281
|
+
<span class="ruby-keyword">end</span>
|
282
|
+
<span class="ruby-keyword">end</span></pre>
|
283
|
+
</div><!-- run-source -->
|
284
|
+
|
285
|
+
</div>
|
286
|
+
|
287
|
+
|
288
|
+
|
289
|
+
|
290
|
+
</div><!-- run-method -->
|
291
|
+
|
292
|
+
|
293
|
+
</div><!-- public-instance-method-details -->
|
294
|
+
|
295
|
+
</div><!-- 5Buntitled-5D -->
|
296
|
+
|
297
|
+
|
298
|
+
</div><!-- documentation -->
|
299
|
+
|
300
|
+
<div id="validator-badges">
|
301
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
302
|
+
<p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
|
303
|
+
Rdoc Generator</a> 2</small>.</p>
|
304
|
+
</div>
|
305
|
+
|
306
|
+
</body>
|
307
|
+
</html>
|
308
|
+
|