capistrano-git-copy 1.2.0 → 1.2.1

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: e7784ccb4cb4af337de3e9023b46775da88e48e4
4
- data.tar.gz: 7f9abc9ceefb06d7247ecdc7c6080bdb2dd6a751
3
+ metadata.gz: 0c1bd7f1f0427e2237d05ec40bfd2b04c263cc1d
4
+ data.tar.gz: a04f09b5de4cf6fc31191910d20aa0809e0fe851
5
5
  SHA512:
6
- metadata.gz: 8dd0c5ad1efaf9c7c8a9da570d2c4bd51c4ecc52f3c85c8d8edffdea818d03489d628e5de526e18f5f8049491ee2cac52735c1a86fb40ed9ac8cc6d51fb89073
7
- data.tar.gz: 10200bb1f194a6489a2cfc77a8086d093a6bda24349f1a56c49b585c88cd8d6d5e596972363ed7d54e1a1a7f7dafbbba6ba32b5fe266d9c3f8893d1d9951ec3b
6
+ metadata.gz: ace9a0e03014d24d19e691725adb5a068701eb1fd074d19d47d08cdf7af1d6d0e195e06c64f813c9d80c640a661046a79e4e7c8042c33714b99393a1c6e6c08a
7
+ data.tar.gz: fa69a38fec6225118f9cbf35e7b38d5325802ba7506896e3991aadaf9b4abeb94991347eda42947158cf28f10bbe7f12b88fec4fe164ace0447a9f91e2959eea
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Change Log
2
2
 
3
+ ## 1.2.1 (2016-12-11)
4
+ ### Changes
5
+ - updated _git-archive-all_ to HEAD
6
+ - require _capistrano_ < 3.7.0 due to breaking changes
7
+
3
8
  ## 1.2.0 (2016-01-25)
4
9
  ### Changes
5
10
  - Check if local repository mirror is working and reinitialize if necessary
@@ -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.1.0', '< 4.0.0'
21
+ spec.add_dependency 'capistrano', '>= 3.1.0', '< 3.7.0'
22
22
 
23
23
  spec.add_development_dependency 'bundler', '~> 1.3'
24
24
  spec.add_development_dependency 'rake'
@@ -11,6 +11,8 @@ module Capistrano
11
11
  def initialize(context)
12
12
  @context = context
13
13
  @with_submodules = fetch(:with_submodules, true)
14
+ @repo_tree = fetch(:repo_tree, false)
15
+ @with_submodules = @repo_tree? false : @with_submodules # If repo_tree is specified, set with_submodules to false
14
16
  @git_excludes = fetch(:git_excludes, [])
15
17
  end
16
18
 
@@ -73,32 +75,14 @@ module Capistrano
73
75
  #
74
76
  # @return void
75
77
  def prepare_release
78
+ target = @repo_tree? "HEAD:#{@repo_tree}" : 'HEAD'
76
79
  if with_submodules
77
80
  execute(git_archive_all_bin, "--prefix=''", archive_path)
78
81
  else
79
- git(:archive, '--format=tar', 'HEAD', '|', 'gzip', "> #{archive_path}")
82
+ git(:archive, '--format=tar', target, '|', 'gzip', "> #{archive_path}")
80
83
  end
81
84
 
