capistrano-git-with-submodules 1.0.2 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/capistrano/scm/git-with-submodules.rb +22 -42
- 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: 471b27ace6a52dcfda49776f81b91002cc1d2304
|
4
|
+
data.tar.gz: 6b2f499bbb3906e63a6ba71474fd433017217a60
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c9f588b21d46c69cc6731e5e3c8a858ea5f92c3771e7da061de694da4b5a12039cba25f44869d87a3fc76dd8c6f13f52eee75276ea5ccb76accbb26332686406
|
7
|
+
data.tar.gz: 3cdd46ac00260897ea79b4c9bdc023e0ba7df13ac95b5e787062e4cc30244821a681503fa7f17e7fdb15a3695d2480cf153f97e25adfb2371e09eda5b7db932a
|
data/README.md
CHANGED
@@ -8,7 +8,7 @@ For Capistrano 3.0-3.6 use old [capistrano-git-submodule-strategy](https://githu
|
|
8
8
|
|
9
9
|
####Gemfile
|
10
10
|
```ruby
|
11
|
-
gem 'capistrano-git-with-submodules', '~>
|
11
|
+
gem 'capistrano-git-with-submodules', '~> 1.1', :github => 'ekho/capistrano-git-with-submodules'
|
12
12
|
```
|
13
13
|
|
14
14
|
####Capfile
|
@@ -1,18 +1,14 @@
|
|
1
1
|
require "capistrano/scm/git"
|
2
2
|
|
3
3
|
class Capistrano::SCM::Git::WithSubmodules < Capistrano::SCM::Git
|
4
|
+
alias_method :origin_archive_to_release_path, :archive_to_release_path if method_defined?(:archive_to_release_path)
|
4
5
|
|
5
6
|
def archive_to_release_path
|
6
|
-
|
7
|
+
origin_archive_to_release_path
|
7
8
|
|
9
|
+
return unless backend.test(:test, '-e', release_path) && backend.test("ls -A #{release_path} | read linevar")
|
8
10
|
|
9
|
-
|
10
|
-
|
11
|
-
_clone_repo
|
12
|
-
|
13
|
-
backend.within_only release_path do
|
14
|
-
git :submodule, 'update', '--init', '--recursive'
|
15
|
-
end
|
11
|
+
submodules_to_release_path
|
16
12
|
|
17
13
|
unless fetch(:git_keep_meta, false)
|
18
14
|
verbose = Rake.application.options.trace ? 'v' : ''
|
@@ -20,40 +16,24 @@ class Capistrano::SCM::Git::WithSubmodules < Capistrano::SCM::Git
|
|
20
16
|
end
|
21
17
|
end
|
22
18
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
git :remote, 'set-url', 'origin', repo_url
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
|
46
|
-
# shit hack to execute command only in specified directory
|
47
|
-
module SSHKit
|
48
|
-
module Backend
|
49
|
-
class Abstract
|
50
|
-
def within_only(directory, &block)
|
51
|
-
pwd = @pwd
|
52
|
-
@pwd = []
|
53
|
-
within directory, &block
|
54
|
-
ensure
|
55
|
-
@pwd = pwd
|
19
|
+
##
|
20
|
+
# Adds configured submodules recursively to release
|
21
|
+
# It does so by connecting the bare repo and the work tree using environment variables
|
22
|
+
# The reset creates a temporary index, but does not change the working directory
|
23
|
+
# The temporary index is removed after everything is done
|
24
|
+
def submodules_to_release_path
|
25
|
+
temp_index_file_path = release_path.join("INDEX_#{fetch(:release_timestamp)}")
|
26
|
+
backend.within "../releases/#{fetch(:release_timestamp)}" do
|
27
|
+
backend.with(
|
28
|
+
'GIT_DIR' => repo_path.to_s,
|
29
|
+
'GIT_WORK_TREE' => release_path.to_s,
|
30
|
+
'GIT_INDEX_FILE' => temp_index_file_path.to_s
|
31
|
+
) do
|
32
|
+
git :reset, '--mixed', fetch(:branch)
|
33
|
+
git :submodule, 'update', '--init', '--depth', 1, '--checkout', '--recursive'
|
34
|
+
verbose = Rake.application.options.trace ? 'v' : ''
|
35
|
+
backend.execute :rm, "-f#{verbose}", temp_index_file_path.to_s
|
56
36
|
end
|
57
37
|
end
|
58
38
|
end
|
59
|
-
end
|
39
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-git-with-submodules
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Boris Gorbylev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-12-
|
11
|
+
date: 2016-12-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capistrano
|