capistrano-git-copy 0.4.1 → 0.5.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: 2799635e6ca2f09d4a2bb4f31a244c61119580ef
4
- data.tar.gz: c5b7993504bbb916db357343ccdcc118a9b34ac8
3
+ metadata.gz: ebf8972754ecc7f4d30e9226bc5ce379c0e140b5
4
+ data.tar.gz: 89e3eb756e62ffe59be1e5376caa79995021e631
5
5
  SHA512:
6
- metadata.gz: 324a39f389bcb1c475d51074ad381b61c0ea84f76cc40cae70ede7cba800a6c68f58ae955824011c8b65e5102d1cfd78c757646a92480fa399c43bdbcd618519
7
- data.tar.gz: b465d73c1b1b81e1581bea0d29587ba3b87980323082d78f7a3d12ed1bcfeeda3b97894a54d769704490682c47a60128d0316a35b2c70c6ffa8bdc68223813d1
6
+ metadata.gz: c08617c6f6d583355e3371f73efa84c385e924723e77e8b1e50ea5d7913a8b3b7ffdfd0b25ef01aee5380bbffd7456988c9c12e317b04c874e54e10f14797738
7
+ data.tar.gz: 95adbebfb60bf7e59625406026c01d76146d397d4a27aa9e5a238a0a455a24ad7850d30cf3458261c8f2021a124b0ed933749eb64864002b7b8c441e78bbc118
@@ -1,8 +1,8 @@
1
1
  namespace :load do
2
2
  task :defaults do
3
3
  set :git_archive_all_bin, -> {
4
- bin = `which git-archive-all`
5
- bin.strip.length > 0 ? bin : File.join(Capistrano::Git::Copy.root_path, 'vendor', 'bin', 'git-archive-all')
4
+ bin = `which git-archive-all`.strip
5
+ bin.length > 0 ? bin : File.join(Capistrano::Git::Copy.root_path, 'vendor', 'bin', 'git-archive-all')
6
6
  }
7
7
 
8
8
  set :git_copy_tmp_path, -> { File.join(Dir.tmpdir, "#{fetch(:application)}_#{fetch(:stage)}") }
@@ -11,9 +11,7 @@ end
11
11
 
12
12
  namespace :git_copy do
13
13
  task :wrapper do
14
- on roles :all do
15
- fail "git-archive-all binary not found" if fetch(:git_archive_all_bin).strip.length == 0
16
- end
14
+ fail "git-archive-all binary not found" if fetch(:git_archive_all_bin).strip.length == 0
17
15
  end
18
16
 
19
17
  task :check do; end
@@ -32,10 +30,10 @@ namespace :git_copy do
32
30
 
33
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")
34
32
 
35
- system("cd #{local_repo_path} && git reset --hard origin/#{fetch(:branch)} && git submodule init && git submodule update && git-archive-all __tmp.tar")
33
+ system("cd #{local_repo_path} && git reset --hard origin/#{fetch(:branch, 'master')} && git submodule init && git submodule update && #{fetch(:git_archive_all_bin)} __tmp.tar")
36
34
  system("cd #{local_repo_path} && tar -xf __tmp.tar && cd __tmp && tar -czf #{local_tar_file} .")
37
35
 
38
- on roles :all do
36
+ on release_roles :all do
39
37
  upload!(local_tar_file, "#{fetch(:tmp_dir)}/#{fetch(:application)}_#{fetch(:stage)}.tar.gz")
40
38
  end
41
39
 
@@ -44,10 +42,19 @@ namespace :git_copy do
44
42
 
45
43
  desc 'Extract tar to release path'
46
44
  task create_release: :'git_copy:update' do
47
- on roles :all do
45
+ on release_roles :all do
48
46
  execute(:mkdir, '-p', release_path)
49
47
  execute(:tar, '-f', "#{fetch(:tmp_dir)}/#{fetch(:application)}_#{fetch(:stage)}.tar.gz", '-x -C', release_path)
50
48
  execute(:rm, '-f', "#{fetch(:tmp_dir)}/#{fetch(:application)}_#{fetch(:stage)}.tar.gz")
51
49
  end
52
50
  end
51
+
52
+ desc 'Determine the revision that will be deployed'
53
+ task set_current_revision: :'git_copy:wrapper' do
54
+ revision = `git rev-parse --short #{fetch(:branch, 'master')} 2>/dev/null`.strip
55
+
56
+ on release_roles :all do
57
+ set :current_revision, revision
58
+ end
59
+ end
53
60
  end
@@ -2,7 +2,7 @@ module Capistrano
2
2
  module Git
3
3
  module Copy
4
4
  # gem version
5
- VERSION = '0.4.1'
5
+ VERSION = '0.5.0'
6
6
  end
7
7
  end
8
8
  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.1
4
+ version: 0.5.0
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-04-05 00:00:00.000000000 Z
11
+ date: 2014-04-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capistrano