capistrano-git-with-submodules 1.2.1 → 2.0.0

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: 369fba65acde05c8def4e1f53bf518cae8c6c943
4
- data.tar.gz: 7a36a19ab3d2a320b0d9883452a31b9dbbbebaa0
3
+ metadata.gz: 9aad3b41b20c9296e52b0f7846d68aa21a411661
4
+ data.tar.gz: 85af7e6d2cdf2e139cbbddcf5a8386ca3dc40e44
5
5
  SHA512:
6
- metadata.gz: 2da4ed36202e8f24202999ff4e544b8db8074af1725631c442ceabf244b8433c6ec67d7aaf65f209f9cde9993f8e7b7beffb9fc4eefba6c67a3dac7b50a1188a
7
- data.tar.gz: 8d7e5f4d77b03eae94c11f7d7eeab54dc1bf36040ed2b9061797594885908e1d9efe0668cf39c8503711ceacee82510a9b46733c28ad782fdba7835d607078b8
6
+ metadata.gz: ce98c3410e3972868c18ebc971975238a70968939375f82348e8a38aeb4d496cf16197f80f0f1a47aed305685c4e38c686cf8dd10eda59617f006d068a11f5af
7
+ data.tar.gz: 8ba481914671ef9113a65b564130edc45b5f7b3baa6b47814daa7e4d8af06abb3e8ce4e220c0c6df3d14da0312c3b1b46abff3b58c2a421bb474938f7b6ae93b
data/README.md CHANGED
@@ -9,21 +9,21 @@ For Capistrano 3.0-3.6 use old [capistrano-git-submodule-strategy](https://githu
9
9
  #### Gemfile
10
10
  From rubygems.org (recommended)
11
11
  ```ruby
12
- gem 'capistrano-git-with-submodules', '~> 1.2'
12
+ gem 'capistrano-git-with-submodules', '~> 2.0'
13
13
  ```
14
14
 
15
15
  Latest revision from github
16
16
  ```ruby
17
- gem 'capistrano-git-with-submodules', '~> 1.2', :github => 'ekho/capistrano-git-with-submodules'
17
+ gem 'capistrano-git-with-submodules', '~> 2.0', :github => 'ekho/capistrano-git-with-submodules'
18
18
  ```
19
19
 
20
20
  #### Capfile
21
- Change default
21
+ After
22
22
  ```ruby
23
23
  require "capistrano/scm/git"
24
24
  install_plugin Capistrano::SCM::Git
25
25
  ```
26
- to
26
+ add
27
27
  ```ruby
28
28
  require "capistrano/scm/git-with-submodules"
29
29
  install_plugin Capistrano::SCM::Git::WithSubmodules
@@ -1,35 +1,40 @@
1
- require "capistrano/scm/git"
1
+ require "capistrano/plugin"
2
2
 
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)
3
+ class Capistrano::SCM::Git::WithSubmodules < Capistrano::Plugin
5
4
 
6
- def archive_to_release_path
7
- origin_archive_to_release_path
5
+ def register_hooks
6
+ after 'git:create_release', 'git:submodules:create_release'
7
+ end
8
8
 
9
- return unless backend.test(:test, '-f', release_path.join('.gitmodules'))
9
+ def define_tasks
10
+ namespace :git do
11
+ namespace :submodules do
10
12
 
11
- submodules_to_release_path
13
+ desc "Adds configured submodules recursively to release"
14
+ # It does so by connecting the bare repo and the work tree using environment variables
15
+ # The reset creates a temporary index, but does not change the working directory
16
+ # The temporary index is removed after everything is done
17
+ task create_release: :'git:update' do
18
+ temp_index_file_path = release_path.join("TEMP_INDEX_#{fetch(:release_timestamp)}")
12
19
 
13
- backend.execute("find #{release_path} -name '.git' -printf 'Deleted %p' -delete")
14
- end
20
+ on release_roles :all do
21
+ with fetch(:git_environmental_variables).merge(
22
+ 'GIT_DIR' => repo_path.to_s,
23
+ 'GIT_WORK_TREE' => release_path.to_s,
24
+ 'GIT_INDEX_FILE' => temp_index_file_path.to_s
25
+ ) do
26
+ within release_path do
27
+ verbose = Rake.application.options.trace ? 'v' : ''
28
+ quiet = Rake.application.options.trace ? '' : '--quiet'
15
29
 
16
- ##
17
- # Adds configured submodules recursively to release
18
- # It does so by connecting the bare repo and the work tree using environment variables
19
- # The reset creates a temporary index, but does not change the working directory
20
- # The temporary index is removed after everything is done
21
- def submodules_to_release_path
22
- temp_index_file_path = release_path.join("INDEX_#{fetch(:release_timestamp)}")
23
- backend.within "../releases/#{fetch(:release_timestamp)}" do
24
- backend.with(
25
- 'GIT_DIR' => repo_path.to_s,
26
- 'GIT_WORK_TREE' => release_path.to_s,
27
- 'GIT_INDEX_FILE' => temp_index_file_path.to_s
28
- ) do
29
- git :reset, '--mixed', fetch(:branch)
30
- git :submodule, 'update', '--init', '--depth', 1, '--checkout', '--recursive'
31
- verbose = Rake.application.options.trace ? 'v' : ''
32
- backend.execute :rm, "-f#{verbose}", temp_index_file_path.to_s
30
+ execute :git, :reset, '--mixed', quiet, fetch(:branch)
31
+ execute :git, :submodule, 'update', '--init', '--depth', 1, '--checkout', '--recursive', quiet
32
+ execute :find, release_path, "-name '.git'", "-printf 'removed %p'", "-delete"
33
+ execute :rm, "-f#{verbose}", temp_index_file_path.to_s
34
+ end if test :test, '-f', release_path.join('.gitmodules')
35
+ end
36
+ end
37
+ end
33
38
  end
34
39
  end
35
40
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-git-with-submodules
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Boris Gorbylev
@@ -55,7 +55,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
55
55
  version: 1.3.6
56
56
  requirements: []
57
57
  rubyforge_project:
58
- rubygems_version: 2.5.2
58
+ rubygems_version: 2.6.8
59
59
  signing_key:
60
60
  specification_version: 4
61
61
  summary: Git submodules support for Capistrano 3.7+