82
- if git_excludes.count > 0
83
- archive_dir = File.join(tmp_path, 'archive')
84
-
85
- execute :rm, '-rf', archive_dir
86
- execute :mkdir, '-p', archive_dir
87
- execute :tar, '-xzf', archive_path, '-C', archive_dir
88
-
89
- git_excludes.each do |f|
90
- file_path = File.join(archive_dir, f.gsub(/\A\//, ''))
91
-
92
- unless File.exists?(file_path)
93
- warn("#{f} does not exists!")
94
- next
95
- end
96
-
97
- FileUtils.rm_rf(file_path)
98
- end
99
-
100
- execute :tar, '-czf', archive_path, '-C', archive_dir, '.'
101
- end
85
+ exclude_files_from_archive if git_excludes.count > 0
102
86
  end
103
87
 
104
88
  # Upload and extract release
@@ -210,5 +194,26 @@ module Capistrano
210
194
  end
211
195
  end
212
196
  end
197
+
198
+ def exclude_files_from_archive
199
+ archive_dir = File.join(tmp_path, 'archive')
200
+
201
+ execute :rm, '-rf', archive_dir
202
+ execute :mkdir, '-p', archive_dir
203
+ execute :tar, '-xzf', archive_path, '-C', archive_dir
204
+
205
+ git_excludes.each do |f|
206
+ file_path = File.join(archive_dir, f.gsub(/\A\//, ''))
207
+
208
+ unless File.exists?(file_path)
209
+ warn("#{f} does not exists!")
210
+ next
211
+ end
212
+
213
+ FileUtils.rm_rf(file_path)
214
+ end
215
+
216
+ execute :tar, '-czf', archive_path, '-C', archive_dir, '.'
217
+ end
213
218
  end
214
219
  end
@@ -3,6 +3,6 @@ module Capistrano
3
3
  # GitCopy
4
4
  module GitCopy
5
5
  # gem version
6
- VERSION = '1.2.0'
6
+ VERSION = '1.2.1'
7
7
  end
8
8
  end
@@ -32,6 +32,7 @@ from subprocess import CalledProcessError, Popen, PIPE
32
32
  import sys
33
33
  import tarfile
34
34
  from zipfile import ZipFile, ZipInfo, ZIP_DEFLATED
35
+ import re
35
36
 
36
37
  __version__ = "1.13"
37
38
 
@@ -84,7 +85,7 @@ class GitArchiver(object):
84
85
  raise ValueError("You MUST pass absolute path to the main git repository.")
85
86
 
86
87
  try:
87
- self.run_shell("[ -d .git ] || git rev-parse --git-dir > /dev/null 2>&1", main_repo_abspath)
88
+ path.isdir(".git") or self.run_shell("git rev-parse --git-dir > /dev/null 2>&1", main_repo_abspath)
88
89
  except Exception as e:
89
90
  raise ValueError("{0} not a git repository (or any of the parent directories).".format(main_repo_abspath))
90
91
 
@@ -320,11 +321,16 @@ class GitArchiver(object):
320
321
  self.run_shell("git submodule init", repo_abspath)
321
322
  self.run_shell("git submodule update", repo_abspath)
322
323
 
323
- for submodule_path in self.read_shell("git submodule --quiet foreach 'pwd -P'", repo_abspath).splitlines():
324
- # Shell command returns absolute paths to submodules.
325
- submodule_path = path.relpath(submodule_path, self.main_repo_abspath)
326
- for file_path in self.walk_git_files(submodule_path):
327
- yield file_path
324
+ gitmodulesfile = path.join(repo_path, ".gitmodules")
325
+ if path.isfile(gitmodulesfile):
326
+ with open(gitmodulesfile) as f:
327
+ for line in f.readlines():
328
+ m = re.match("^\s*path\s*=\s*(.*)\s*$", line)
329
+ if m:
330
+ submodule_path = m.group(1)
331
+ submodule_path = path.join(repo_path, submodule_path)
332
+ for file_path in self.walk_git_files(submodule_path):
333
+ yield file_path
328
334
 
329
335
  @staticmethod
330
336
  def get_path_components(repo_abspath, abspath):
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: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Schwab
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-25 00:00:00.000000000 Z
11
+ date: 2016-12-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capistrano
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: 3.1.0
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: 4.0.0
22
+ version: 3.7.0
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,7 @@ dependencies:
29
29
  version: 3.1.0
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: 4.0.0
32
+ version: 3.7.0
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: bundler
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -114,9 +114,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
114
114
  version: '0'
115
115
  requirements: []
116
116
  rubyforge_project:
117
- rubygems_version: 2.5.1
117
+ rubygems_version: 2.5.2
118
118
  signing_key:
119
119
  specification_version: 4
120
120
  summary: Copy local git repository deploy strategy for capistrano
121
121
  test_files: []
122
- has_rdoc: