capistrano-rsync-local 1.1 → 1.2
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.
- checksums.yaml +4 -4
- data/README.md +18 -25
- data/lib/capistrano/rsync.rb +9 -17
- data/lib/capistrano/rsync/scm/svn.rb +30 -11
- data/lib/capistrano/rsync/version.rb +1 -1
- data/provision.sh +2 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d2d1fcc7d4d2f98eda52ad8311bdf6d95b7f614c
|
4
|
+
data.tar.gz: cf6589920a479ffc19d02a6b8abd3e349cab1452
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf7b9b71cc9462a0765dea9117a5a103cc6b5e42c56d1aaefb38ab91b628cbd8438a1bc6b48f8e265f93f9db51cf92dbaf2491dcc8278de266800b6724b3a0a5
|
7
|
+
data.tar.gz: b0a8b87faf18adb0f0ff223e3f4df025aeda1b3841a816268c3983a6c847e9c8a756c80e627d25bc7cf06577107b912b3dbade0ec1e0ac7f4d1a8ecc6e25a334
|
data/README.md
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
Capistrano::Rsync for Capistrano v3
|
2
2
|
===================================
|
3
|
-
[![Gem
|
4
|
-
[gem-badge]: https://badge.fury.io/rb/capistrano-rsync.png
|
3
|
+
[](http://badge.fury.io/rb/capistrano-rsync-local)
|
5
4
|
|
6
5
|
**Deploy with Rsync** to your server from any local (or remote) repository when
|
7
6
|
using [**Capistrano**](http://www.capistranorb.com/). Saves you from having to
|
@@ -13,14 +12,14 @@ machine before deploying.
|
|
13
12
|
- Works with the new [**Capistrano v3**](http://www.capistranorb.com/) ([source
|
14
13
|
code](https://github.com/capistrano/capistrano)) versions `>= 3.0.0pre14` and
|
15
14
|
`< 4`.
|
16
|
-
- Suitable for deploying any apps, be it Ruby, Rails, Node.js or others.
|
15
|
+
- Suitable for deploying any apps, be it Ruby, Rails, Node.js or others.
|
17
16
|
- Exclude files from being deployed with Rsync's `--exclude` options.
|
18
17
|
- Precompile files or assets easily before deploying, like JavaScript or CSS.
|
19
18
|
- Caches your previously deployed code to speed up deployments ~1337%.
|
20
19
|
- Currently works only with Git (as does Capistrano v3), so please shout out
|
21
20
|
your interest in other SCMs.
|
22
21
|
|
23
|
-
Using [Mina](http://nadarei.co/mina/) instead of Capistrano? I've built
|
22
|
+
Using [Mina](http://nadarei.co/mina/) instead of Capistrano? I've (actuall not me, but Moll) built
|
24
23
|
[Mina::Rsync](https://github.com/moll/mina-rsync) as well.
|
25
24
|
|
26
25
|
|
@@ -28,7 +27,7 @@ Using
|
|
28
27
|
-----
|
29
28
|
Install with:
|
30
29
|
```
|
31
|
-
gem install capistrano-rsync
|
30
|
+
gem install capistrano-rsync-local
|
32
31
|
```
|
33
32
|
|
34
33
|
Require it at the top of your `Capfile` (or `config/deploy.rb`):
|
@@ -93,16 +92,20 @@ Configuration
|
|
93
92
|
-------------
|
94
93
|
Set Capistrano variables with `set name, value`.
|
95
94
|
|
96
|
-
Name
|
97
|
-
|
98
|
-
rsync_scm
|
99
|
-
rsync_scm_username | nil
|
100
|
-
rsync_scm_password | nil
|
101
|
-
repo_url
|
102
|
-
branch
|
103
|
-
rsync_stage
|
104
|
-
rsync_cache
|
105
|
-
rsync_options
|
95
|
+
Name | Default | Description
|
96
|
+
-------------------|----------|------------
|
97
|
+
rsync_scm | `git` | Available options: `git`, `svn`.
|
98
|
+
rsync_scm_username | nil | Used for Svn (Optional).
|
99
|
+
rsync_scm_password | nil | Used for Svn (Optional).
|
100
|
+
repo_url | `.` | The path or URL to a SCM repository to clone from.
|
101
|
+
branch | `master` | The Git branch to checkout. This is ignored for Svn.
|
102
|
+
rsync_stage | `tmp/deploy` | Path where to clone your repository for staging, checkouting and rsyncing. Can be both relative or absolute.
|
103
|
+
rsync_cache | `shared/deploy` | Path where to cache your repository on the server to avoid rsyncing from scratch each time. Can be both relative or absolute.<br> Set to `nil` if you want to disable the cache.
|
104
|
+
rsync_options | `[]` | Array of options to pass to `rsync`.
|
105
|
+
rsync_local_repo | false | The flag of the local repository, it disables any request to the scm
|
106
|
+
rsync_with_ext | false | Enables checking out an external project
|
107
|
+
repo_ext_url | nil | The URL of the external project. Required if `rsync_with_ext` is true.
|
108
|
+
rsync_ext_stage | `tmp/deploy_ext` | Path where to clone the external project.
|
106
109
|
|
107
110
|
|
108
111
|
License
|
@@ -117,13 +120,3 @@ License*, which in summary means:
|
|
117
120
|
program.
|
118
121
|
|
119
122
|
For more convoluted language, see the `LICENSE` file.
|
120
|
-
|
121
|
-
|
122
|
-
About
|
123
|
-
-----
|
124
|
-
**[Andri Möll](http://themoll.com)** made this happen.
|
125
|
-
[Monday Calendar](https://mondayapp.com) was the reason I needed this.
|
126
|
-
|
127
|
-
If you find Capistrano::Rsync needs improving, please don't hesitate to type to
|
128
|
-
me now at [andri@dot.ee](mailto:andri@dot.ee) or [create an issue
|
129
|
-
online](https://github.com/moll/capistrano-rsync/issues).
|
data/lib/capistrano/rsync.rb
CHANGED
@@ -14,10 +14,6 @@ rsync_cache = lambda do
|
|
14
14
|
cache
|
15
15
|
end
|
16
16
|
|
17
|
-
scm_instance = lambda do
|
18
|
-
scm_class = Capistrano::Rsync::Scm.const_get(:"#{fetch(:rsync_scm).capitalize}")
|
19
|
-
scm_class.new(self)
|
20
|
-
end
|
21
17
|
|
22
18
|
Rake::Task["load:defaults"].enhance ["rsync:defaults"]
|
23
19
|
Rake::Task["deploy:check"].enhance ["rsync:hook_scm"]
|
@@ -25,7 +21,7 @@ Rake::Task["deploy:updating"].enhance ["rsync:hook_scm"]
|
|
25
21
|
|
26
22
|
|
27
23
|
desc "Stage and rsync to the server (or its cache)."
|
28
|
-
task :rsync => %w[rsync:stage] do
|
24
|
+
task :rsync => %w[rsync:stage rsync:ext_stage] do
|
29
25
|
roles(:all).each do |role|
|
30
26
|
user = role.user + "@" if !role.user.nil?
|
31
27
|
|
@@ -55,6 +51,9 @@ namespace :rsync do
|
|
55
51
|
# Capistrano::Rsync will sync straight to the release path.
|
56
52
|
set :rsync_cache, "shared/deploy"
|
57
53
|
set :rsync_local_repo, false
|
54
|
+
|
55
|
+
set :rsync_with_ext, false
|
56
|
+
set :rsync_ext_stage, 'tmp/deploy_ext'
|
58
57
|
end
|
59
58
|
|
60
59
|
# internally needed by capistrano's "deploy.rake"
|
@@ -80,22 +79,15 @@ namespace :rsync do
|
|
80
79
|
# Everything's a-okay inherently!
|
81
80
|
end
|
82
81
|
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
scm_instance.call.create_stage_cmds.each do |cmd|
|
87
|
-
Kernel.system *cmd
|
88
|
-
end
|
82
|
+
task :ext_stage do
|
83
|
+
next unless fetch(:rsync_with_ext)
|
84
|
+
scm_instance.call.get_last_ext_stage
|
89
85
|
end
|
90
86
|
|
91
87
|
desc "Update and freshen the stage repository."
|
92
|
-
task :stage
|
88
|
+
task :stage do
|
93
89
|
next if fetch(:rsync_local_repo)
|
94
|
-
|
95
|
-
scm_instance.call.update_stage_cmds.each do |cmd|
|
96
|
-
Kernel.system *cmd
|
97
|
-
end
|
98
|
-
end
|
90
|
+
scm_instance.call.get_last_main_stage
|
99
91
|
end
|
100
92
|
|
101
93
|
desc "Copy the code to the releases directory."
|
@@ -9,37 +9,56 @@ module Capistrano
|
|
9
9
|
"svn info | grep '^Revision:' | sed -e 's/^Revision: //'"
|
10
10
|
end
|
11
11
|
|
12
|
-
def
|
12
|
+
def run_cmds (list = [])
|
13
|
+
list.each { |cmd| Kernel.system *cmd }
|
14
|
+
end
|
15
|
+
|
16
|
+
def create_stage(repo, path)
|
13
17
|
cmd = []
|
14
18
|
|
15
19
|
clone = %W[svn checkout]
|
16
|
-
clone << context.fetch(
|
17
|
-
clone << context.fetch(
|
20
|
+
clone << context.fetch(repo, ".")
|
21
|
+
clone << context.fetch(path)
|
18
22
|
|
19
23
|
clone << %W[--username #{context.fetch(:rsync_scm_username)}] if context.fetch(:rsync_scm_username)
|
20
24
|
clone << %W[--password #{context.fetch(:rsync_scm_password)}] if context.fetch(:rsync_scm_password)
|
21
25
|
|
22
|
-
|
23
|
-
|
24
|
-
cmd
|
26
|
+
run_cmds clone.flatten
|
25
27
|
end
|
26
28
|
|
27
|
-
def
|
29
|
+
def update_stage
|
28
30
|
cmd = []
|
29
31
|
|
30
32
|
update = %W[svn update]
|
31
33
|
update << %W[--username #{context.fetch(:rsync_scm_username)}] if context.fetch(:rsync_scm_username)
|
32
34
|
update << %W[--password #{context.fetch(:rsync_scm_password)}] if context.fetch(:rsync_scm_password)
|
33
35
|
|
34
|
-
|
36
|
+
run_cmds update.flatten
|
35
37
|
|
36
38
|
checkout = %W[svn revert --recursive .]
|
37
|
-
|
39
|
+
run_cmds checkout
|
40
|
+
end
|
38
41
|
|
39
|
-
|
42
|
+
def get_stage(repo_key, path_key)
|
43
|
+
if File.directory?(fetch(path_key))
|
44
|
+
repo = context.fetch(repo_key, ".")
|
45
|
+
path = context.fetch(path_key)
|
46
|
+
create_stage(repo, path)
|
47
|
+
else
|
48
|
+
Dir.chdir fetch(path_key) do
|
49
|
+
update_stage
|
50
|
+
end
|
51
|
+
end
|
40
52
|
end
|
41
|
-
end
|
42
53
|
|
54
|
+
def get_last_ext_stage
|
55
|
+
get_stage :repo_ext_url, :rsync_ext_stage
|
56
|
+
end
|
57
|
+
|
58
|
+
def get_last_main_stage
|
59
|
+
get_stage :repo_url, :rsync_stage
|
60
|
+
end
|
61
|
+
end
|
43
62
|
end
|
44
63
|
end
|
45
64
|
end
|
data/provision.sh
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-rsync-local
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '1.
|
4
|
+
version: '1.2'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dmitry Tonkonogov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-07-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capistrano
|