capistrano-scm-local 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/capistrano-scm-local.gemspec +1 -1
- data/lib/capistrano/local.rb +10 -4
- metadata +1 -1
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |gem|
|
6
6
|
gem.name = "capistrano-scm-local"
|
7
|
-
gem.version = '0.1.
|
7
|
+
gem.version = '0.1.2'
|
8
8
|
gem.authors = ["Boris Gorbylev"]
|
9
9
|
gem.email = ["ekho@ekho.name"]
|
10
10
|
gem.description = %q{Capistrano extension for deploying form local directory}
|
data/lib/capistrano/local.rb
CHANGED
@@ -6,11 +6,13 @@ require 'zlib'
|
|
6
6
|
require 'archive/tar/minitar'
|
7
7
|
include Archive::Tar
|
8
8
|
require 'tmpdir'
|
9
|
+
require 'fileutils'
|
9
10
|
|
10
11
|
class Capistrano::Local < Capistrano::SCM
|
11
12
|
module DefaultStrategy
|
12
13
|
def check
|
13
|
-
|
14
|
+
puts repo_url
|
15
|
+
test! " [ -e #{repo_url} ] "
|
14
16
|
end
|
15
17
|
|
16
18
|
def release
|
@@ -23,7 +25,7 @@ class Capistrano::Local < Capistrano::SCM
|
|
23
25
|
|
24
26
|
module ArchiveStrategy
|
25
27
|
def check
|
26
|
-
test! " [ -
|
28
|
+
test! " [ -e #{repo_url} ] "
|
27
29
|
end
|
28
30
|
|
29
31
|
def release
|
@@ -32,8 +34,12 @@ class Capistrano::Local < Capistrano::SCM
|
|
32
34
|
run_locally do
|
33
35
|
archive = fetch(:tmp_dir, Dir::tmpdir()) + '/' + fetch(:application, 'distr') + "-#{release_timestamp}.tar.gz"
|
34
36
|
unless File.exists?(archive)
|
35
|
-
|
36
|
-
|
37
|
+
if File.directory?(repo_url) || !File.fnmatch('*.tar.gz', repo_url)
|
38
|
+
Dir.chdir(repo_url) do
|
39
|
+
Minitar.pack('.', Zlib::GzipWriter.new(File.open(archive, 'wb')))
|
40
|
+
end
|
41
|
+
else
|
42
|
+
FileUtils.cp(repo_url, archive)
|
37
43
|
end
|
38
44
|
end
|
39
45
|
end
|