capistrano-strategy-copy-smart 0.0.2 → 1.0.0
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.
@@ -8,8 +8,8 @@ Gem::Specification.new do |s|
|
|
8
8
|
s.authors = ["Anssi Syrjäsalo", "Juha-Pekka Laiho"]
|
9
9
|
s.email = ["anssi.syrjasalo@eficode.fi", "juha-pekka.laiho@eficode.fi"]
|
10
10
|
s.homepage = ""
|
11
|
-
s.summary = %q{
|
12
|
-
s.description =
|
11
|
+
s.summary = %q{Capistrano copy strategy that takes into account the content of .gitignore}
|
12
|
+
s.description = ""
|
13
13
|
|
14
14
|
s.rubyforge_project = "capistrano-strategy-copy-smart"
|
15
15
|
|
@@ -3,43 +3,48 @@ require 'capistrano/recipes/deploy/strategy/copy'
|
|
3
3
|
module Capistrano
|
4
4
|
module Deploy
|
5
5
|
module Strategy
|
6
|
-
|
7
6
|
class CopySmart < Copy
|
8
7
|
|
9
|
-
def self.hello
|
10
|
-
p "hello"
|
11
|
-
end
|
12
|
-
|
13
|
-
# @overload
|
14
8
|
def deploy!
|
15
9
|
FileUtils.mkdir_p(destination)
|
16
10
|
|
17
|
-
logger.trace "
|
11
|
+
logger.trace "parsing the content of .gitignore"
|
12
|
+
files_to_copy = `git ls-files`.split("\n")
|
18
13
|
|
19
|
-
|
20
|
-
|
14
|
+
logger.trace "taking into account the untracked and deleted (but not staged) files"
|
15
|
+
`git status --short --porcelain`.split("\n").each do |line|
|
16
|
+
last_index = line.size
|
17
|
+
files_to_copy << line[3..last_index] if line[0..2] == "?? " # file new
|
18
|
+
files_to_copy.delete(line[3..last_index]) if line[0..2] == " D " # file deleted
|
19
|
+
end
|
21
20
|
|
22
|
-
|
23
|
-
|
21
|
+
unless copy_exclude.empty?
|
22
|
+
logger.trace "parsing exclusions defined by hand"
|
23
|
+
files_without_excluded = []
|
24
|
+
files_to_copy.each do |file|
|
25
|
+
next if copy_exclude.any? {|pattern| File.fnmatch(pattern, file) }
|
26
|
+
files_without_excluded << file
|
27
|
+
end
|
28
|
+
files_to_copy = files_without_excluded
|
24
29
|
end
|
25
30
|
|
26
|
-
logger.trace "
|
31
|
+
logger.trace "will copy #{files_to_copy.size} files from your working directory"
|
27
32
|
|
28
|
-
|
29
|
-
|
33
|
+
files_to_copy.each do |file|
|
34
|
+
file_dest_full_path = File.join(destination, file)
|
35
|
+
FileUtils.mkdir_p(File.dirname(file_dest_full_path)) unless File.exists?(File.dirname(file_dest_full_path))
|
36
|
+
FileUtils.cp(file, file_dest_full_path, { :preserve => true })
|
37
|
+
end
|
38
|
+
|
39
|
+
logger.trace "compressing #{destination} to #{filename}"
|
40
|
+
Dir.chdir(copy_dir) { system(compress(File.basename(destination), File.basename(filename)).join(" ")) }
|
30
41
|
|
31
|
-
|
42
|
+
distribute!
|
32
43
|
ensure
|
33
|
-
|
34
|
-
|
44
|
+
FileUtils.rm filename rescue nil
|
45
|
+
FileUtils.rm_rf destination rescue nil
|
35
46
|
end
|
36
47
|
|
37
|
-
private
|
38
|
-
|
39
|
-
def working_dir
|
40
|
-
@working_dir ||= Dir.pwd
|
41
|
-
end
|
42
|
-
|
43
48
|
end
|
44
49
|
end
|
45
50
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-strategy-copy-smart
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,12 +10,12 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2011-10-
|
13
|
+
date: 2011-10-14 00:00:00.000000000 +03:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: capistrano
|
18
|
-
requirement: &
|
18
|
+
requirement: &2165160920 !ruby/object:Gem::Requirement
|
19
19
|
none: false
|
20
20
|
requirements:
|
21
21
|
- - ~>
|
@@ -23,8 +23,8 @@ dependencies:
|
|
23
23
|
version: '2'
|
24
24
|
type: :runtime
|
25
25
|
prerelease: false
|
26
|
-
version_requirements: *
|
27
|
-
description:
|
26
|
+
version_requirements: *2165160920
|
27
|
+
description: ''
|
28
28
|
email:
|
29
29
|
- anssi.syrjasalo@eficode.fi
|
30
30
|
- juha-pekka.laiho@eficode.fi
|
@@ -62,5 +62,5 @@ rubyforge_project: capistrano-strategy-copy-smart
|
|
62
62
|
rubygems_version: 1.6.2
|
63
63
|
signing_key:
|
64
64
|
specification_version: 3
|
65
|
-
summary:
|
65
|
+
summary: Capistrano copy strategy that takes into account the content of .gitignore
|
66
66
|
test_files: []
|