capistrano-rsync-local 1.1 → 1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d8e113f8f3985d6de97d1781c7846e94a873334a
4
- data.tar.gz: 5146c44c34e11c3d5430267b503d34efc591a545
3
+ metadata.gz: d2d1fcc7d4d2f98eda52ad8311bdf6d95b7f614c
4
+ data.tar.gz: cf6589920a479ffc19d02a6b8abd3e349cab1452
5
5
  SHA512:
6
- metadata.gz: 7af134741ddc04303887c0699fda9ab809059a5749b3a7ed5390b175299979081b418652d219ffaedcd5ba5a10590bb43f0b08eb3a5c2365b250690b93892893
7
- data.tar.gz: 51d02b90070b9ae18dd76d9b79af7f89cd725521d271f52dc3c695ac71a7e1a847e42cb24ed8292f8778e90a88efe5496d8f7f77bebded33587eaa0c5745dd19
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 version][gem-badge]](http://badge.fury.io/rb/capistrano-rsync)
4
- [gem-badge]: https://badge.fury.io/rb/capistrano-rsync.png
3
+ [![Gem Version](https://badge.fury.io/rb/capistrano-rsync-local.svg)](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 | Default | Description
97
- --------------|---------|------------
98
- rsync_scm | `git` | Available options: `git`, `svn`.
99
- rsync_scm_username | nil | Used for Svn (Optional).
100
- rsync_scm_password | nil | Used for Svn (Optional).
101
- repo_url | `.` | The path or URL to a SCM repository to clone from.
102
- branch | `master` | The Git branch to checkout. This is ignored for Svn.
103
- rsync_stage | `tmp/deploy` | Path where to clone your repository for staging, checkouting and rsyncing. Can be both relative or absolute.
104
- 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.
105
- rsync_options | `[]` | Array of options to pass to `rsync`.
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).
@@ -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
- desc "Create the stage repository in a local directory."
84
- task :create_stage do
85
- next if File.directory?(fetch(:rsync_stage)) || fetch(:rsync_local_repo)
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 => %w[create_stage] do
88
+ task :stage do
93
89
  next if fetch(:rsync_local_repo)
94
- Dir.chdir fetch(:rsync_stage) do
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 create_stage_cmds
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(:repo_url, ".")
17
- clone << context.fetch(:rsync_stage)
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
- cmd << clone.flatten
23
-
24
- cmd
26
+ run_cmds clone.flatten
25
27
  end
26
28
 
27
- def update_stage_cmds
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
- cmd << update.flatten
36
+ run_cmds update.flatten
35
37
 
36
38
  checkout = %W[svn revert --recursive .]
37
- cmd << checkout
39
+ run_cmds checkout
40
+ end
38
41
 
39
- cmd
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
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module Rsync
3
- VERSION = '1.1'
3
+ VERSION = '1.2'
4
4
  end
5
5
  end
@@ -38,3 +38,5 @@ rbenv local ${RUBY_VERSION}
38
38
  gem update --system
39
39
  gem install bundler -N
40
40
  rbenv local --unset
41
+
42
+ git config --global push.default simple
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.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-06-08 00:00:00.000000000 Z
11
+ date: 2015-07-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capistrano