capistrano-s3 0.2.11 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/.gitignore +2 -1
- data/.travis.yml +2 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile +0 -14
- data/README.md +35 -15
- data/capistrano-s3.gemspec +14 -6
- data/certs/aleksandrs-ledovskis.pem +21 -0
- data/lib/capistrano/s3.rb +9 -42
- data/lib/capistrano/s3/defaults.rb +19 -0
- data/lib/capistrano/s3/publisher.rb +107 -79
- data/lib/capistrano/s3/version.rb +1 -1
- data/lib/capistrano/tasks/capistrano_2.rb +32 -0
- data/lib/capistrano/tasks/capistrano_3.rb +25 -0
- metadata +116 -28
- metadata.gz.sig +0 -0
- data/Gemfile.lock +0 -65
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f197de9db4d3c744c215aa5919b2413cdee20ca6
|
4
|
+
data.tar.gz: 814d5136a7837d65906aa63f31939f8f1399edd8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0149e3d1f3b5736644a32efccc4ee25b25d64d9819eda4f1822816385c5dabab81226a04b051bb57c41c18f360681a9537f82d1cb3a32de68dfc81cf413baa2d
|
7
|
+
data.tar.gz: ef18df3303616991b36e32d5a16221c273d86dc8a3dffa76fd5fb5df8fb4f729a33ae8ac834269af70fd421661981509e5ce7f18d3a9b6423a056a90eae95c6f
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -23,34 +23,54 @@ gem 'capistrano-s3'
|
|
23
23
|
|
24
24
|
### Setup
|
25
25
|
|
26
|
-
Install gems with bundle
|
26
|
+
Install gems with bundle and create your public folder that will be published :
|
27
27
|
|
28
28
|
bundle install
|
29
|
-
|
30
|
-
mkdir public
|
29
|
+
mkdir -p public
|
31
30
|
|
32
|
-
|
31
|
+
Gem supports both flavors of Capistrano (2/3). Configurations between versions differ a bit though.
|
33
32
|
|
34
|
-
|
35
|
-
with these simple Amazon S3 configurations :
|
33
|
+
#### Capistrano 2
|
36
34
|
|
37
|
-
|
38
|
-
# config/deploy.rb
|
39
|
-
require 'capistrano/s3'
|
35
|
+
First initialise Capistrano for given project - `bundle exec capify .`
|
40
36
|
|
41
|
-
|
42
|
-
|
43
|
-
set :secret_access_key, "CHANGETHIS"
|
44
|
-
```
|
37
|
+
Replace `deploy.rb` content generated by capify
|
38
|
+
with these simple Amazon S3 configurations :
|
45
39
|
|
46
|
-
|
40
|
+
# config/deploy.rb
|
41
|
+
require 'capistrano/s3'
|
47
42
|
|
48
|
-
|
43
|
+
set :bucket, "www.cool-website-bucket.com"
|
44
|
+
set :access_key_id, "CHANGETHIS"
|
45
|
+
set :secret_access_key, "CHANGETHIS"
|
49
46
|
|
50
47
|
If you want to deploy to multiple buckets, have a look at
|
51
48
|
[Capistrano multistage](https://github.com/capistrano/capistrano/wiki/2.x-Multistage-Extension)
|
52
49
|
and configure a bucket per stage configuration.
|
53
50
|
|
51
|
+
#### Capistrano 3
|
52
|
+
|
53
|
+
Initialise Capistrano by running - `bundle exec cap install`
|
54
|
+
|
55
|
+
Next add `require "capistrano/s3"` to Capfile.
|
56
|
+
|
57
|
+
Finally, replace `deploy.rb` content generated by Capistrano with
|
58
|
+
this config:
|
59
|
+
|
60
|
+
# config/deploy.rb
|
61
|
+
set :bucket, "www.cool-website-bucket.com"
|
62
|
+
set :access_key_id, "CHANGETHIS"
|
63
|
+
set :secret_access_key, "CHANGETHIS"
|
64
|
+
|
65
|
+
### Deploying
|
66
|
+
|
67
|
+
Add content to your public folder and run deploy command:
|
68
|
+
- `cap deploy` (Capistrano 2)
|
69
|
+
|
70
|
+
or
|
71
|
+
|
72
|
+
- `cap <stage> deploy` (Capistrano 3).
|
73
|
+
|
54
74
|
## Advanced options
|
55
75
|
|
56
76
|
### Custom endpoint
|
data/capistrano-s3.gemspec
CHANGED
@@ -3,8 +3,8 @@ $:.unshift(File.dirname(__FILE__) + '/lib')
|
|
3
3
|
require 'capistrano/s3/version'
|
4
4
|
|
5
5
|
Gem::Specification.new do |s|
|
6
|
-
s.authors = ['Jean-Philippe Doyle','Josh Delsman','Aleksandrs Ļedovskis','Douglas Jarquin', 'Amit Barvaz']
|
7
|
-
s.email = ['jeanphilippe.doyle@hooktstudios.com']
|
6
|
+
s.authors = ['Jean-Philippe Doyle','Josh Delsman','Aleksandrs Ļedovskis','Douglas Jarquin', 'Amit Barvaz', 'Jan Lindblom']
|
7
|
+
s.email = ['jeanphilippe.doyle@hooktstudios.com', 'aleksandrs@ledovskis.lv']
|
8
8
|
s.description = 'Enables static websites deployment to Amazon S3 website buckets using Capistrano.'
|
9
9
|
s.summary = 'Build and deploy a static website to Amazon S3'
|
10
10
|
s.homepage = 'http://github.com/hooktstudios/capistrano-s3'
|
@@ -15,11 +15,19 @@ Gem::Specification.new do |s|
|
|
15
15
|
s.name = 'capistrano-s3'
|
16
16
|
s.require_paths = ['lib']
|
17
17
|
s.version = Capistrano::S3::VERSION
|
18
|
-
s.cert_chain = ['certs/
|
18
|
+
s.cert_chain = ['certs/aleksandrs-ledovskis.pem']
|
19
19
|
s.signing_key = File.expand_path("~/.ssh/gem-private_key.pem") if $0 =~ /gem\z/
|
20
20
|
|
21
21
|
# Gem dependencies
|
22
|
-
s.
|
23
|
-
s.
|
24
|
-
s.
|
22
|
+
s.add_runtime_dependency 'aws-sdk', '~> 1.11'
|
23
|
+
s.add_runtime_dependency 'capistrano', '>= 2'
|
24
|
+
s.add_runtime_dependency 'mime-types', '~> 1.23'
|
25
|
+
s.add_runtime_dependency 'net-ssh', '~> 2.9'
|
26
|
+
|
27
|
+
# Development dependencies
|
28
|
+
s.add_development_dependency 'rake'
|
29
|
+
s.add_development_dependency 'rspec'
|
30
|
+
s.add_development_dependency 'mocha'
|
31
|
+
s.add_development_dependency 'awesome_print'
|
32
|
+
s.add_development_dependency 'gem-release'
|
25
33
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
-----BEGIN CERTIFICATE-----
|
2
|
+
MIIDhTCCAm2gAwIBAgIBATANBgkqhkiG9w0BAQUFADBEMRMwEQYDVQQDDAphbGVr
|
3
|
+
c2FuZHJzMRkwFwYKCZImiZPyLGQBGRYJbGVkb3Zza2lzMRIwEAYKCZImiZPyLGQB
|
4
|
+
GRYCbHYwHhcNMTYwMTAzMTgwNjU5WhcNMTcwMTAyMTgwNjU5WjBEMRMwEQYDVQQD
|
5
|
+
DAphbGVrc2FuZHJzMRkwFwYKCZImiZPyLGQBGRYJbGVkb3Zza2lzMRIwEAYKCZIm
|
6
|
+
iZPyLGQBGRYCbHYwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC4ZS6n
|
7
|
+
v2xGstpdX2C2VYlIxJsaZ28u/vc05MA9qCYp2DsEb7956MHSRYWADOMmxHscLc6w
|
8
|
+
x79ecayifaDx8mQlKZ/sEM1jkHsm8rtL1Slm8nJoP1JBhbHa3ZHWHcwhi3pIS/JY
|
9
|
+
z19tSYHNzB8nFvVspfyjJT4tBtrXQCoNYFrTYYAn+UlpA1yYsDYeyRJJBhIakA5E
|
10
|
+
JW01InrCA2zUi0lyuhBBPZNkSaUFXSkXKxgJcTRln0PXCYTRsk21JqxeVQaLp2/y
|
11
|
+
oq7JFJacwxKANQI/rDpMrSrvtGQW2CMcXz+SqUQHsko8KGSh7w8EaxA0R9zPtsYg
|
12
|
+
Jg1fXc5spVlJH9sJAgMBAAGjgYEwfzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAd
|
13
|
+
BgNVHQ4EFgQUQO5dMalHx8ow/7njDvSCb5wPoTYwIgYDVR0RBBswGYEXYWxla3Nh
|
14
|
+
bmRyc0BsZWRvdnNraXMubHYwIgYDVR0SBBswGYEXYWxla3NhbmRyc0BsZWRvdnNr
|
15
|
+
aXMubHYwDQYJKoZIhvcNAQEFBQADggEBAHr6mHIB4Wagt+1rSYtZd55A3xkOk4/x
|
16
|
+
Pxg6EoAql/siXlhei+l5IDqTzqSBakw9NLXgrAIMYMmi6Y7ryv5dIHigf3rpvU9l
|
17
|
+
nmjW31hb/3hbY4rESjolO79Mdsawyh2ikG9FSb5CeLQDKCq9eJCfUbSYQ0FANhlb
|
18
|
+
v3op3Aa25YFxDpJnzPgOlChUvdo5NsbVyfqqqgtcPqMKO/1Tc91M7bg3nErOgMGR
|
19
|
+
JEnsJLaGVuWh+EfN0hAHmZTiTB7KQAxoxyyBRFGnmho+VAZCVhgvK4SOhLzTDGg3
|
20
|
+
jHydeDCzaagIJgK21Bl2UEaNGqHPU6bycWBr4SiiAqgf5Ebiz9da58A=
|
21
|
+
-----END CERTIFICATE-----
|
data/lib/capistrano/s3.rb
CHANGED
@@ -1,43 +1,10 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
Configuration.instance(true).load do
|
11
|
-
def _cset(name, *args, &block)
|
12
|
-
set(name, *args, &block) if !exists?(name)
|
13
|
-
end
|
14
|
-
|
15
|
-
_cset :deployment_path, Dir.pwd.gsub("\n", "") + "/public"
|
16
|
-
_cset :bucket_write_options, :acl => :public_read
|
17
|
-
_cset :s3_endpoint, 's3.amazonaws.com'
|
18
|
-
_cset :redirect_options, {}
|
19
|
-
|
20
|
-
# Deployment recipes
|
21
|
-
namespace :deploy do
|
22
|
-
namespace :s3 do
|
23
|
-
desc "Empties bucket of all files. Caution when using this command, as it cannot be undone!"
|
24
|
-
task :empty do
|
25
|
-
S3::Publisher.clear!(s3_endpoint, access_key_id, secret_access_key, bucket)
|
26
|
-
end
|
27
|
-
|
28
|
-
desc "Upload files to the bucket in the current state"
|
29
|
-
task :upload_files do
|
30
|
-
extra_options = { :write => bucket_write_options, :redirect => redirect_options }
|
31
|
-
S3::Publisher.publish!(s3_endpoint, access_key_id, secret_access_key,
|
32
|
-
bucket, deployment_path, extra_options)
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
task :update do
|
37
|
-
s3.upload_files
|
38
|
-
end
|
39
|
-
|
40
|
-
task :restart do; end
|
41
|
-
end
|
42
|
-
end
|
1
|
+
require "capistrano"
|
2
|
+
require "capistrano/s3/publisher"
|
3
|
+
require "capistrano/s3/version"
|
4
|
+
require "capistrano/s3/defaults"
|
5
|
+
|
6
|
+
if Gem::Specification.find_by_name('capistrano').version >= Gem::Version.new('3.0.0')
|
7
|
+
load File.expand_path('../tasks/capistrano_3.rb', __FILE__)
|
8
|
+
else
|
9
|
+
require_relative 'tasks/capistrano_2'
|
43
10
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Capistrano
|
2
|
+
module S3
|
3
|
+
module Defaults
|
4
|
+
DEFAULTS = {
|
5
|
+
:deployment_path => proc { Dir.pwd.gsub("\n", "") + "/public" },
|
6
|
+
:bucket_write_options => { :acl => :public_read },
|
7
|
+
:s3_endpoint => "s3.amazonaws.com",
|
8
|
+
:redirect_options => {},
|
9
|
+
}
|
10
|
+
|
11
|
+
def self.populate(context, set_method)
|
12
|
+
DEFAULTS.each do |key, value|
|
13
|
+
value = value.is_a?(Proc) ? value.call : value
|
14
|
+
context.send(set_method, key, value)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -2,93 +2,121 @@ require 'aws/s3'
|
|
2
2
|
require 'mime/types'
|
3
3
|
require 'fileutils'
|
4
4
|
|
5
|
-
module Capistrano
|
5
|
+
module Capistrano
|
6
|
+
module S3
|
7
|
+
module Publisher
|
8
|
+
LAST_PUBLISHED_FILE = '.last_published'
|
6
9
|
|
7
|
-
|
10
|
+
def self.publish!(s3_endpoint, key, secret, bucket, source, extra_options)
|
11
|
+
s3 = self.establish_s3_client_connection!(s3_endpoint, key, secret)
|
8
12
|
|
9
|
-
|
10
|
-
|
13
|
+
self.files(source).each do |file|
|
14
|
+
if !File.directory?(file)
|
15
|
+
next if self.published?(file)
|
11
16
|
|
12
|
-
|
13
|
-
|
14
|
-
next if self.published?(file)
|
17
|
+
path = self.base_file_path(source, file)
|
18
|
+
path.gsub!(/^\//, "") # Remove preceding slash for S3
|
15
19
|
|
16
|
-
|
17
|
-
|
20
|
+
self.put_object(s3, bucket, path, file, extra_options)
|
21
|
+
end
|
22
|
+
end
|
18
23
|
|
19
|
-
|
24
|
+
FileUtils.touch(LAST_PUBLISHED_FILE)
|
20
25
|
end
|
21
|
-
end
|
22
|
-
|
23
|
-
FileUtils.touch(LAST_PUBLISHED_FILE)
|
24
|
-
end
|
25
|
-
|
26
|
-
def self.clear!(s3_endpoint, key, secret, bucket)
|
27
|
-
s3 = self.establish_s3_connection!(s3_endpoint, key, secret)
|
28
|
-
s3.buckets[bucket].clear!
|
29
|
-
|
30
|
-
FileUtils.rm(LAST_PUBLISHED_FILE)
|
31
|
-
end
|
32
|
-
|
33
|
-
private
|
34
|
-
|
35
|
-
# Establishes the connection to Amazon S3
|
36
|
-
def self.establish_connection!(klass, s3_endpoint, key, secret)
|
37
|
-
# Send logging to STDOUT
|
38
|
-
AWS.config(:logger => Logger.new(STDOUT))
|
39
|
-
klass.new(
|
40
|
-
:s3_endpoint => s3_endpoint,
|
41
|
-
:access_key_id => key,
|
42
|
-
:secret_access_key => secret
|
43
|
-
)
|
44
|
-
end
|
45
|
-
|
46
|
-
def self.establish_s3_client_connection!(s3_endpoint, key, secret)
|
47
|
-
self.establish_connection!(AWS::S3::Client, s3_endpoint, key, secret)
|
48
|
-
end
|
49
|
-
|
50
|
-
def self.establish_s3_connection!(s3_endpoint, key, secret)
|
51
|
-
self.establish_connection!(AWS::S3, s3_endpoint, key, secret)
|
52
|
-
end
|
53
|
-
|
54
|
-
def self.base_file_path(root, file)
|
55
|
-
file.gsub(root, "")
|
56
|
-
end
|
57
|
-
|
58
|
-
def self.files(deployment_path)
|
59
|
-
Dir.glob("#{deployment_path}/**/*")
|
60
|
-
end
|
61
26
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
end
|
27
|
+
def self.clear!(s3_endpoint, key, secret, bucket)
|
28
|
+
s3 = self.establish_s3_connection!(s3_endpoint, key, secret)
|
29
|
+
s3.buckets[bucket].clear!
|
66
30
|
|
67
|
-
|
68
|
-
|
69
|
-
:bucket_name => bucket,
|
70
|
-
:key => path,
|
71
|
-
:data => open(file),
|
72
|
-
:acl => :public_read,
|
73
|
-
}
|
74
|
-
|
75
|
-
options.merge!(self.build_content_type_hash(file))
|
76
|
-
options.merge!(self.build_redirect_hash(path, extra_options[:redirect]))
|
77
|
-
options.merge!(extra_options[:write]) if extra_options[:write]
|
78
|
-
|
79
|
-
s3.put_object(options)
|
80
|
-
end
|
81
|
-
|
82
|
-
def self.build_content_type_hash(file)
|
83
|
-
type = MIME::Types.type_for(File.basename(file))
|
84
|
-
return {} unless type && !type.empty?
|
85
|
-
|
86
|
-
{ :content_type => type.first.content_type }
|
87
|
-
end
|
88
|
-
|
89
|
-
def self.build_redirect_hash(path, redirect_options)
|
90
|
-
return {} unless redirect_options && redirect_options[path]
|
31
|
+
FileUtils.rm(LAST_PUBLISHED_FILE)
|
32
|
+
end
|
91
33
|
|
92
|
-
|
34
|
+
private
|
35
|
+
|
36
|
+
# Establishes the connection to Amazon S3
|
37
|
+
def self.establish_connection!(klass, s3_endpoint, key, secret)
|
38
|
+
# Send logging to STDOUT
|
39
|
+
AWS.config(:logger => ::Logger.new(STDOUT))
|
40
|
+
klass.new(
|
41
|
+
:s3_endpoint => s3_endpoint,
|
42
|
+
:access_key_id => key,
|
43
|
+
:secret_access_key => secret
|
44
|
+
)
|
45
|
+
end
|
46
|
+
|
47
|
+
def self.establish_s3_client_connection!(s3_endpoint, key, secret)
|
48
|
+
self.establish_connection!(AWS::S3::Client, s3_endpoint, key, secret)
|
49
|
+
end
|
50
|
+
|
51
|
+
def self.establish_s3_connection!(s3_endpoint, key, secret)
|
52
|
+
self.establish_connection!(AWS::S3, s3_endpoint, key, secret)
|
53
|
+
end
|
54
|
+
|
55
|
+
def self.base_file_path(root, file)
|
56
|
+
file.gsub(root, "")
|
57
|
+
end
|
58
|
+
|
59
|
+
def self.files(deployment_path)
|
60
|
+
Dir.glob("#{deployment_path}/**/*")
|
61
|
+
end
|
62
|
+
|
63
|
+
def self.published?(file)
|
64
|
+
return false unless File.exists? LAST_PUBLISHED_FILE
|
65
|
+
File.mtime(file) < File.mtime(LAST_PUBLISHED_FILE)
|
66
|
+
end
|
67
|
+
|
68
|
+
def self.put_object(s3, bucket, path, file, extra_options)
|
69
|
+
base_name = File.basename(file)
|
70
|
+
mime_type = mime_type_for_file(base_name)
|
71
|
+
options = {
|
72
|
+
:bucket_name => bucket,
|
73
|
+
:key => path,
|
74
|
+
:data => open(file),
|
75
|
+
:acl => :public_read,
|
76
|
+
}
|
77
|
+
|
78
|
+
options.merge!(build_redirect_hash(path, extra_options[:redirect]))
|
79
|
+
options.merge!(extra_options[:write] || {})
|
80
|
+
|
81
|
+
if mime_type
|
82
|
+
options.merge!(build_content_type_hash(mime_type))
|
83
|
+
|
84
|
+
if mime_type.sub_type == "gzip"
|
85
|
+
options.merge!(build_gzip_content_encoding_hash)
|
86
|
+
options.merge!(build_gzip_content_type_hash(file, mime_type))
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
s3.put_object(options)
|
91
|
+
end
|
92
|
+
|
93
|
+
def self.build_redirect_hash(path, redirect_options)
|
94
|
+
return {} unless redirect_options && redirect_options[path]
|
95
|
+
|
96
|
+
{ :website_redirect_location => redirect_options[path] }
|
97
|
+
end
|
98
|
+
|
99
|
+
def self.build_content_type_hash(mime_type)
|
100
|
+
{ :content_type => mime_type.content_type }
|
101
|
+
end
|
102
|
+
|
103
|
+
def self.build_gzip_content_encoding_hash
|
104
|
+
{ :content_encoding => "gzip" }
|
105
|
+
end
|
106
|
+
|
107
|
+
def self.build_gzip_content_type_hash(file, mime_type)
|
108
|
+
orig_name = file.sub(/\.gz$/, "")
|
109
|
+
orig_mime = mime_type_for_file(orig_name)
|
110
|
+
|
111
|
+
return {} unless orig_mime && File.exist?(orig_name)
|
112
|
+
|
113
|
+
{ :content_type => orig_mime.content_type }
|
114
|
+
end
|
115
|
+
|
116
|
+
def self.mime_type_for_file(file)
|
117
|
+
type = MIME::Types.type_for(file)
|
118
|
+
(type && !type.empty?) ? type[0] : nil
|
119
|
+
end
|
93
120
|
end
|
121
|
+
end
|
94
122
|
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Capistrano
|
2
|
+
Configuration.instance(true).load do
|
3
|
+
def _cset(name, *args, &block)
|
4
|
+
set(name, *args, &block) if !exists?(name)
|
5
|
+
end
|
6
|
+
|
7
|
+
Capistrano::S3::Defaults.populate(self, :_cset)
|
8
|
+
|
9
|
+
# Deployment recipes
|
10
|
+
namespace :deploy do
|
11
|
+
namespace :s3 do
|
12
|
+
desc "Empties bucket of all files. Caution when using this command, as it cannot be undone!"
|
13
|
+
task :empty do
|
14
|
+
S3::Publisher.clear!(s3_endpoint, access_key_id, secret_access_key, bucket)
|
15
|
+
end
|
16
|
+
|
17
|
+
desc "Upload files to the bucket in the current state"
|
18
|
+
task :upload_files do
|
19
|
+
extra_options = { :write => bucket_write_options, :redirect => redirect_options }
|
20
|
+
S3::Publisher.publish!(s3_endpoint, access_key_id, secret_access_key,
|
21
|
+
bucket, deployment_path, extra_options)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
task :update do
|
26
|
+
s3.upload_files
|
27
|
+
end
|
28
|
+
|
29
|
+
task :restart do; end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
namespace :load do
|
2
|
+
task :defaults do
|
3
|
+
Capistrano::S3::Defaults.populate(self, :set)
|
4
|
+
end
|
5
|
+
end
|
6
|
+
|
7
|
+
namespace :deploy do
|
8
|
+
namespace :s3 do
|
9
|
+
desc "Empties bucket of all files. Caution when using this command, as it cannot be undone!"
|
10
|
+
task :empty do
|
11
|
+
Capistrano::S3::Publisher.clear!(fetch(:s3_endpoint), fetch(:access_key_id), fetch(:secret_access_key), fetch(:bucket))
|
12
|
+
end
|
13
|
+
|
14
|
+
desc "Upload files to the bucket in the current state"
|
15
|
+
task :upload_files do
|
16
|
+
extra_options = { :write => fetch(:bucket_write_options), :redirect => fetch(:redirect_options) }
|
17
|
+
Capistrano::S3::Publisher.publish!(fetch(:s3_endpoint), fetch(:access_key_id), fetch(:secret_access_key),
|
18
|
+
fetch(:bucket), fetch(:deployment_path), extra_options)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
before :updated, :upload_s3 do
|
23
|
+
invoke("deploy:s3:upload_files")
|
24
|
+
end
|
25
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-s3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jean-Philippe Doyle
|
@@ -9,33 +9,33 @@ authors:
|
|
9
9
|
- Aleksandrs Ļedovskis
|
10
10
|
- Douglas Jarquin
|
11
11
|
- Amit Barvaz
|
12
|
+
- Jan Lindblom
|
12
13
|
autorequire:
|
13
14
|
bindir: bin
|
14
15
|
cert_chain:
|
15
16
|
- |
|
16
17
|
-----BEGIN CERTIFICATE-----
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
9tXfRi8fswcQo96T+yg=
|
18
|
+
MIIDhTCCAm2gAwIBAgIBATANBgkqhkiG9w0BAQUFADBEMRMwEQYDVQQDDAphbGVr
|
19
|
+
c2FuZHJzMRkwFwYKCZImiZPyLGQBGRYJbGVkb3Zza2lzMRIwEAYKCZImiZPyLGQB
|
20
|
+
GRYCbHYwHhcNMTYwMTAzMTgwNjU5WhcNMTcwMTAyMTgwNjU5WjBEMRMwEQYDVQQD
|
21
|
+
DAphbGVrc2FuZHJzMRkwFwYKCZImiZPyLGQBGRYJbGVkb3Zza2lzMRIwEAYKCZIm
|
22
|
+
iZPyLGQBGRYCbHYwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC4ZS6n
|
23
|
+
v2xGstpdX2C2VYlIxJsaZ28u/vc05MA9qCYp2DsEb7956MHSRYWADOMmxHscLc6w
|
24
|
+
x79ecayifaDx8mQlKZ/sEM1jkHsm8rtL1Slm8nJoP1JBhbHa3ZHWHcwhi3pIS/JY
|
25
|
+
z19tSYHNzB8nFvVspfyjJT4tBtrXQCoNYFrTYYAn+UlpA1yYsDYeyRJJBhIakA5E
|
26
|
+
JW01InrCA2zUi0lyuhBBPZNkSaUFXSkXKxgJcTRln0PXCYTRsk21JqxeVQaLp2/y
|
27
|
+
oq7JFJacwxKANQI/rDpMrSrvtGQW2CMcXz+SqUQHsko8KGSh7w8EaxA0R9zPtsYg
|
28
|
+
Jg1fXc5spVlJH9sJAgMBAAGjgYEwfzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAd
|
29
|
+
BgNVHQ4EFgQUQO5dMalHx8ow/7njDvSCb5wPoTYwIgYDVR0RBBswGYEXYWxla3Nh
|
30
|
+
bmRyc0BsZWRvdnNraXMubHYwIgYDVR0SBBswGYEXYWxla3NhbmRyc0BsZWRvdnNr
|
31
|
+
aXMubHYwDQYJKoZIhvcNAQEFBQADggEBAHr6mHIB4Wagt+1rSYtZd55A3xkOk4/x
|
32
|
+
Pxg6EoAql/siXlhei+l5IDqTzqSBakw9NLXgrAIMYMmi6Y7ryv5dIHigf3rpvU9l
|
33
|
+
nmjW31hb/3hbY4rESjolO79Mdsawyh2ikG9FSb5CeLQDKCq9eJCfUbSYQ0FANhlb
|
34
|
+
v3op3Aa25YFxDpJnzPgOlChUvdo5NsbVyfqqqgtcPqMKO/1Tc91M7bg3nErOgMGR
|
35
|
+
JEnsJLaGVuWh+EfN0hAHmZTiTB7KQAxoxyyBRFGnmho+VAZCVhgvK4SOhLzTDGg3
|
36
|
+
jHydeDCzaagIJgK21Bl2UEaNGqHPU6bycWBr4SiiAqgf5Ebiz9da58A=
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date:
|
38
|
+
date: 2016-01-03 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: aws-sdk
|
@@ -55,16 +55,16 @@ dependencies:
|
|
55
55
|
name: capistrano
|
56
56
|
requirement: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
|
-
- - "
|
58
|
+
- - ">="
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version: '
|
60
|
+
version: '2'
|
61
61
|
type: :runtime
|
62
62
|
prerelease: false
|
63
63
|
version_requirements: !ruby/object:Gem::Requirement
|
64
64
|
requirements:
|
65
|
-
- - "
|
65
|
+
- - ">="
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version: '
|
67
|
+
version: '2'
|
68
68
|
- !ruby/object:Gem::Dependency
|
69
69
|
name: mime-types
|
70
70
|
requirement: !ruby/object:Gem::Requirement
|
@@ -79,10 +79,95 @@ dependencies:
|
|
79
79
|
- - "~>"
|
80
80
|
- !ruby/object:Gem::Version
|
81
81
|
version: '1.23'
|
82
|
+
- !ruby/object:Gem::Dependency
|
83
|
+
name: net-ssh
|
84
|
+
requirement: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - "~>"
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '2.9'
|
89
|
+
type: :runtime
|
90
|
+
prerelease: false
|
91
|
+
version_requirements: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - "~>"
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '2.9'
|
96
|
+
- !ruby/object:Gem::Dependency
|
97
|
+
name: rake
|
98
|
+
requirement: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - ">="
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
103
|
+
type: :development
|
104
|
+
prerelease: false
|
105
|
+
version_requirements: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - ">="
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: rspec
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - ">="
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '0'
|
117
|
+
type: :development
|
118
|
+
prerelease: false
|
119
|
+
version_requirements: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - ">="
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: '0'
|
124
|
+
- !ruby/object:Gem::Dependency
|
125
|
+
name: mocha
|
126
|
+
requirement: !ruby/object:Gem::Requirement
|
127
|
+
requirements:
|
128
|
+
- - ">="
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: '0'
|
131
|
+
type: :development
|
132
|
+
prerelease: false
|
133
|
+
version_requirements: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - ">="
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '0'
|
138
|
+
- !ruby/object:Gem::Dependency
|
139
|
+
name: awesome_print
|
140
|
+
requirement: !ruby/object:Gem::Requirement
|
141
|
+
requirements:
|
142
|
+
- - ">="
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: '0'
|
145
|
+
type: :development
|
146
|
+
prerelease: false
|
147
|
+
version_requirements: !ruby/object:Gem::Requirement
|
148
|
+
requirements:
|
149
|
+
- - ">="
|
150
|
+
- !ruby/object:Gem::Version
|
151
|
+
version: '0'
|
152
|
+
- !ruby/object:Gem::Dependency
|
153
|
+
name: gem-release
|
154
|
+
requirement: !ruby/object:Gem::Requirement
|
155
|
+
requirements:
|
156
|
+
- - ">="
|
157
|
+
- !ruby/object:Gem::Version
|
158
|
+
version: '0'
|
159
|
+
type: :development
|
160
|
+
prerelease: false
|
161
|
+
version_requirements: !ruby/object:Gem::Requirement
|
162
|
+
requirements:
|
163
|
+
- - ">="
|
164
|
+
- !ruby/object:Gem::Version
|
165
|
+
version: '0'
|
82
166
|
description: Enables static websites deployment to Amazon S3 website buckets using
|
83
167
|
Capistrano.
|
84
168
|
email:
|
85
169
|
- jeanphilippe.doyle@hooktstudios.com
|
170
|
+
- aleksandrs@ledovskis.lv
|
86
171
|
executables: []
|
87
172
|
extensions: []
|
88
173
|
extra_rdoc_files: []
|
@@ -92,15 +177,18 @@ files:
|
|
92
177
|
- CHANGELOG.md
|
93
178
|
- CONTRIBUTING.md
|
94
179
|
- Gemfile
|
95
|
-
- Gemfile.lock
|
96
180
|
- LICENSE
|
97
181
|
- README.md
|
98
182
|
- Rakefile
|
99
183
|
- capistrano-s3.gemspec
|
184
|
+
- certs/aleksandrs-ledovskis.pem
|
100
185
|
- certs/j15e.pem
|
101
186
|
- lib/capistrano/s3.rb
|
187
|
+
- lib/capistrano/s3/defaults.rb
|
102
188
|
- lib/capistrano/s3/publisher.rb
|
103
189
|
- lib/capistrano/s3/version.rb
|
190
|
+
- lib/capistrano/tasks/capistrano_2.rb
|
191
|
+
- lib/capistrano/tasks/capistrano_3.rb
|
104
192
|
- spec/publisher_spec.rb
|
105
193
|
- spec/sample/fonts/cantarell-regular-webfont.eot
|
106
194
|
- spec/sample/fonts/cantarell-regular-webfont.svg
|
@@ -127,7 +215,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
127
215
|
version: '0'
|
128
216
|
requirements: []
|
129
217
|
rubyforge_project:
|
130
|
-
rubygems_version: 2.4.
|
218
|
+
rubygems_version: 2.4.5
|
131
219
|
signing_key:
|
132
220
|
specification_version: 4
|
133
221
|
summary: Build and deploy a static website to Amazon S3
|
metadata.gz.sig
CHANGED
Binary file
|
data/Gemfile.lock
DELETED
@@ -1,65 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
capistrano-s3 (0.2.11)
|
5
|
-
aws-sdk (~> 1.11)
|
6
|
-
capistrano (< 3)
|
7
|
-
mime-types (~> 1.23)
|
8
|
-
|
9
|
-
GEM
|
10
|
-
remote: https://rubygems.org/
|
11
|
-
specs:
|
12
|
-
awesome_print (1.2.0)
|
13
|
-
aws-sdk (1.61.0)
|
14
|
-
aws-sdk-v1 (= 1.61.0)
|
15
|
-
aws-sdk-v1 (1.61.0)
|
16
|
-
json (~> 1.4)
|
17
|
-
nokogiri (>= 1.4.4)
|
18
|
-
capistrano (2.15.5)
|
19
|
-
highline
|
20
|
-
net-scp (>= 1.0.0)
|
21
|
-
net-sftp (>= 2.0.0)
|
22
|
-
net-ssh (>= 2.0.14)
|
23
|
-
net-ssh-gateway (>= 1.1.0)
|
24
|
-
diff-lcs (1.2.5)
|
25
|
-
gem-release (0.7.3)
|
26
|
-
highline (1.6.21)
|
27
|
-
json (1.8.2)
|
28
|
-
metaclass (0.0.4)
|
29
|
-
mime-types (1.25.1)
|
30
|
-
mini_portile (0.6.2)
|
31
|
-
mocha (1.1.0)
|
32
|
-
metaclass (~> 0.0.1)
|
33
|
-
net-scp (1.2.1)
|
34
|
-
net-ssh (>= 2.6.5)
|
35
|
-
net-sftp (2.1.2)
|
36
|
-
net-ssh (>= 2.6.5)
|
37
|
-
net-ssh (2.9.2)
|
38
|
-
net-ssh-gateway (1.2.0)
|
39
|
-
net-ssh (>= 2.6.5)
|
40
|
-
nokogiri (1.6.6.2)
|
41
|
-
mini_portile (~> 0.6.0)
|
42
|
-
rake (10.3.2)
|
43
|
-
rspec (3.0.0)
|
44
|
-
rspec-core (~> 3.0.0)
|
45
|
-
rspec-expectations (~> 3.0.0)
|
46
|
-
rspec-mocks (~> 3.0.0)
|
47
|
-
rspec-core (3.0.0)
|
48
|
-
rspec-support (~> 3.0.0)
|
49
|
-
rspec-expectations (3.0.0)
|
50
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
51
|
-
rspec-support (~> 3.0.0)
|
52
|
-
rspec-mocks (3.0.0)
|
53
|
-
rspec-support (~> 3.0.0)
|
54
|
-
rspec-support (3.0.0)
|
55
|
-
|
56
|
-
PLATFORMS
|
57
|
-
ruby
|
58
|
-
|
59
|
-
DEPENDENCIES
|
60
|
-
awesome_print
|
61
|
-
capistrano-s3!
|
62
|
-
gem-release
|
63
|
-
mocha
|
64
|
-
rake
|
65
|
-
rspec
|