s3tools 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -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,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in s3tools.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Alan Johnson
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.
@@ -0,0 +1,29 @@
1
+ # S3tools
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 's3tools'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install s3tools
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
@@ -0,0 +1,28 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'aws/s3'
4
+
5
+ puts "s3put - Upload a file to S3"
6
+ puts "s3url source bucket object"
7
+
8
+ aws_access_key_id = ENV["AWS_ACCESS_KEY_ID"]
9
+ aws_secret_access_key = ENV["AWS_SECRET_ACCESS_KEY"]
10
+
11
+ source_file = ARGV[0]
12
+ bucket_name = ARGV[1]
13
+ object_name = ARGV[2]
14
+
15
+ AWS.config(:access_key_id => aws_access_key_id,
16
+ :secret_access_key => aws_secret_access_key)
17
+
18
+ s3 = AWS::S3.new
19
+ s3_object = s3.buckets[bucket_name].objects[object_name]
20
+ s3_object.write(File.new(source_file))
21
+
22
+ url = s3_object.url_for(:read)
23
+
24
+ puts "Successfully uploaded!"
25
+ puts
26
+ puts url.to_s
27
+ puts
28
+
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'aws/s3'
4
+
5
+ puts "s3url - Generate an expiring url for an s3 object"
6
+ puts "s3url bucket object expiration_seconds"
7
+
8
+ aws_access_key_id = ENV["AWS_ACCESS_KEY_ID"]
9
+ aws_secret_access_key = ENV["AWS_SECRET_ACCESS_KEY"]
10
+
11
+ bucket_name = ARGV[0]
12
+ object_name = ARGV[1]
13
+ expiration_seconds = ARGV[2].to_i
14
+
15
+ AWS.config(:access_key_id => aws_access_key_id,
16
+ :secret_access_key => aws_secret_access_key)
17
+
18
+ s3 = AWS::S3.new
19
+ s3_object = s3.buckets[bucket_name].objects[object_name]
20
+
21
+ url = s3_object.url_for(:read, :expires => expiration_seconds)
22
+
23
+ puts "Your URL:"
24
+ puts
25
+ puts url.to_s
26
+ puts
27
+
@@ -0,0 +1,5 @@
1
+ require "s3tools/version"
2
+
3
+ module S3tools
4
+ # Your code goes here...
5
+ end
@@ -0,0 +1,3 @@
1
+ module S3tools
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,19 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/s3tools/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Alan Johnson"]
6
+ gem.email = ["alan@commondream.net"]
7
+ gem.description = %q{Some simple commands to make working with S3 a bit easier.}
8
+ gem.summary = %q{Some simple commands to make working with S3 a bit easier.}
9
+ gem.homepage = "http://github.com/commondream/s3tools"
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 = "s3tools"
15
+ gem.require_paths = ["lib"]
16
+ gem.version = S3tools::VERSION
17
+
18
+ gem.add_runtime_dependency "aws-sdk", "~> 1.4.1"
19
+ end
metadata ADDED
@@ -0,0 +1,68 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: s3tools
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Alan Johnson
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-06-20 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: aws-sdk
16
+ requirement: &70267657659700 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 1.4.1
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *70267657659700
25
+ description: Some simple commands to make working with S3 a bit easier.
26
+ email:
27
+ - alan@commondream.net
28
+ executables:
29
+ - s3put
30
+ - s3url
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - .gitignore
35
+ - Gemfile
36
+ - LICENSE
37
+ - README.md
38
+ - Rakefile
39
+ - bin/s3put
40
+ - bin/s3url
41
+ - lib/s3tools.rb
42
+ - lib/s3tools/version.rb
43
+ - s3tools.gemspec
44
+ homepage: http://github.com/commondream/s3tools
45
+ licenses: []
46
+ post_install_message:
47
+ rdoc_options: []
48
+ require_paths:
49
+ - lib
50
+ required_ruby_version: !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ! '>='
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ required_rubygems_version: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ requirements: []
63
+ rubyforge_project:
64
+ rubygems_version: 1.8.11
65
+ signing_key:
66
+ specification_version: 3
67
+ summary: Some simple commands to make working with S3 a bit easier.
68
+ test_files: []