module BaseCommands

Public Instance Methods

accesslog(bucket = nil) click to toggle source

Enable/disable bucket access logging

# File lib/dsl/commands/base_commands.rb, line 171
def accesslog(bucket = nil)
  @commands[:accesslog] = @bucket || bucket
  self
end
Also aliased as: logging
copy(src_bucket, dest_bucket)
Alias for: cp
cp(src_bucket, dest_bucket) click to toggle source

Make a copy of a file (cp) or move a file (mv). Destination can be in the same bucket with a dif‐ ferent name or in another bucket with the same or different name. Adding –acl-public will make the destination object publicly accessible (see below).

# File lib/dsl/commands/base_commands.rb, line 135
def cp(src_bucket, dest_bucket) # s3://BUCKET1/OBJECT1 s3://BUCKET2[/OBJECT2]
  @commands[:cp] = "#{src_bucket} #{dest_bucket}"
  self
end
Also aliased as: copy
create_bucket(bucket = nil)
Alias for: mb
create_new_bucket(bucket = nil)
Alias for: mb
del(object = nil) click to toggle source

Delete file from bucket

# File lib/dsl/commands/base_commands.rb, line 112
def del(object = nil) # s3://BUCKET/OBJECT
  @commands[:del] = @bucket || object
  self
end
Also aliased as: delete, rm, delete_object, delete_file, remove
delete(object = nil)
Alias for: del
delete_bucket(bucket = nil)
Alias for: rb
delete_file(object = nil)
Alias for: del
delete_object(object = nil)
Alias for: del
disk_usage(bucket = nil)
Alias for: du
download(object = nil, files = nil)
Alias for: get
du(bucket = nil) click to toggle source

Disk usage - amount of data stored in S3

# File lib/dsl/commands/base_commands.rb, line 164
def du(bucket = nil) # [s3://BUCKET[/PREFIX]]
  @commands[:du] = @bucket || bucket
  self
end
Also aliased as: disk_usage
fix(bucket = nil)
Alias for: fixbucket
fixbucket(bucket = nil) click to toggle source

Fix invalid file names in a bucket

# File lib/dsl/commands/base_commands.rb, line 185
def fixbucket(bucket = nil)
  @commands[:fixbucket] = @bucket || bucket
  self
end
Also aliased as: fix
get(object = nil, files = nil) click to toggle source

Get file from bucket (i.e. download from S3)

# File lib/dsl/commands/base_commands.rb, line 102
def get(object = nil, files = nil) # s3://BUCKET/OBJECT LOCAL_FILE
  get_files = @files || files
  get_object = @bucket || object

  @commands[:get] = "#{get_object} #{get_files}"
  self
end
Also aliased as: download
info(bucket = nil) click to toggle source

Get various information about a Bucket or Object

# File lib/dsl/commands/base_commands.rb, line 158
def info(bucket = nil) # s3://BUCKET[/OBJECT]
  @commands[:info] = @bucket || bucket
  self
end
la() click to toggle source

List all object in all buckets

# File lib/dsl/commands/base_commands.rb, line 84
def la
  @commands[:la] = ''
  self
end
Also aliased as: list_all, list_all_objects
list(bucket = nil)
Alias for: ls
list_all()
Alias for: la
list_all_objects()
Alias for: la
list_bucket(bucket = nil)
Alias for: ls
logging(bucket = nil)
Alias for: accesslog
ls(bucket = nil) click to toggle source

List objects or buckets

# File lib/dsl/commands/base_commands.rb, line 76
def ls(bucket = nil) # s3://BUCKET[/PREFIX]]
  @commands[:ls] = bucket || @bucket
  self
end
Also aliased as: list_bucket, list
make_bucket(bucket = nil)
Alias for: mb
mb(bucket = nil) click to toggle source

Make bucket

# File lib/dsl/commands/base_commands.rb, line 57
def mb(bucket = nil) # s3://BUCKET
  @commands[:mb] = bucket || @bucket
  self
end
mkdir(bucket = nil)
Alias for: mb
move(src_bucket, dest_bucket)
Alias for: mv
mv(src_bucket, dest_bucket) click to toggle source

Make a copy of a file (cp) or move a file (mv). Destination can be in the same bucket with a dif‐ ferent name or in another bucket with the same or different name. Adding –acl-public will make the destination object publicly accessible (see below).

# File lib/dsl/commands/base_commands.rb, line 144
def mv(src_bucket, dest_bucket) # s3://BUCKET1/OBJECT1 s3://BUCKET2[/OBJECT2]
  @commands[:mv] = "#{src_bucket} #{dest_bucket}"
  self
end
Also aliased as: move
put(files = nil, bucket = nil) click to toggle source

Put file into bucket (i.e. upload to S3)

# File lib/dsl/commands/base_commands.rb, line 92
def put(files = nil, bucket = nil) # FILE [FILE...] s3://BUCKET[/PREFIX]
  put_files = @files || files
  put_bucket = @bucket || bucket

  @commands[:put] = "#{put_files} #{put_bucket}"
  self
end
Also aliased as: upload
rb(bucket = nil) click to toggle source

Remove bucket

# File lib/dsl/commands/base_commands.rb, line 67
def rb(bucket = nil) # s3://BUCKET
  @commands[:rb] = bucket || @bucket
  self
end
Also aliased as: remove_bucket, rmdir, delete_bucket
remove(object = nil)
Alias for: del
remove_bucket(bucket = nil)
Alias for: rb
rm(object = nil)
Alias for: del
rmdir(bucket = nil)
Alias for: rb
secretkey(string)
Alias for: sign
set_access_control_list(bucket = nil)
Alias for: setacl
setacl(bucket = nil) click to toggle source

Modify Access control list for Bucket or Files. Use with –acl-public or –acl-private

# File lib/dsl/commands/base_commands.rb, line 151
def setacl(bucket = nil) # s3://BUCKET[/OBJECT]
  @commands[:setacl] = @bucket || bucket
  self
end
Also aliased as: set_access_control_list
sign(string) click to toggle source

Sign arbitrary string using the secret key

# File lib/dsl/commands/base_commands.rb, line 178
def sign(string)
  @commands[:sign] = string
  self
end
Also aliased as: secretkey
sync(src_object, dest_object) click to toggle source

Backup a directory tree to S3 Restore a tree from S3 to local directory

# File lib/dsl/commands/base_commands.rb, line 124
def sync(src_object, dest_object) # LOCAL_DIR s3://BUCKET[/PREFIX] or s3://BUCKET[/PREFIX] LOCAL_DIR
  @commands[:sync] = "#{src_object} #{dest_object}"
  self
end
Also aliased as: sync_directory, sync_dir, synchronize
sync_dir(src_object, dest_object)
Alias for: sync
sync_directory(src_object, dest_object)
Alias for: sync
synchronize(src_object, dest_object)
Alias for: sync
upload(files = nil, bucket = nil)
Alias for: put