sploder 0.3.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 +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +110 -0
- data/Rakefile +1 -0
- data/bin/sploder +102 -0
- data/lib/sploder.rb +4 -0
- data/lib/sploder/version.rb +3 -0
- data/sploder.gemspec +24 -0
- metadata +103 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Bill Patrianakos
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,110 @@
|
|
1
|
+
# Sploder
|
2
|
+
|
3
|
+
Sploder is the S3 uploader. It is meant to help you perform a handful of common operations with S3 quickly, without ever having to leave the command line.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'sploder'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install sploder
|
18
|
+
|
19
|
+
Or manually with
|
20
|
+
|
21
|
+
$ git clone https://github.com/billpatrianakos/sploder.git
|
22
|
+
$ cd sploder/sploder
|
23
|
+
$ gem build sploder.gemspec
|
24
|
+
$ gem install sploder-0.X.X.gem # Please change to the version of Sploder you've downloaded - 0.3.3 as of this writing
|
25
|
+
|
26
|
+
## Usage
|
27
|
+
|
28
|
+
The [official documentation is here](http://sploder.cleverlabs.info) and explains the usage more in depth.
|
29
|
+
|
30
|
+
### Setup & connect to S3
|
31
|
+
|
32
|
+
Before Sploder will do anything you need to give it access to your S3 account. This is really simple. Just run `sploder --setup` and Sploder will walk you through the rest. You'll need your AWS access key ID and secret key to use Sploder. The prompts look like this:
|
33
|
+
|
34
|
+

|
35
|
+
|
36
|
+
Sploder saves your information in a hidden file called `.sploder` in your home (~/) directory whether you're on Windows, Linux, or Mac. If your AWS credentials ever change just run `--setup` again to give Sploder the new ones. Don't want Sploder to know your S3 credentials? Just delete the config file (`sudo rm ~/.sploder` - Sploder can't connect to S3 without this file though).
|
37
|
+
|
38
|
+
### Upload a file
|
39
|
+
|
40
|
+
Uploads are what Sploder was made for. In particular, it shines when it comes to being able to quickly share files from the command line. Give Sploder a bucket name and file and Sploder will upload it and return the URL where it can be accessed for easy sharing. If you don't want your files to have public-read permissions just change the ACL policy as explained below.
|
41
|
+
|
42
|
+
The `--upload` or `-u` flag take a maximum of 4 arguments. 2 are required and 2 are optional. 2 have flags and 2 don't. Here's an example using all options:
|
43
|
+
|
44
|
+
```
|
45
|
+
sploder --upload mybucket path/to/myfile.ext -p testing/somefolder -a private
|
46
|
+
```
|
47
|
+
|
48
|
+
The first two arguments after the `--upload` flag are the name of your bucket and the path to the file you want to upload. They are required and must come in that order.
|
49
|
+
|
50
|
+
`-p`, also known as `--path` is the path *within your S3 bucket* you want your file uploaded to. So if you uploaded a photo and wanted it to go into `yourbucketurl/2013/photos/` then you'd use the `-p` flag and write `2013/photos/`. The path argument is optional. If you do use it, remember that __your path must not have a leading slash and must have a trailing slash__. Sploder will accept paths with a leading slash and no trailing slash because S3 allows them but you'll end up with some weird final paths like `https://mybucket.amazonaws.com//foldermyfile.ext`. And it'll work! But it's not good for organization.
|
51
|
+
|
52
|
+
`-a` or `--acl` is the ACL policy you want to give the file you're uploading. This flag is optional and defaults to *public_read*. Sploder accepts the following ACL policies:
|
53
|
+
|
54
|
+
* __public_read__ (Default, no need to specify an ACL if you want this)
|
55
|
+
|
56
|
+
* __private__ - Only you can access the file
|
57
|
+
|
58
|
+
* __public_read_write__ - This is dumb. Don't do this unless you know what you're doing. The whole world can read and write to your file.
|
59
|
+
|
60
|
+
* __authenticated_read__ - Only logged in users can read the file? See the AWS docs to know for sure.
|
61
|
+
|
62
|
+
### Listing avilable buckets
|
63
|
+
|
64
|
+
`--list` or `-l` will return a list of your S3 buckets. Simple as that. No other flags or options here. Just a simple `sploder --list` or `sploder -l` will do the trick.
|
65
|
+
|
66
|
+
### Create a new bucket
|
67
|
+
|
68
|
+
`--create` or `-c` creates a new bucket within your account. If the bucket name is not available an error will be returned. The `--create` flag takes one other flag, the `--name or -n` flag. Usage is as follows:
|
69
|
+
|
70
|
+
```
|
71
|
+
sploder --create -n my-new-s3-bucket
|
72
|
+
```
|
73
|
+
|
74
|
+
If all went well Sploder will let you know the bucket has been created.
|
75
|
+
|
76
|
+

|
77
|
+
|
78
|
+
If you want to confirm your bucket has been created (I'm not sure why you wouldn't just trust Sploder) you can run `sploder --list` right after `--create` has finished.
|
79
|
+
|
80
|
+
### Deleting buckets
|
81
|
+
|
82
|
+
`--delete` or `-d` will delete a bucket along with everything in it. Because deleting a bucket is irreversible and deletes everything within it, I made it so that fat-fingering `-d` won't automatically destroy all your precious files and instead you'll have to confirm deletion. Running `sploder --delete` will start a prompt that will first ask you for the name of the bucket and then ask you to confirm that you're sure you really want to delete the bucket along with everything in it. Below is a screenshot of all 3 steps (running `-d`, typing in the bucket name, and confirming) after they've been completed:
|
83
|
+
|
84
|
+

|
85
|
+
|
86
|
+
### Exploring bucket contents
|
87
|
+
|
88
|
+
`--explore` or `-e` invokes the bucket explorer feature. This feature is under heavy development and doesn't work. But I'm still shipping it because I know you're all smart enough to add on to the Sploder::Bucket class methods for exploring buckets to make it work. This is a feature that I want a lot so you can be sure I'll be adding this feature soon.
|
89
|
+
|
90
|
+
## Support
|
91
|
+
|
92
|
+
You can get support from these sources (in order of importance)
|
93
|
+
|
94
|
+
* The [official Sploder site](http://sploder.cleverlabs.info) has complete documentation for usage and is *the place* for all future updates, docs, release info, and everything else.
|
95
|
+
|
96
|
+
* You can run `sploder` to get help from the command line. Using `sploder --help` or `sploder -h` will give you more information too.
|
97
|
+
|
98
|
+
* The [wiki](https://github.com/billpatrianakos/sploder/wiki) will document basic usage. It's basically the same as this readme.
|
99
|
+
|
100
|
+
## Roadmap
|
101
|
+
|
102
|
+
The 1.0 release will contain the same features that the current 0.3.3 version contains plus full support for listing the contents of buckets and paths within buckets through the `--explore` command. I believe that a good tool serves its purpose then gets out of the way. Because of this, I don't plan to add any more features to Sploder after `--explore` is implemented and instead focus on improving the existing codebase. If you have a feature request and it's a good idea that fits with the philosophy of Sploder I'd be happy to implement it but right now I can't think of anything else you could want from a tool like this.
|
103
|
+
|
104
|
+
## Contributing
|
105
|
+
|
106
|
+
1. Fork it
|
107
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
108
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
109
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
110
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/sploder
ADDED
@@ -0,0 +1,102 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
begin
|
4
|
+
require 'sploder'
|
5
|
+
require 'trollop'
|
6
|
+
require 'highline/import'
|
7
|
+
rescue LoadError
|
8
|
+
require 'rubygems'
|
9
|
+
require 'sploder'
|
10
|
+
require 'trollop'
|
11
|
+
require 'highline/import'
|
12
|
+
end
|
13
|
+
|
14
|
+
# This line is what prints the running message
|
15
|
+
puts "Main Sploder executable running."
|
16
|
+
|
17
|
+
opts = Trollop::options do
|
18
|
+
opt :upload, "Upload a file to S3"
|
19
|
+
opt :path, " (Optional) A new or existing path within your S3 bucket to upload to", :type => :string
|
20
|
+
opt :acl, " (Optional) ACL permission setting for the file being uploaded. Default is public_read", :type => :string
|
21
|
+
opt :setup, "Configure Sploder to work with your AWS account"
|
22
|
+
opt :list, "List your S3 buckets"
|
23
|
+
opt :explore, "Explore the contents of a bucket"
|
24
|
+
opt :prefix, " Object prefix", :type => :string
|
25
|
+
opt :create, "Create a new bucket"
|
26
|
+
opt :name, " Name of bucket (Used in all functions that take bucket names)", :type => :string
|
27
|
+
opt :delete, "Delete an existing bucket. WARNING: This deletes the entire contents of your bucket"
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
# Initialize the settings class to later check for .sploder file
|
32
|
+
settings = Sploder::Setup.new
|
33
|
+
|
34
|
+
case
|
35
|
+
when opts[:upload]
|
36
|
+
settings.settings_exist # Check that Sploder has been set up
|
37
|
+
upload = Sploder::Upload.new
|
38
|
+
key = settings.load_settings['key']
|
39
|
+
secret = settings.load_settings['secret']
|
40
|
+
bucket = ARGV[0]
|
41
|
+
file = ARGV[1]
|
42
|
+
path = opts[:path]
|
43
|
+
acl = opts[:acl]
|
44
|
+
upload.run(bucket, file, path, acl, key, secret)
|
45
|
+
when opts[:setup]
|
46
|
+
puts "Setup mode:"
|
47
|
+
puts "Enter your AWS credentials in the prompts below. These will be saved so you will not need to run setup again."
|
48
|
+
puts "If your credentials change in the future run 'sploder --setup' again to update them in Sploder."
|
49
|
+
puts " "
|
50
|
+
|
51
|
+
key = ask("Access key ID: ")
|
52
|
+
secret = ask("Secret access key: ")
|
53
|
+
|
54
|
+
setup = Sploder::Setup.new
|
55
|
+
setup.run(key, secret)
|
56
|
+
when opts[:list]
|
57
|
+
settings.settings_exist # Check that Sploder has been set up
|
58
|
+
list = Sploder::List.new
|
59
|
+
key = settings.load_settings['key']
|
60
|
+
secret = settings.load_settings['secret']
|
61
|
+
list.default(key, secret)
|
62
|
+
when opts[:explore]
|
63
|
+
settings.settings_exist # Check that Sploder has been set up
|
64
|
+
listobjects = Sploder::List.new
|
65
|
+
key = settings.load_settings['key']
|
66
|
+
secret = settings.load_settings['secret']
|
67
|
+
listobjects.list_bucket_contents(key, secret)
|
68
|
+
when opts[:create]
|
69
|
+
settings.settings_exist # Check that Sploder has been set up
|
70
|
+
unless opts[:name]
|
71
|
+
puts "Please enter a name for your new bucket"
|
72
|
+
exit 1
|
73
|
+
end
|
74
|
+
name = opts[:name]
|
75
|
+
key = settings.load_settings['key']
|
76
|
+
secret = settings.load_settings['secret']
|
77
|
+
newbucket = Sploder::Bucket.new
|
78
|
+
newbucket.create(name, key, secret)
|
79
|
+
when opts[:delete]
|
80
|
+
settings.settings_exist # Check that Sploder has been set up
|
81
|
+
bucket_name = ask("Enter the name of the bucket you want to delete: ")
|
82
|
+
puts "WARNING: This will delete your bucket and all its contents."
|
83
|
+
confirm = ask("Are you sure you want to continue? [y]/[n] ")
|
84
|
+
unless confirm == 'y'
|
85
|
+
puts "Cancelled bucket deletion. Phew, that was a close one!"
|
86
|
+
exit 1
|
87
|
+
end
|
88
|
+
key = settings.load_settings['key']
|
89
|
+
secret = settings.load_settings['secret']
|
90
|
+
bucket = Sploder::Bucket.new
|
91
|
+
bucket.delete(bucket_name, key, secret)
|
92
|
+
else
|
93
|
+
puts "USAGE:"
|
94
|
+
puts "Run setup and enter your AWS credentials before using:"
|
95
|
+
puts " sploder --setup OR sploder -s"
|
96
|
+
puts " "
|
97
|
+
puts "Upload a file:"
|
98
|
+
puts " sploder --upload <BUCKET_NAME> <FILE> (Optional: -p <PATH> -a <ACL_POLICY>)"
|
99
|
+
puts " "
|
100
|
+
puts "List available buckets:"
|
101
|
+
puts " sploder --list"
|
102
|
+
end
|
data/lib/sploder.rb
ADDED
data/sploder.gemspec
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'sploder/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "sploder"
|
8
|
+
gem.version = Sploder::VERSION
|
9
|
+
gem.authors = ["Bill Patrianakos"]
|
10
|
+
gem.email = ["bill@billpatrianakos.me"]
|
11
|
+
gem.description = 'Sploder is the S3 uploader'
|
12
|
+
gem.summary = 'Easily upload files to S3, create buckets, set ACL, and more'
|
13
|
+
gem.homepage = "http://sploder.cleverlabs.info"
|
14
|
+
|
15
|
+
gem.files = `git ls-files`.split($/)
|
16
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
17
|
+
gem.require_paths = ["lib"]
|
18
|
+
|
19
|
+
gem.add_dependency "trollop"
|
20
|
+
gem.add_dependency "aws-sdk"
|
21
|
+
gem.add_dependency "highline"
|
22
|
+
gem.executables << 'sploder'
|
23
|
+
#gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
24
|
+
end
|
metadata
ADDED
@@ -0,0 +1,103 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sploder
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.3.4
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Bill Patrianakos
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-02-03 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: trollop
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: aws-sdk
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: highline
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
description: Sploder is the S3 uploader
|
63
|
+
email:
|
64
|
+
- bill@billpatrianakos.me
|
65
|
+
executables:
|
66
|
+
- sploder
|
67
|
+
extensions: []
|
68
|
+
extra_rdoc_files: []
|
69
|
+
files:
|
70
|
+
- .gitignore
|
71
|
+
- Gemfile
|
72
|
+
- LICENSE.txt
|
73
|
+
- README.md
|
74
|
+
- Rakefile
|
75
|
+
- lib/sploder.rb
|
76
|
+
- lib/sploder/version.rb
|
77
|
+
- sploder.gemspec
|
78
|
+
- bin/sploder
|
79
|
+
homepage: http://sploder.cleverlabs.info
|
80
|
+
licenses: []
|
81
|
+
post_install_message:
|
82
|
+
rdoc_options: []
|
83
|
+
require_paths:
|
84
|
+
- lib
|
85
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
86
|
+
none: false
|
87
|
+
requirements:
|
88
|
+
- - ! '>='
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
92
|
+
none: false
|
93
|
+
requirements:
|
94
|
+
- - ! '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
requirements: []
|
98
|
+
rubyforge_project:
|
99
|
+
rubygems_version: 1.8.25
|
100
|
+
signing_key:
|
101
|
+
specification_version: 3
|
102
|
+
summary: Easily upload files to S3, create buckets, set ACL, and more
|
103
|
+
test_files: []
|