capistrano-tarball 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +58 -0
- data/Rakefile +2 -0
- data/capistrano-tarball.gemspec +19 -0
- data/lib/capistrano/tarball/load.rb +3 -0
- data/lib/capistrano/tarball.rb +49 -0
- data/lib/capistrano/tasks/load.rake +59 -0
- data/lib/capistrano/tasks/tarball.rake +45 -0
- data/lib/capistrano-tarball.rb +0 -0
- metadata +69 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d4a1dc27013ffbc25ed7566869e73cd30f639c73
|
4
|
+
data.tar.gz: 3339996e0cb6d82d8d8afb1cee88e6a25dd61b59
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9d1488260aa7d1f91b1787062fa1d04c11fdb9761d465fae1a0822de9a43cb7af503f309b9520384709deeaf0de4ad48e9c882abe1ffeeeeddf98bace1b3878f
|
7
|
+
data.tar.gz: e93981b9f96086420d4c106ab33dbc37955d4c9b114e50d69c24a2dbca2c8fb683f386975d0d886e040a23339ece093f09095a495fc29533aa9f89f52cc387dd
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Aaron Qian
|
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,58 @@
|
|
1
|
+
# Capistrano::Tarball
|
2
|
+
|
3
|
+
**Note: this plugin works only with Capistrano 3.**
|
4
|
+
|
5
|
+
### About
|
6
|
+
|
7
|
+
Capistrano Tarball plugin allows the deployment of your apps via a tarball. This plugin does the following for you:
|
8
|
+
|
9
|
+
* Packages your source code / compiled binary into a tarball.
|
10
|
+
* Uploads the tarball to remote servers.
|
11
|
+
* Extract the tarball to `release_path`
|
12
|
+
|
13
|
+
### Installation
|
14
|
+
|
15
|
+
Put the following in your application's `Gemfile`:
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
group :development do
|
19
|
+
gem 'capistrano', '~> 3.2.0'
|
20
|
+
gem 'capistrano-tarball', require: false
|
21
|
+
end
|
22
|
+
```
|
23
|
+
|
24
|
+
Then:
|
25
|
+
|
26
|
+
```
|
27
|
+
$ bundle install
|
28
|
+
```
|
29
|
+
|
30
|
+
### Usage
|
31
|
+
|
32
|
+
Put the following in your application's `Capfile`:
|
33
|
+
|
34
|
+
```ruby
|
35
|
+
require 'capistrano/setup'
|
36
|
+
require 'capistrano/deploy'
|
37
|
+
require 'capistrano/tarball/load'
|
38
|
+
```
|
39
|
+
|
40
|
+
Then set the `scm` to `tarball` in your `deploy.rb`:
|
41
|
+
|
42
|
+
```ruby
|
43
|
+
# Yeah, I know... tarball is not really a SCM, but trust me...
|
44
|
+
set :scm, :tarball
|
45
|
+
```
|
46
|
+
|
47
|
+
### Configurations
|
48
|
+
|
49
|
+
Please see: [defaults.rb](https://github.com/aq1018/capistrano-tarball/blob/master/lib/capistrano/tarball/defaults.rb)
|
50
|
+
|
51
|
+
|
52
|
+
### Contributing
|
53
|
+
|
54
|
+
1. Fork it ( https://github.com/[my-github-username]/capistrano-binary/fork )
|
55
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
56
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
57
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
58
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
spec.name = "capistrano-tarball"
|
5
|
+
spec.version = "0.1.1"
|
6
|
+
spec.authors = ["Aaron Qian"]
|
7
|
+
spec.email = ["aq1018@gmail.com"]
|
8
|
+
spec.summary = %q{Capistrano tarball strategy}
|
9
|
+
spec.description = %q{Deploy your apps via tarball instead of scm}
|
10
|
+
spec.homepage = ""
|
11
|
+
spec.license = "MIT"
|
12
|
+
|
13
|
+
spec.files = `git ls-files -z`.split("\x0")
|
14
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
15
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
16
|
+
spec.require_paths = ["lib"]
|
17
|
+
|
18
|
+
spec.add_dependency 'capistrano', '>= 3.2.0'
|
19
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
load File.expand_path("../tasks/tarball.rake", __FILE__)
|
2
|
+
|
3
|
+
require 'tmpdir'
|
4
|
+
require 'capistrano/scm'
|
5
|
+
|
6
|
+
class Capistrano::Tarball < Capistrano::SCM
|
7
|
+
def name
|
8
|
+
fetch(:tarball_name)
|
9
|
+
end
|
10
|
+
|
11
|
+
def package_cmd
|
12
|
+
fetch(:tarball_package_cmd)
|
13
|
+
end
|
14
|
+
|
15
|
+
def release_cmd
|
16
|
+
fetch(:tarball_release_cmd)
|
17
|
+
end
|
18
|
+
|
19
|
+
def remote_path
|
20
|
+
fetch(:tarball_remote_path)
|
21
|
+
end
|
22
|
+
|
23
|
+
def local_path
|
24
|
+
fetch(:tarball_local_path)
|
25
|
+
end
|
26
|
+
|
27
|
+
module DefaultStrategy
|
28
|
+
def test
|
29
|
+
test! " [ -f #{remote_path} ] "
|
30
|
+
end
|
31
|
+
|
32
|
+
def package
|
33
|
+
context.execute *package_cmd
|
34
|
+
end
|
35
|
+
|
36
|
+
def upload
|
37
|
+
context.upload! local_path, remote_path
|
38
|
+
end
|
39
|
+
|
40
|
+
def release
|
41
|
+
context.execute *release_cmd
|
42
|
+
context.execute :rm, remote_path
|
43
|
+
end
|
44
|
+
|
45
|
+
def fetch_revision
|
46
|
+
fetch(:tarball_release_tag)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
p "*************Loaded #{__FILE__}"
|
2
|
+
|
3
|
+
require 'tmpdir'
|
4
|
+
|
5
|
+
namespace :load do
|
6
|
+
task :defaults do
|
7
|
+
# :tarball_release_tag
|
8
|
+
#
|
9
|
+
# This will become the contents of the <release_path>/REVISION file.
|
10
|
+
# Defaults to current git HEAD short hash
|
11
|
+
set :tarball_release_tag, -> {
|
12
|
+
`git log --pretty=format:'%h' -n 1 HEAD`
|
13
|
+
}
|
14
|
+
|
15
|
+
# :tarball_name
|
16
|
+
#
|
17
|
+
# The generated tarball file name.
|
18
|
+
# Defaults to <:application>-<:stage>-<tarball_release_tag>.tar.gz
|
19
|
+
set :tarball_name, -> {
|
20
|
+
"#{fetch(:application)}-#{fetch(:stage)}-#{fetch(:tarball_release_tag)}.tar.gz"
|
21
|
+
}
|
22
|
+
|
23
|
+
# :tarball_remote_path
|
24
|
+
#
|
25
|
+
# The location to store the tarball on a remote host.
|
26
|
+
set :tarball_remote_path, -> {
|
27
|
+
File.join(fetch(:tmp_dir), fetch(:tarball_name))
|
28
|
+
}
|
29
|
+
|
30
|
+
# :tarball_local_path
|
31
|
+
#
|
32
|
+
# The local path for the packaged tarball.
|
33
|
+
set :tarball_local_path, -> {
|
34
|
+
File.join(Dir.tmpdir, fetch(:tarball_name))
|
35
|
+
}
|
36
|
+
|
37
|
+
|
38
|
+
# :tarball_package_cmd
|
39
|
+
#
|
40
|
+
# The command to run in order to package the tarball.
|
41
|
+
# Default behavior is to compress the current working directory, and save the
|
42
|
+
# output to /tmp/<:tarball_name>. It's possible to customize this command to
|
43
|
+
# be something like "make tarball" if you are using a build system. When making
|
44
|
+
# a custom script, APP_ENV and TARBALL_PATH environmental variables can be used
|
45
|
+
# with in the custom script to determine where the tarball should be saved, and
|
46
|
+
# which application environment / stage the tarball is intended to be deployed
|
47
|
+
# to.
|
48
|
+
set :tarball_package_cmd, -> {
|
49
|
+
[:tar, '-czf', fetch(:tarball_local_path), '.']
|
50
|
+
}
|
51
|
+
|
52
|
+
# :tarball_release_cmd
|
53
|
+
#
|
54
|
+
# The command to run in order to extract the tarball into the <:release_path>.
|
55
|
+
set :tarball_release_cmd, -> {
|
56
|
+
[:tar, '-xf', fetch(:tarball_remote_path), '-C', fetch(:release_path)]
|
57
|
+
}
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
p "*************Loaded #{__FILE__}"
|
2
|
+
namespace :tarball do
|
3
|
+
def strategy
|
4
|
+
@strategy ||= Capistrano::Tarball.new(
|
5
|
+
self,
|
6
|
+
fetch(:tarball_strategy, Capistrano::Tarball::DefaultStrategy)
|
7
|
+
)
|
8
|
+
end
|
9
|
+
|
10
|
+
desc 'This task does nothing and exists for compatibility reasons.'
|
11
|
+
task :check do
|
12
|
+
# well... there is nothing to check.
|
13
|
+
end
|
14
|
+
|
15
|
+
desc 'Build tarball release locally.'
|
16
|
+
task :package do
|
17
|
+
run_locally do
|
18
|
+
with app_env: fetch(:stage), tarball_path: strategy.local_path do
|
19
|
+
strategy.package
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
desc 'Upload tarball release.'
|
25
|
+
task upload: :"tarball:package" do
|
26
|
+
on release_roles :all do
|
27
|
+
strategy.upload
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
desc 'Copy tarball to releases'
|
32
|
+
task create_release: :"tarball:upload" do
|
33
|
+
on release_roles :all do
|
34
|
+
execute :mkdir, '-p', release_path
|
35
|
+
strategy.release
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
desc 'Determine the revision that will be deployed'
|
40
|
+
task :set_current_revision do
|
41
|
+
on release_roles :all do
|
42
|
+
set :current_revision, strategy.fetch_revision
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
File without changes
|
metadata
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: capistrano-tarball
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Aaron Qian
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-12-10 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: capistrano
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 3.2.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 3.2.0
|
27
|
+
description: Deploy your apps via tarball instead of scm
|
28
|
+
email:
|
29
|
+
- aq1018@gmail.com
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- ".gitignore"
|
35
|
+
- Gemfile
|
36
|
+
- LICENSE.txt
|
37
|
+
- README.md
|
38
|
+
- Rakefile
|
39
|
+
- capistrano-tarball.gemspec
|
40
|
+
- lib/capistrano-tarball.rb
|
41
|
+
- lib/capistrano/tarball.rb
|
42
|
+
- lib/capistrano/tarball/load.rb
|
43
|
+
- lib/capistrano/tasks/load.rake
|
44
|
+
- lib/capistrano/tasks/tarball.rake
|
45
|
+
homepage: ''
|
46
|
+
licenses:
|
47
|
+
- MIT
|
48
|
+
metadata: {}
|
49
|
+
post_install_message:
|
50
|
+
rdoc_options: []
|
51
|
+
require_paths:
|
52
|
+
- lib
|
53
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: '0'
|
58
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
63
|
+
requirements: []
|
64
|
+
rubyforge_project:
|
65
|
+
rubygems_version: 2.4.3
|
66
|
+
signing_key:
|
67
|
+
specification_version: 4
|
68
|
+
summary: Capistrano tarball strategy
|
69
|
+
test_files: []
|