Usage instructions | Options
The Sploder gem has one command line executable with many options. It's pretty straightforward but please do give this guide a quick read before diving in.
Before using Sploder for the first time you'll need to enter your AWS access key ID and secret access key. To do this, just run: sploder --setup. Sploder saves this information in a hidden YAML file in ~/.sploder for later use. If your AWS credentials ever change just run setup again to update them in Sploder.
The upload command takes a maximum of four arguments, two of which are optional. The upload command looks like this (bucket name and file path arguments must be in the same order shown):
sploder --upload BUCKET_NAME PATH/TO/FILE.EXT -p PATH/WITHIN/BUCKET/ -a public_read
Upload flags and parameters
|--upload / -u||Bucket name to upload file to and path to file to upload. Both are required in that order.||Initiates upload procedure. Outputs URL of your file. Expects 2 required (non-flagged) arguments and up to 2 optional flags with arguments.|
|--path / -p||String - remote path to upload to.||Optional||Sets the directory within your bucket that a file is uploaded to. Do not use a starting slash but do include a trailing slash.
Example: Adding -p photos/2012/ to the upload command would set the path in S3 to "https://s3.amazonaws.com/bucket_name/
|--acl / -a||String. One of 4 pre-defined ACL policies for your object.||Optional||If you don't specify the --acl/-a argument it defaults to 'public_read'. ACL options:
List is a seriously simple command that does one thing and one thing only: lists your buckets. It takes no arguments and is called by the --list or -l flags. Example:
Creating new buckets is as simple as listing them except with one extra required parameter. To invoke the create function you call --create or -c and use the --name or -n flag to name it like this:
sploder --create -n myShinyNewBucket
|--create / -c||Include the -n flag to give it a name.||Creates a new S3 bucket associated with your account. Run sploder --list to confirm bucket was created.|
|--name / -n||String - name of new bucket to create.||Required||See example above.|
Deleting a bucket
The delete operation is similar to setup in that it takes no arguments and runs you through a prompt. Deleting a bucket means deleting all of its contents as well. That's why you have to go through a confirmation prompt:
To delete a bucket (which deletes all of its contents), just run:
And Sploder will take you through the process of choosing and making sure you want to delete that bucket.
Explore bucket contents
Using the explore operation you can list the entire contents of a bucket or explore specific directories within your bucket. Here's how it's used:
sploder --explore -n bucket_name -r blog_posts/2013
The -n (or --name) flag is the only required flag for this command. Leaving out the prefix will return a list of every single file and folder in your bucket. This can be a lot of output if there are a lot of files in your bucket and so you should probably use a prefix so that you can handle your output more easily.
Individual File Management
You can get a file's URL or delete a specific file with the --file (or -f) flag. It takes three unflagged arguments only one of which is required. These arguments are allow you to chose the bucket, file, and operation.
Basic usage (Get file URL)
sploder --file my_bucket path/to/file.ext
The code above will output the path to your file for sharing which you can then copy and paste from the command line (unless you're on Windows and using one of the plethora of terrible terminal programs which don't support Copy or Paste).
Deleting individual files or folders
You can delete both individual files and paths using the delete argument. Note that this is not a flag. It is an optional parameter that always comes last in the --file operation. Here's how it works:
sploder --file my_bucket path/to/file delete
The above command will output the path to the file that you have deleted. If you run sploder --explore -n my_bucket path/to/folder [optional] you'll see your file is no longer listed. You can do this to confirm deletion if you don't trust Sploder but there should be no need for that.