capistrano-bundle_rsync 0.4.6 → 0.4.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +4 -0
- data/CHANGELOG.md +6 -0
- data/README.md +3 -2
- data/capistrano-bundle_rsync.gemspec +1 -1
- data/example/README.md +41 -0
- data/example/Vagrantfile +24 -0
- data/example/config/deploy/local_git.rb +1 -1
- data/lib/capistrano/bundle_rsync/bundler.rb +0 -16
- data/lib/capistrano/bundle_rsync/git.rb +16 -0
- data/lib/capistrano/bundle_rsync/local_git.rb +3 -0
- data/lib/capistrano/bundle_rsync/scm.rb +12 -0
- data/lib/capistrano/tasks/bundle_rsync.rake +9 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f014be48949a6735ed744c4795e659db58a096a
|
4
|
+
data.tar.gz: e8038d006efc199865f7d069a26694b2bf777c44
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 872b6b0c2ecff6fe231c3ad816c0b91982d1df2ecb4e1e71dd983b09704d0ee082905f3ecf8e1b826777cb66f0a4074b2ac090e854ec15a7bb81ace30d9c54ee
|
7
|
+
data.tar.gz: dd0b47db60be4ae962c11c2bfca06fa2819669c28f64c179e6c677fa6cc3b3457be478247d474b92266296f8c55406d63c9e9201e4bf77e05b46574f9751dd33
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -54,8 +54,8 @@ scm | nil | Must be `bundle_rsync` to use capistrano-bundle_rsync.
|
|
54
54
|
bundle_rsync_scm | `git` | SCM Strategy inside `bundle_rsync`. `git` uses git. `local_git` also uses git, but it enables to rsync the git repository located on local path directly without git clone. `repo_url` must be the local directory path to use `local_git`.
|
55
55
|
bundle_rsync_local_base_path | `$(pwd)/.local_repo` | The base directory to clone repository
|
56
56
|
bundle_rsync_local_mirror_path | `#{base_path}/mirror"` | Path where to mirror your repository
|
57
|
-
bundle_rsync_local_releases_path | `"#{base_path}/releases"` |
|
58
|
-
bundle_rsync_local_release_path | `"#{releases_path}/#{datetime}"` |
|
57
|
+
bundle_rsync_local_releases_path | `"#{base_path}/releases"` | The releases base directory to checkout your repository
|
58
|
+
bundle_rsync_local_release_path | `"#{releases_path}/#{datetime}"` | The full path directory to checkout your repository. If you specify this, `keep_releases` for local releases path is disabled because `datetime` directories are no longer created.
|
59
59
|
bundle_rsync_local_bundle_path | `"#{base_path}/bundle"` | Path where to bundle install gems.
|
60
60
|
bundle_rsync_ssh_options | `ssh_options` | Configuration of ssh for rsync. Default uses the value of `ssh_options`
|
61
61
|
bundle_rsync_keep_releases | `keep_releases` | The number of releases to keep on .local_repo
|
@@ -79,6 +79,7 @@ $ cap stage deploy --trace | grep Execute
|
|
79
79
|
** Execute bundle_rsync:rsync_release
|
80
80
|
** Execute bundle_rsync:rsync_shared
|
81
81
|
** Execute bundle_rsync:bundler:rsync
|
82
|
+
** Execute bundle_rsync:clean_release
|
82
83
|
** Execute bundle_rsync:set_current_revision
|
83
84
|
```
|
84
85
|
|
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "capistrano-bundle_rsync"
|
7
|
-
spec.version = "0.4.
|
7
|
+
spec.version = "0.4.7"
|
8
8
|
spec.authors = ["sonots", "tohae"]
|
9
9
|
spec.email = ["sonots@gmail.com", "tohaechan@gmail.com"]
|
10
10
|
spec.description = %q{Deploy an application and bundled gems via rsync}
|
data/example/README.md
CHANGED
@@ -1,7 +1,48 @@
|
|
1
1
|
How to run:
|
2
2
|
|
3
|
+
```
|
4
|
+
brew install vagrant
|
5
|
+
vagrant up
|
6
|
+
```
|
7
|
+
|
8
|
+
prepare rbenv, ruby in the vagrant box
|
9
|
+
|
10
|
+
```
|
11
|
+
vagrant ssh
|
12
|
+
sudo yum install gcc make openssl-devel readline-devel zlib-devel
|
13
|
+
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
|
14
|
+
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
|
15
|
+
echo 'export PATH="$HOME/.rbenv/bin:$PATH" && eval "$(rbenv init -)"' >> ~/.bash_profile
|
16
|
+
export PATH="$HOME/.rbenv/bin:$PATH" && eval "$(rbenv init -)"
|
17
|
+
rbenv install 2.3.0
|
18
|
+
```
|
19
|
+
|
20
|
+
prepare ssh keys in the vagrant box
|
21
|
+
|
22
|
+
```
|
23
|
+
ssh-keygen
|
24
|
+
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
|
25
|
+
```
|
26
|
+
|
27
|
+
prepare capistrano-bundle_rsync repository in the vagrant box
|
28
|
+
|
29
|
+
```
|
30
|
+
git clone git@github.com:sonots/capistrano-bundle_rsync
|
31
|
+
cd capistrano-bundle_rsync/example
|
32
|
+
bundle install --path vendor/bundle
|
33
|
+
```
|
34
|
+
|
35
|
+
run
|
36
|
+
|
3
37
|
```
|
4
38
|
bundle exec cap git deploy
|
39
|
+
```
|
40
|
+
|
41
|
+
```
|
42
|
+
git clone git@github.com:sonots/try_rails4.git
|
5
43
|
bundle exec cap local_git deploy
|
44
|
+
```
|
45
|
+
|
46
|
+
```
|
6
47
|
bundle exec cap skip_bundle deploy
|
7
48
|
```
|
data/example/Vagrantfile
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- mode: ruby -*-
|
2
|
+
# vi: set ft=ruby :
|
3
|
+
|
4
|
+
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
|
5
|
+
VAGRANTFILE_API_VERSION = "2"
|
6
|
+
|
7
|
+
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
8
|
+
# All Vagrant configuration is done here. The most common configuration
|
9
|
+
# options are documented and commented below. For a complete reference,
|
10
|
+
# please see the online documentation at vagrantup.com.
|
11
|
+
|
12
|
+
# Every Vagrant virtual environment requires a box to build off of.
|
13
|
+
config.vm.box = "centos6.5.3"
|
14
|
+
config.vm.box_url = 'https://github.com/2creatives/vagrant-centos/releases/download/v6.5.3/centos65-x86_64-20140116.box'
|
15
|
+
|
16
|
+
# name
|
17
|
+
config.vm.define "vagrant-centos"
|
18
|
+
config.ssh.forward_agent = true
|
19
|
+
|
20
|
+
config.vm.provider "virtualbox" do |vb|
|
21
|
+
# Use VBoxManage to customize the VM. For example to change memory:
|
22
|
+
vb.customize ["modifyvm", :id, "--memory", "1024"]
|
23
|
+
end
|
24
|
+
end
|
@@ -42,21 +42,5 @@ BUNDLE_BIN: #{release_path.join('bin')}
|
|
42
42
|
execute :rsync, "#{rsync_options} --rsh='#{ssh}' #{config.local_bundle_path}/ #{host}:#{shared_path}/bundle/"
|
43
43
|
execute :rsync, "#{rsync_options} --rsh='#{ssh}' #{bundle_config_path} #{host}:#{release_path}/.bundle/config"
|
44
44
|
end
|
45
|
-
|
46
|
-
# Do not remove if :bundle_rsync_local_release_path is directly specified
|
47
|
-
# because releases/#{datetime} directories are not created in such case.
|
48
|
-
# Note that :bundle_rsync_local_release_path is automatically set when `local_git` scm is used.
|
49
|
-
unless fetch(:bundle_rsync_local_release_path)
|
50
|
-
releases = capture(:ls, '-x', config.local_releases_path).split
|
51
|
-
if releases.count >= config.keep_releases
|
52
|
-
directories = (releases - releases.last(config.keep_releases))
|
53
|
-
if directories.any?
|
54
|
-
directories_str = directories.map do |release|
|
55
|
-
File.join(config.local_releases_path, release)
|
56
|
-
end.join(" ")
|
57
|
-
execute :rm, '-rf', directories_str
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
45
|
end
|
62
46
|
end
|
@@ -35,6 +35,22 @@ class Capistrano::BundleRsync::Git < Capistrano::BundleRsync::SCM
|
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
|
+
def clean_release
|
39
|
+
# Do not remove if :bundle_rsync_local_release_path is directly specified
|
40
|
+
# because releases/#{datetime} directories are no longer created.
|
41
|
+
return if fetch(:bundle_rsync_local_release_path)
|
42
|
+
releases = capture(:ls, '-x', config.local_releases_path).split
|
43
|
+
if releases.count >= config.keep_releases
|
44
|
+
directories = (releases - releases.last(config.keep_releases))
|
45
|
+
if directories.any?
|
46
|
+
directories_str = directories.map do |release|
|
47
|
+
File.join(config.local_releases_path, release)
|
48
|
+
end.join(" ")
|
49
|
+
execute :rm, '-rf', directories_str
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
38
54
|
def rsync_release
|
39
55
|
hosts = ::Capistrano::Configuration.env.filter(release_roles(:all))
|
40
56
|
rsync_options = config.rsync_options
|
@@ -17,6 +17,9 @@ class Capistrano::BundleRsync::LocalGit < Capistrano::BundleRsync::SCM
|
|
17
17
|
def create_release
|
18
18
|
end
|
19
19
|
|
20
|
+
def clean_release
|
21
|
+
end
|
22
|
+
|
20
23
|
def rsync_release
|
21
24
|
hosts = ::Capistrano::Configuration.env.filter(release_roles(:all))
|
22
25
|
rsync_options = config.rsync_options
|
@@ -67,6 +67,18 @@ class Capistrano::BundleRsync::SCM < Capistrano::BundleRsync::Base
|
|
67
67
|
)
|
68
68
|
end
|
69
69
|
|
70
|
+
# @abstract
|
71
|
+
#
|
72
|
+
# Clean the contents of the cache-repository onto the release path
|
73
|
+
#
|
74
|
+
# @return void
|
75
|
+
#
|
76
|
+
def clean_release
|
77
|
+
raise NotImplementedError.new(
|
78
|
+
"Your SCM strategy module should provide a #clean_release method"
|
79
|
+
)
|
80
|
+
end
|
81
|
+
|
70
82
|
# @abstract
|
71
83
|
#
|
72
84
|
# Rsync the contents of the release path
|
@@ -17,7 +17,6 @@ namespace :bundle_rsync do
|
|
17
17
|
@bundle_rsync_scm ||=
|
18
18
|
if fetch(:bundle_rsync_scm).to_s == 'local_git'
|
19
19
|
require 'capistrano/bundle_rsync/local_git'
|
20
|
-
set :bundle_rsync_local_release_path, repo_url
|
21
20
|
Capistrano::BundleRsync::LocalGit.new(self)
|
22
21
|
else
|
23
22
|
require 'capistrano/bundle_rsync/git'
|
@@ -91,6 +90,14 @@ namespace :bundle_rsync do
|
|
91
90
|
end
|
92
91
|
end
|
93
92
|
|
93
|
+
# additional extra tasks of bundle_rsync scm
|
94
|
+
desc 'Clean releases'
|
95
|
+
task :clean_release do
|
96
|
+
run_locally do
|
97
|
+
bundle_rsync_scm.clean_release
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
94
101
|
desc 'Determine the revision that will be deployed'
|
95
102
|
task :set_current_revision do
|
96
103
|
run_locally do
|
@@ -102,5 +109,6 @@ namespace :bundle_rsync do
|
|
102
109
|
after 'bundle_rsync:bundler:install', 'bundle_rsync:rsync_release'
|
103
110
|
after 'bundle_rsync:rsync_release', 'bundle_rsync:rsync_shared'
|
104
111
|
after 'bundle_rsync:rsync_shared', 'bundle_rsync:bundler:rsync'
|
112
|
+
after 'bundle_rsync:bundler:rsync', 'bundle_rsync:clean_release'
|
105
113
|
end
|
106
114
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-bundle_rsync
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sonots
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-07-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: capistrano
|
@@ -100,6 +100,7 @@ files:
|
|
100
100
|
- example/Capfile
|
101
101
|
- example/Gemfile
|
102
102
|
- example/README.md
|
103
|
+
- example/Vagrantfile
|
103
104
|
- example/config/deploy.rb
|
104
105
|
- example/config/deploy/git.rb
|
105
106
|
- example/config/deploy/local_git.rb
|