capistrano-git-copy 0.5.0 → 0.6.0.rc1
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 +15 -9
- data/capistrano-git-copy.gemspec +1 -1
- data/lib/capistrano/git/copy/tasks/deploy.cap +55 -15
- data/lib/capistrano/git/copy/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f0294d9a08b688020ce1e8d6a2cb9f1a34809ea8
|
4
|
+
data.tar.gz: 5187fe2733f233ccb0fa28d09e20d7c98f3ee261
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c72c8755b87d71e150d12b5549f1fa10576446d6cfc9b79821674e1cb3b2c24dd54af724084fdcd043c8c0eaf0fcc279279003d49d14d1afb165f4b00b90e84c
|
7
|
+
data.tar.gz: 97ab0f19de8b67651ebd697f8687cfcf65c41bbe0d22d2ecbd206eaef65544937860c6accbeb7b80005214a72893bdec8fa832d5f2cb3a370c7cf20543dc151c
|
data/README.md
CHANGED
@@ -1,10 +1,6 @@
|
|
1
1
|
# Capistrano::GIT::Copy
|
2
2
|
|
3
|
-
Creates a tar archive from the
|
4
|
-
|
5
|
-
## Requirements
|
6
|
-
|
7
|
-
* [git-archive-all](https://github.com/Kentzo/git-archive-all)
|
3
|
+
Creates a tar archive locally from the git repository and uploads it to the remote server.
|
8
4
|
|
9
5
|
## Setup
|
10
6
|
|
@@ -16,7 +12,7 @@ group :development do
|
|
16
12
|
end
|
17
13
|
```
|
18
14
|
|
19
|
-
And
|
15
|
+
And require it in your `Capfile`:
|
20
16
|
|
21
17
|
```ruby
|
22
18
|
require 'capistrano/git/copy'
|
@@ -28,10 +24,20 @@ Now use `git_copy` as your SCM type in your `config/deploy.rb`:
|
|
28
24
|
|
29
25
|
## Configuration
|
30
26
|
|
31
|
-
You can modify any of the following Capistrano variables in your deploy.rb config.
|
27
|
+
You can modify any of the following Capistrano variables in your `deploy.rb` config.
|
28
|
+
|
29
|
+
- `git_archive_all_bin` - Set the path for the git-archive-all command. Defaults to git-archive-all found in $PATH or the included version as a fallback.
|
30
|
+
- `git_copy_tmp_path` - Temporary path where the repository is cloned to and the archive is created.
|
31
|
+
|
32
|
+
## Notes
|
33
|
+
|
34
|
+
* Uses [git-archive-all](https://github.com/Kentzo/git-archive-all) for bundling repositories.
|
35
|
+
|
36
|
+
## Code status
|
32
37
|
|
33
|
-
|
34
|
-
|
38
|
+
* [](http://badge.fury.io/rb/capistrano-git-copy)
|
39
|
+
* [](https://gemnasium.com/ydkn/capistrano-git-copy)
|
40
|
+
* [](https://www.pullreview.com/github/ydkn/capistrano-git-copy/reviews/master)
|
35
41
|
|
36
42
|
## Contributing
|
37
43
|
|
data/capistrano-git-copy.gemspec
CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_dependency 'capistrano', '>= 3.
|
21
|
+
spec.add_dependency 'capistrano', '>= 3.1.0'
|
22
22
|
|
23
23
|
spec.add_development_dependency 'bundler', '~> 1.3'
|
24
24
|
spec.add_development_dependency 'rake'
|
@@ -12,6 +12,8 @@ end
|
|
12
12
|
namespace :git_copy do
|
13
13
|
task :wrapper do
|
14
14
|
fail "git-archive-all binary not found" if fetch(:git_archive_all_bin).strip.length == 0
|
15
|
+
|
16
|
+
invoke 'git_copy:update_local_working_copy'
|
15
17
|
end
|
16
18
|
|
17
19
|
task :check do; end
|
@@ -19,25 +21,19 @@ namespace :git_copy do
|
|
19
21
|
|
20
22
|
desc 'Create tar and upload to server'
|
21
23
|
task update: :'git_copy:wrapper' do
|
22
|
-
|
23
|
-
local_repo_path
|
24
|
-
local_tar_file = File.join(tmp_path, 'archive.tar.gz')
|
25
|
-
|
26
|
-
local_repo_url = `cd #{local_repo_path} 2>/dev/null && git config --get remote.origin.url 2>/dev/null`.strip
|
27
|
-
|
28
|
-
system("rm -rf #{tmp_path}") unless fetch(:repo_url) == local_repo_url
|
29
|
-
system("mkdir -p #{tmp_path}")
|
30
|
-
|
31
|
-
system("if [ -d #{local_repo_path} ]; then cd #{local_repo_path} && git fetch origin; else git clone #{fetch(:repo_url)} #{local_repo_path}; fi")
|
24
|
+
# create tar with git-archive-all
|
25
|
+
system("cd #{fetch(:local_repo_path)} && #{fetch(:git_archive_all_bin)} __tmp.tar")
|
32
26
|
|
33
|
-
|
34
|
-
system("cd #{local_repo_path} && tar -xf __tmp.tar && cd __tmp && tar -czf #{local_tar_file} .")
|
27
|
+
# create tar.gz for upload
|
28
|
+
system("cd #{fetch(:local_repo_path)} && tar -xf __tmp.tar && cd __tmp && tar -czf #{fetch(:local_tar_file)} .")
|
35
29
|
|
30
|
+
# upload to all servers
|
36
31
|
on release_roles :all do
|
37
|
-
upload!(local_tar_file, "#{fetch(:tmp_dir)}/#{fetch(:application)}_#{fetch(:stage)}.tar.gz")
|
32
|
+
upload!(fetch(:local_tar_file), "#{fetch(:tmp_dir)}/#{fetch(:application)}_#{fetch(:stage)}.tar.gz")
|
38
33
|
end
|
39
34
|
|
40
|
-
|
35
|
+
# delete temporary tar.gz archive
|
36
|
+
system("rm -rf #{fetch(:local_tar_file)}")
|
41
37
|
end
|
42
38
|
|
43
39
|
desc 'Extract tar to release path'
|
@@ -51,10 +47,54 @@ namespace :git_copy do
|
|
51
47
|
|
52
48
|
desc 'Determine the revision that will be deployed'
|
53
49
|
task set_current_revision: :'git_copy:wrapper' do
|
54
|
-
revision = `git rev-parse --short #{fetch(:branch, 'master')} 2>/dev/null`.strip
|
50
|
+
revision = `cd #{fetch(:local_repo_path)} && git rev-parse --short #{fetch(:branch, 'master')} 2>/dev/null`.strip
|
55
51
|
|
56
52
|
on release_roles :all do
|
57
53
|
set :current_revision, revision
|
58
54
|
end
|
59
55
|
end
|
56
|
+
|
57
|
+
desc 'Clean up temp dir'
|
58
|
+
task :cleanup do
|
59
|
+
tmp_path = fetch(:git_copy_tmp_path)
|
60
|
+
|
61
|
+
if File.exists?(tmp_path)
|
62
|
+
system("rm -rf #{tmp_path}")
|
63
|
+
print "Removed #{tmp_path}\n"
|
64
|
+
else
|
65
|
+
print "Nothing to cleanup (#{tmp_path} not found on filesystem)\n"
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
task update_local_working_copy: :'git_copy:wrapper' do
|
70
|
+
tmp_path = fetch(:git_copy_tmp_path)
|
71
|
+
|
72
|
+
set :local_repo_path, File.join(tmp_path, 'repo')
|
73
|
+
set :local_tar_file, File.join(tmp_path, 'archive.tar.gz')
|
74
|
+
|
75
|
+
# track if the repo url has changed
|
76
|
+
local_repo_url = `cd #{fetch(:local_repo_path)} 2>/dev/null && git config --get remote.origin.url 2>/dev/null`.strip
|
77
|
+
system("rm -rf #{tmp_path}") unless fetch(:repo_url) == local_repo_url
|
78
|
+
|
79
|
+
# prepare temp directory
|
80
|
+
system("mkdir -p #{tmp_path}")
|
81
|
+
|
82
|
+
# clone or update repository
|
83
|
+
if File.exists?(fetch(:local_repo_path))
|
84
|
+
system("cd #{fetch(:local_repo_path)} && git fetch origin")
|
85
|
+
else
|
86
|
+
system("git clone #{fetch(:repo_url)} #{fetch(:local_repo_path)}")
|
87
|
+
end
|
88
|
+
|
89
|
+
# reset repository
|
90
|
+
system("cd #{fetch(:local_repo_path)} && git reset --hard origin/#{fetch(:branch, 'master')} && git submodule init && git submodule update")
|
91
|
+
|
92
|
+
# init and update submodules
|
93
|
+
system("cd #{fetch(:local_repo_path)} && git submodule init && git submodule update")
|
94
|
+
system("cd #{fetch(:local_repo_path)} && git submodule foreach --recursive git submodule update --init")
|
95
|
+
|
96
|
+
# clean up working directory
|
97
|
+
system("cd #{fetch(:local_repo_path)} && git clean -d -f")
|
98
|
+
system("cd #{fetch(:local_repo_path)} && git submodule foreach --recursive git clean -d -f")
|
99
|
+
end
|
60
100
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-git-copy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Florian Schwab
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-09-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capistrano
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 3.
|
19
|
+
version: 3.1.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 3.
|
26
|
+
version: 3.1.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -101,9 +101,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
101
101
|
version: '0'
|
102
102
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
103
103
|
requirements:
|
104
|
-
- - "
|
104
|
+
- - ">"
|
105
105
|
- !ruby/object:Gem::Version
|
106
|
-
version:
|
106
|
+
version: 1.3.1
|
107
107
|
requirements: []
|
108
108
|
rubyforge_project:
|
109
109
|
rubygems_version: 2.2.2
|