simple-s3 0.0.1
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 +1 -0
- data/README.md +3 -0
- data/bin/simple-s3.rb +3 -0
- data/lib/simple-s3/simple-s3.rb +43 -0
- data/lib/simple-s3/version.rb +3 -0
- data/lib/simple-s3.rb +7 -0
- data/simple-s3.gemspec +22 -0
- metadata +80 -0
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
.DS_Store
|
data/README.md
ADDED
data/bin/simple-s3.rb
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
class SimpleS3
|
2
|
+
|
3
|
+
def config
|
4
|
+
if @config.nil?
|
5
|
+
@config = YAML.load('./simple-s3.yml')
|
6
|
+
end
|
7
|
+
@config
|
8
|
+
end
|
9
|
+
|
10
|
+
def upload!
|
11
|
+
exclude = @config['exclude_files']
|
12
|
+
inc = @config['include_files']
|
13
|
+
bucket = @config['bucket']
|
14
|
+
metadata = @config['metadata'] || {}
|
15
|
+
|
16
|
+
metadata[:access] ||= 'public-read'
|
17
|
+
|
18
|
+
files = []
|
19
|
+
Dir[inc].each do |file|
|
20
|
+
name = File.basename(file)
|
21
|
+
files.push(file) unless exclude.include?(name)
|
22
|
+
end
|
23
|
+
|
24
|
+
AWS::S3::Base.establish_connection!(
|
25
|
+
:access_key_id => @config['access_key'],
|
26
|
+
:secret_access_key => @config['secret_key']
|
27
|
+
)
|
28
|
+
|
29
|
+
files.each do |file|
|
30
|
+
base_name = File.basename(file)
|
31
|
+
puts "Uploading #{file} as '#{base_name}' to '#{bucket}'"
|
32
|
+
AWS::S3::S3Object.store(
|
33
|
+
base_name,
|
34
|
+
File.open(file),
|
35
|
+
bucket,
|
36
|
+
meta_data
|
37
|
+
)
|
38
|
+
end
|
39
|
+
|
40
|
+
puts "Completed!"
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
data/lib/simple-s3.rb
ADDED
data/simple-s3.gemspec
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "simple-s3/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "simple-s3"
|
7
|
+
s.version = SimpleS3::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Matias Niemela"]
|
10
|
+
s.email = ["matias@yearofmoo.com"]
|
11
|
+
s.homepage = "https://github.com/yearofmoo/simple-s3"
|
12
|
+
s.summary = %q{Push your static content to S3}
|
13
|
+
s.description = %q{This Gem allows you to push your static content to AWS S3.}
|
14
|
+
|
15
|
+
s.default_executable = %q{simple-s3}
|
16
|
+
|
17
|
+
s.add_dependency 'aws-s3'
|
18
|
+
|
19
|
+
s.files = `git ls-files`.split("\n")
|
20
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
21
|
+
s.require_paths = ["lib"]
|
22
|
+
end
|
metadata
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: simple-s3
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
version: 0.0.1
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Matias Niemela
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2012-10-10 00:00:00 -04:00
|
18
|
+
default_executable: simple-s3
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: aws-s3
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 0
|
29
|
+
version: "0"
|
30
|
+
type: :runtime
|
31
|
+
version_requirements: *id001
|
32
|
+
description: This Gem allows you to push your static content to AWS S3.
|
33
|
+
email:
|
34
|
+
- matias@yearofmoo.com
|
35
|
+
executables:
|
36
|
+
- simple-s3.rb
|
37
|
+
extensions: []
|
38
|
+
|
39
|
+
extra_rdoc_files: []
|
40
|
+
|
41
|
+
files:
|
42
|
+
- .gitignore
|
43
|
+
- README.md
|
44
|
+
- bin/simple-s3.rb
|
45
|
+
- lib/simple-s3.rb
|
46
|
+
- lib/simple-s3/simple-s3.rb
|
47
|
+
- lib/simple-s3/version.rb
|
48
|
+
- simple-s3.gemspec
|
49
|
+
has_rdoc: true
|
50
|
+
homepage: https://github.com/yearofmoo/simple-s3
|
51
|
+
licenses: []
|
52
|
+
|
53
|
+
post_install_message:
|
54
|
+
rdoc_options: []
|
55
|
+
|
56
|
+
require_paths:
|
57
|
+
- lib
|
58
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
segments:
|
63
|
+
- 0
|
64
|
+
version: "0"
|
65
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
segments:
|
70
|
+
- 0
|
71
|
+
version: "0"
|
72
|
+
requirements: []
|
73
|
+
|
74
|
+
rubyforge_project:
|
75
|
+
rubygems_version: 1.3.6
|
76
|
+
signing_key:
|
77
|
+
specification_version: 3
|
78
|
+
summary: Push your static content to S3
|
79
|
+
test_files: []
|
80
|
+
|