s3download 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Richard Bone
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,11 @@
1
+ # S3download
2
+
3
+ A simple command line tool for downloading protected files from s3
4
+
5
+ ## Installation
6
+
7
+ gem install s3download
8
+
9
+ ## Usage
10
+
11
+ s3download aws_access_key aws_secret_key s3_bucket/s3_object.txt ~/blarg.txt
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
data/bin/s3download ADDED
@@ -0,0 +1,31 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'aws-sdk'
4
+
5
+ if ARGV.length != 4 || ARGV.include?('--help') || ARGV.include?('-h')
6
+ puts "Usage: s3download access_key secret_key s3_source destination"
7
+ puts " e.g. s3download aws_access_key aws_secret_access_key my_s3_bucket/my_file.txt ~/downloads/my_file.txt"
8
+ exit 1
9
+ end
10
+
11
+ access_key = ARGV[0]
12
+ secret_key = ARGV[1]
13
+ s3_source = ARGV[2]
14
+ destination = ARGV[3]
15
+
16
+ s3 = AWS::S3.new(
17
+ :access_key_id => access_key,
18
+ :secret_access_key => secret_key
19
+ )
20
+
21
+ parts = s3_source.split('/')
22
+ object_name = parts.pop
23
+ bucket = parts.join('/')
24
+
25
+ s3_object = s3.buckets[bucket].objects[object_name]
26
+
27
+ File.open(destination, "w") do |f|
28
+ f.write(s3_object.read)
29
+ end
30
+
31
+ puts "downloaded #{s3_source} to #{destination}"
data/lib/s3download.rb ADDED
@@ -0,0 +1,2 @@
1
+ module S3download
2
+ end
@@ -0,0 +1,3 @@
1
+ module S3download
2
+ VERSION = '0.0.1'
3
+ end
@@ -0,0 +1,19 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/s3download/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Richard Bone"]
6
+ gem.email = ["rjonbone@gmail.com"]
7
+ gem.description = %q{A command line tool for downloading protected files from S3}
8
+ gem.summary = %q{A command line tool for downloading protected files from S3}
9
+ gem.homepage = "https://github.com/rbone/s3download"
10
+
11
+ gem.files = `git ls-files`.split($\)
12
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
13
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
+ gem.name = "s3download"
15
+ gem.require_paths = ["lib"]
16
+ gem.version = S3download::VERSION
17
+
18
+ gem.add_dependency 'aws-sdk', '~> 1.6.0'
19
+ end
metadata ADDED
@@ -0,0 +1,71 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: s3download
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Richard Bone
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-07-31 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: aws-sdk
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 1.6.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: 1.6.0
30
+ description: A command line tool for downloading protected files from S3
31
+ email:
32
+ - rjonbone@gmail.com
33
+ executables:
34
+ - s3download
35
+ extensions: []
36
+ extra_rdoc_files: []
37
+ files:
38
+ - .gitignore
39
+ - Gemfile
40
+ - LICENSE
41
+ - README.md
42
+ - Rakefile
43
+ - bin/s3download
44
+ - lib/s3download.rb
45
+ - lib/s3download/version.rb
46
+ - s3download.gemspec
47
+ homepage: https://github.com/rbone/s3download
48
+ licenses: []
49
+ post_install_message:
50
+ rdoc_options: []
51
+ require_paths:
52
+ - lib
53
+ required_ruby_version: !ruby/object:Gem::Requirement
54
+ none: false
55
+ requirements:
56
+ - - ! '>='
57
+ - !ruby/object:Gem::Version
58
+ version: '0'
59
+ required_rubygems_version: !ruby/object:Gem::Requirement
60
+ none: false
61
+ requirements:
62
+ - - ! '>='
63
+ - !ruby/object:Gem::Version
64
+ version: '0'
65
+ requirements: []
66
+ rubyforge_project:
67
+ rubygems_version: 1.8.23
68
+ signing_key:
69
+ specification_version: 3
70
+ summary: A command line tool for downloading protected files from S3
71
+ test_files: []