capistrano-s3 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -18
- data/CONTRIBUTING.md +23 -0
- data/Gemfile.lock +41 -0
- data/NEWS +4 -0
- data/README.md +22 -10
- data/Rakefile +1 -11
- data/capistrano-s3.gemspec +1 -3
- data/lib/capistrano/s3/publisher.rb +11 -0
- metadata +4 -34
data/.gitignore
CHANGED
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# Contributing
|
2
|
+
|
3
|
+
> If I have seen further, it is by standing on the shoulders of giants. - Isaac Newton
|
4
|
+
|
5
|
+
We love to work with people around the globe and make earth a better place for mankind!
|
6
|
+
|
7
|
+
Please follow theses simples steps to contribute to this project :
|
8
|
+
|
9
|
+
1. Fork the repo.
|
10
|
+
|
11
|
+
2. Rebase your code onto upstream master (this repository) if not up to date.
|
12
|
+
|
13
|
+
3. Squash or fixup your commits to achieve a clean commit log.
|
14
|
+
|
15
|
+
4. Submit a pull request explaining clearly changes.
|
16
|
+
|
17
|
+
## Running the tests
|
18
|
+
|
19
|
+
I am sorry [wilson](http://www.youtube.com/watch?v=wO_MYX_Oto0), there is no tests.
|
20
|
+
|
21
|
+
## Syntax
|
22
|
+
|
23
|
+
Follow [Ruby Styleguide](https://github.com/styleguide/ruby) by Github and existing code.
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
capistrano-s3 (0.2.4)
|
5
|
+
aws-sdk
|
6
|
+
capistrano
|
7
|
+
mime-types
|
8
|
+
|
9
|
+
GEM
|
10
|
+
remote: http://rubygems.org/
|
11
|
+
specs:
|
12
|
+
aws-sdk (1.8.3.1)
|
13
|
+
json (~> 1.4)
|
14
|
+
nokogiri (>= 1.4.4)
|
15
|
+
uuidtools (~> 2.1)
|
16
|
+
capistrano (2.14.2)
|
17
|
+
highline
|
18
|
+
net-scp (>= 1.0.0)
|
19
|
+
net-sftp (>= 2.0.0)
|
20
|
+
net-ssh (>= 2.0.14)
|
21
|
+
net-ssh-gateway (>= 1.1.0)
|
22
|
+
highline (1.6.15)
|
23
|
+
json (1.7.7)
|
24
|
+
mime-types (1.21)
|
25
|
+
net-scp (1.1.0)
|
26
|
+
net-ssh (>= 2.6.5)
|
27
|
+
net-sftp (2.1.1)
|
28
|
+
net-ssh (>= 2.6.5)
|
29
|
+
net-ssh (2.6.5)
|
30
|
+
net-ssh-gateway (1.2.0)
|
31
|
+
net-ssh (>= 2.6.5)
|
32
|
+
nokogiri (1.5.6)
|
33
|
+
rake (10.0.3)
|
34
|
+
uuidtools (2.1.3)
|
35
|
+
|
36
|
+
PLATFORMS
|
37
|
+
ruby
|
38
|
+
|
39
|
+
DEPENDENCIES
|
40
|
+
capistrano-s3!
|
41
|
+
rake
|
data/NEWS
CHANGED
data/README.md
CHANGED
@@ -3,7 +3,8 @@
|
|
3
3
|
> Enables static websites deployment to Amazon S3 website buckets using Capistrano.
|
4
4
|
|
5
5
|
[![Dependency Status](https://gemnasium.com/hooktstudios/capistrano-s3.png)](https://gemnasium.com/hooktstudios/capistrano-s3)
|
6
|
-
[![Code Climate](https://codeclimate.com/
|
6
|
+
[![Code Climate](https://codeclimate.com/github/hooktstudios/capistrano-s3.png)](https://codeclimate.com/github/hooktstudios/capistrano-s3)
|
7
|
+
[![Gem Version](https://badge.fury.io/rb/capistrano-s3.png)](https://rubygems.org/gems/capistrano-s3)
|
7
8
|
|
8
9
|
## Hosting your website with Amazon S3
|
9
10
|
|
@@ -27,7 +28,7 @@ capistrano-s3 overrides the default Capistrano recipes for Rails projects with i
|
|
27
28
|
|
28
29
|
```ruby
|
29
30
|
# config/deploy.rb
|
30
|
-
require 'capistrano
|
31
|
+
require 'capistrano/s3'
|
31
32
|
|
32
33
|
set :bucket, "www.cool-website-bucket.com"
|
33
34
|
set :access_key_id, "CHANGETHIS"
|
@@ -50,16 +51,15 @@ set :bucket_write_options, {
|
|
50
51
|
|
51
52
|
See aws-sdk [S3Object.write doc](http://rubydoc.info/github/amazonwebservices/aws-sdk-for-ruby/master/AWS/S3/S3Object#write-instance_method) for all available options.
|
52
53
|
|
53
|
-
|
54
|
+
## Exemple of usage
|
54
55
|
|
55
|
-
|
56
|
-
is using a combination of :
|
56
|
+
Our Ruby stack for static websites :
|
57
57
|
|
58
|
-
- [sinatra](https://github.com/sinatra/sinatra) : simple web framework
|
59
|
-
- [sinatra-assetpack](https://github.com/
|
60
|
-
- [sinatra-export](https://github.com/hooktstudios/sinatra-export) :
|
58
|
+
- [sinatra](https://github.com/sinatra/sinatra) : awesome simple ruby web framework
|
59
|
+
- [sinatra-assetpack](https://github.com/rstacruz/sinatra-assetpack) : deals with assets management, build static files into `public/`
|
60
|
+
- [sinatra-export](https://github.com/hooktstudios/sinatra-export) : exports all sinatra routes into `public/` as html or other common formats (json, csv, etc)
|
61
61
|
|
62
|
-
|
62
|
+
Mixing it in a capistrano task :
|
63
63
|
|
64
64
|
```ruby
|
65
65
|
# config/deploy.rb
|
@@ -67,4 +67,16 @@ before 'deploy' do
|
|
67
67
|
run_locally "bundle exec ruby sinatra:export"
|
68
68
|
run_locally "bundle exec rake assetpack:build"
|
69
69
|
end
|
70
|
-
```
|
70
|
+
```
|
71
|
+
|
72
|
+
See our boilerplate [sinatra-static-bp](https://github.com/hooktstudios/sinatra-static-bp) for an exemple of the complete setup.
|
73
|
+
|
74
|
+
## Contributing
|
75
|
+
|
76
|
+
See [CONTRIBUTING.md](https://github.com/hooktstudios/capistrano-s3/blob/master/CONTRIBUTING.md) for more details on contributing and running test.
|
77
|
+
|
78
|
+
## Credits
|
79
|
+
|
80
|
+
![hooktstudios](http://hooktstudios.com/logo.png)
|
81
|
+
|
82
|
+
[capistrano-s3](https://rubygems.org/gems/capistrano-s3) is maintained and funded by [hooktstudios](http://github.com/hooktstudios)
|
data/Rakefile
CHANGED
data/capistrano-s3.gemspec
CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
|
|
12
12
|
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
13
13
|
s.name = 'capistrano-s3'
|
14
14
|
s.require_paths = ['lib']
|
15
|
-
s.version = '0.2.
|
15
|
+
s.version = '0.2.4'
|
16
16
|
|
17
17
|
# Gem dependencies
|
18
18
|
s.add_dependency 'aws-sdk'
|
@@ -20,6 +20,4 @@ Gem::Specification.new do |s|
|
|
20
20
|
s.add_dependency 'mime-types'
|
21
21
|
|
22
22
|
s.add_development_dependency 'rake'
|
23
|
-
s.add_development_dependency 'rspec'
|
24
|
-
s.add_development_dependency 'mocha'
|
25
23
|
end
|
@@ -3,11 +3,15 @@ require 'mime/types'
|
|
3
3
|
|
4
4
|
module Publisher
|
5
5
|
|
6
|
+
LAST_PUBLISHED_FILE = '.last_published'
|
7
|
+
|
6
8
|
def self.publish!(key, secret, bucket, source, extra_options)
|
7
9
|
s3 = self.establish_connection!(key, secret)
|
8
10
|
|
9
11
|
self.files(source).each do |file|
|
10
12
|
if !File.directory?(file)
|
13
|
+
next if self.published?(file)
|
14
|
+
|
11
15
|
path = self.base_file_path(source, file)
|
12
16
|
path.gsub!(/^\//, "") # Remove preceding slash for S3
|
13
17
|
|
@@ -28,6 +32,8 @@ module Publisher
|
|
28
32
|
s3.buckets[bucket].objects[path].write(contents, options)
|
29
33
|
end
|
30
34
|
end
|
35
|
+
|
36
|
+
FileUtils.touch(LAST_PUBLISHED_FILE)
|
31
37
|
end
|
32
38
|
|
33
39
|
def self.clear!(key, secret, bucket)
|
@@ -54,4 +60,9 @@ module Publisher
|
|
54
60
|
def self.files(deployment_path)
|
55
61
|
Dir.glob("#{deployment_path}/**/*")
|
56
62
|
end
|
63
|
+
|
64
|
+
def self.published?(file)
|
65
|
+
return false unless File.exists? LAST_PUBLISHED_FILE
|
66
|
+
File.mtime(file) < File.mtime(LAST_PUBLISHED_FILE)
|
67
|
+
end
|
57
68
|
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.2.
|
4
|
+
version: 0.2.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-02
|
13
|
+
date: 2013-03-02 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: aws-sdk
|
@@ -76,38 +76,6 @@ dependencies:
|
|
76
76
|
- !ruby/object:Gem::Version
|
77
77
|
version: '0'
|
78
78
|
none: false
|
79
|
-
- !ruby/object:Gem::Dependency
|
80
|
-
name: rspec
|
81
|
-
prerelease: false
|
82
|
-
requirement: !ruby/object:Gem::Requirement
|
83
|
-
requirements:
|
84
|
-
- - ! '>='
|
85
|
-
- !ruby/object:Gem::Version
|
86
|
-
version: '0'
|
87
|
-
none: false
|
88
|
-
type: :development
|
89
|
-
version_requirements: !ruby/object:Gem::Requirement
|
90
|
-
requirements:
|
91
|
-
- - ! '>='
|
92
|
-
- !ruby/object:Gem::Version
|
93
|
-
version: '0'
|
94
|
-
none: false
|
95
|
-
- !ruby/object:Gem::Dependency
|
96
|
-
name: mocha
|
97
|
-
prerelease: false
|
98
|
-
requirement: !ruby/object:Gem::Requirement
|
99
|
-
requirements:
|
100
|
-
- - ! '>='
|
101
|
-
- !ruby/object:Gem::Version
|
102
|
-
version: '0'
|
103
|
-
none: false
|
104
|
-
type: :development
|
105
|
-
version_requirements: !ruby/object:Gem::Requirement
|
106
|
-
requirements:
|
107
|
-
- - ! '>='
|
108
|
-
- !ruby/object:Gem::Version
|
109
|
-
version: '0'
|
110
|
-
none: false
|
111
79
|
description: Enables static websites deployment to Amazon S3 website buckets using
|
112
80
|
Capistrano.
|
113
81
|
email:
|
@@ -117,7 +85,9 @@ extensions: []
|
|
117
85
|
extra_rdoc_files: []
|
118
86
|
files:
|
119
87
|
- .gitignore
|
88
|
+
- CONTRIBUTING.md
|
120
89
|
- Gemfile
|
90
|
+
- Gemfile.lock
|
121
91
|
- LICENSE
|
122
92
|
- NEWS
|
123
93
|
- README.md
|