Skip to content
Newer
Older
100644 29 lines (23 sloc) 968 Bytes
ca6b36d @alexeypetrushin upd docs
alexeypetrushin authored
1 # Example of creating AWS S3 Backup with [Virtual File System][vfs].
2 #
3 # In this example we uploading sample files to S3 and then
4 # copying it back to local folder.
5
6 # Connecting to S3 and preparing sandbox. You may take a look at
32f3819 @alexeypetrushin upd docs
alexeypetrushin authored
7 # the [docs/s3_sandbox.rb][s3_sandbox] to see the actual code.
8 $LOAD_PATH << File.expand_path("#{__FILE__}/../..")
9 require 'docs/s3_sandbox'
ca6b36d @alexeypetrushin upd docs
alexeypetrushin authored
10 s3 = $sandbox
11
12 # Preparing sample files located in our local folder in
13 # current directory.
14 current_dir = __FILE__.to_entry.parent
32f3819 @alexeypetrushin upd docs
alexeypetrushin authored
15 sample_files = current_dir['s3_backup/app']
ca6b36d @alexeypetrushin upd docs
alexeypetrushin authored
16
17 # Uploading sample files to S3.
18 sample_files.copy_to s3['app']
19 p s3['app/files/bos.png'].exist? # => true
20
21 # Preparing local storage for S3 backup.
22 local_backup = '/tmp/vfs_sandbox/backup'.to_dir.destroy
23
24 # Copying files from S3 to local backup directory.
25 s3['app'].copy_to local_backup['app']
26 p local_backup['app/files/bos.png'].exist? # => true
27
32f3819 @alexeypetrushin upd docs
alexeypetrushin authored
28 # [vfs]: index.html
29 # [s3_sandbox]: s3_sandbox.html
Something went wrong with that request. Please try again.