capistrano-git-with-submodules 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +21 -0
- data/README.md +44 -0
- data/lib/capistrano/scm/git-with-submodules.rb +59 -0
- metadata +48 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 6ddbced8591e7283c4dedd0261a4c8e2934ce707
|
4
|
+
data.tar.gz: c2ede3aabd1d4c2fa3f714c73c3f162bdb0545d6
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0241ee81fdafe63317e150db176ac68ec19a59ec8a179942fab685e97422e57894a4b64a91e02e241b1253a4f16800280f8b62952fd2ef9dcfc0069f89146b88
|
7
|
+
data.tar.gz: f844d95a53c66e7026e005aee5eae5d959d150ba525aa2ee9c2ab84582fb6e93148e27df95512cbdbdf7e82bb1f037d3e1267705abca232c14c0769265231667
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2014 Boris Gorbylev
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
# capistrano-git-with-submodules-plugin [![Gem](https://img.shields.io/gem/v/capistrano-git-with-submodules.svg?maxAge=2592000)](https://rubygems.org/gems/capistrano-git-with-submodules) [![Gem](https://img.shields.io/gem/dt/capistrano-git-with-submodules.svg?maxAge=2592000)](https://rubygems.org/gems/capistrano-git-with-submodules)
|
2
|
+
|
3
|
+
Git submodule support for Capistrano 3.7+
|
4
|
+
|
5
|
+
For Capistrano 3.0-3.6 use old [capistrano-git-submodule-stragtegy](https://github.com/ekho/capistrano-git-submodule-strategy)
|
6
|
+
|
7
|
+
## Using
|
8
|
+
|
9
|
+
####Gemfile
|
10
|
+
```ruby
|
11
|
+
gem 'capistrano-git-with-submodules', '~> 0.1', :github => 'ekho/capistrano-git-with-submodules-plugin'
|
12
|
+
```
|
13
|
+
|
14
|
+
####Capfile
|
15
|
+
Change default
|
16
|
+
```ruby
|
17
|
+
require "capistrano/scm/git"
|
18
|
+
install_plugin Capistrano::SCM::Git
|
19
|
+
```
|
20
|
+
to
|
21
|
+
```ruby
|
22
|
+
require "capistrano/scm/git-with-submodules"
|
23
|
+
install_plugin Capistrano::SCM::Git::WithSubmodules
|
24
|
+
```
|
25
|
+
|
26
|
+
####deploy.rb
|
27
|
+
Optionally you can keep git metadata (.git directory)
|
28
|
+
```ruby
|
29
|
+
set :git_keep_meta, true
|
30
|
+
```
|
31
|
+
|
32
|
+
## Contributing to capistrano-git-with-submodules-plugin
|
33
|
+
|
34
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
35
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
|
36
|
+
* Fork the project.
|
37
|
+
* Start a feature/bugfix branch.
|
38
|
+
* Commit and push until you are happy with your contribution.
|
39
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
40
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
41
|
+
|
42
|
+
## Copyright
|
43
|
+
|
44
|
+
Copyright (c) 2016 Boris Gorbylev. See LICENSE for further details.
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require "capistrano/scm/git"
|
2
|
+
|
3
|
+
class Capistrano::SCM::Git::WithSubmodules < Capistrano::SCM::Git
|
4
|
+
|
5
|
+
def archive_to_release_path
|
6
|
+
fail ':repo_tree currently not supported by GitWithSubmodules' if fetch(:repo_tree)
|
7
|
+
|
8
|
+
|
9
|
+
return if backend.test(:test, '-e', release_path) && backend.test("ls -A #{release_path} | read linevar")
|
10
|
+
|
11
|
+
_clone_repo
|
12
|
+
|
13
|
+
backend.within_only release_path do
|
14
|
+
git :submodule, 'update', '--init', '--recursive'
|
15
|
+
end
|
16
|
+
|
17
|
+
unless fetch(:git_keep_meta, false)
|
18
|
+
verbose = Rake.application.options.trace ? 'v' : ''
|
19
|
+
backend.execute("find #{release_path} -name '.git*' | xargs -I {} rm -rf#{verbose} '{}'")
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def _clone_repo
|
24
|
+
git_version = backend.capture(:git, '--version').strip.match('^git version (\d+(?:\.\d+)+)$')
|
25
|
+
|
26
|
+
if git_version.nil? || git_version[1] < '2.3.0'
|
27
|
+
_clone_repo_with_old_git
|
28
|
+
else
|
29
|
+
_clone_repo_with_fresh_git
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def _clone_repo_with_fresh_git
|
34
|
+
git :clone, '--reference', repo_path.to_s, '--dissociate', (fetch(:git_keep_meta, false) ? '' : '--depth=1'), '-b', fetch(:branch), repo_url, release_path
|
35
|
+
end
|
36
|
+
|
37
|
+
def _clone_repo_with_old_git
|
38
|
+
git :clone, (fetch(:git_keep_meta, false) ? '' : '--depth=1'), '-b', fetch(:branch), "file://#{repo_path}", release_path
|
39
|
+
backend.within_only release_path do
|
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
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
metadata
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: capistrano-git-with-submodules
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Boris Gorbylev
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-12-15 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Git submodules support for Capistrano 3.7+
|
14
|
+
email: ekho@ekho.name
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files:
|
18
|
+
- README.md
|
19
|
+
- LICENSE
|
20
|
+
files:
|
21
|
+
- LICENSE
|
22
|
+
- README.md
|
23
|
+
- lib/capistrano/scm/git-with-submodules.rb
|
24
|
+
homepage: https://github.com/ekho/capistrano-git-with-submodules
|
25
|
+
licenses:
|
26
|
+
- MIT
|
27
|
+
metadata: {}
|
28
|
+
post_install_message:
|
29
|
+
rdoc_options: []
|
30
|
+
require_paths:
|
31
|
+
- lib
|
32
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
33
|
+
requirements:
|
34
|
+
- - ">="
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: '0'
|
37
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: 1.3.6
|
42
|
+
requirements: []
|
43
|
+
rubyforge_project:
|
44
|
+
rubygems_version: 2.5.2
|
45
|
+
signing_key:
|
46
|
+
specification_version: 4
|
47
|
+
summary: Git submodules support for Capistrano 3.7+
|
48
|
+
test_files: []
|