capistrano-scm-local 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
@@ -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.4'
|
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/scm-local.rb
CHANGED
@@ -1,2 +1,63 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
load File.expand_path("../tasks/scm-local.rake", __FILE__)
|
2
|
+
|
3
|
+
require 'capistrano/scm'
|
4
|
+
|
5
|
+
require 'zlib'
|
6
|
+
require 'archive/tar/minitar'
|
7
|
+
include Archive::Tar
|
8
|
+
require 'tmpdir'
|
9
|
+
require 'fileutils'
|
10
|
+
|
11
|
+
class Capistrano::Local < Capistrano::SCM
|
12
|
+
module DefaultStrategy
|
13
|
+
def check
|
14
|
+
puts repo_url
|
15
|
+
test! " [ -e #{repo_url} ] "
|
16
|
+
end
|
17
|
+
|
18
|
+
def release
|
19
|
+
on release_roles :all, in: :parallel do |host|
|
20
|
+
file_list = Dir.glob(repo_url + '/*').concat(Dir.glob(repo_url + '/.[^.]*'))
|
21
|
+
file_list.each { |r| upload! r, release_path, recursive: true }
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
module ArchiveStrategy
|
27
|
+
def check
|
28
|
+
test! " [ -e #{repo_url} ] "
|
29
|
+
end
|
30
|
+
|
31
|
+
def release
|
32
|
+
archive = ''
|
33
|
+
# preparing archive
|
34
|
+
run_locally do
|
35
|
+
archive = fetch(:tmp_dir, Dir::tmpdir()) + '/' + fetch(:application, 'distr') + "-#{release_timestamp}.tar.gz"
|
36
|
+
unless File.exists?(archive)
|
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)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
# uploading and unpacking
|
48
|
+
on release_roles :all, in: :parallel do |host|
|
49
|
+
upload! archive, releases_path, verbose: false
|
50
|
+
remote_archive = File.join(releases_path, File.basename(archive))
|
51
|
+
execute :tar, 'xzf', remote_archive, '-C', release_path
|
52
|
+
execute :rm, '-f', remote_archive
|
53
|
+
end
|
54
|
+
|
55
|
+
# removing archive
|
56
|
+
run_locally do
|
57
|
+
execute :rm, '-f', archive
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
set :capistrano_local_archive, Capistrano::Local::ArchiveStrategy
|
File without changes
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-scm-local
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-05-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: capistrano
|
@@ -55,9 +55,8 @@ files:
|
|
55
55
|
- README.md
|
56
56
|
- capistrano-scm-local.gemspec
|
57
57
|
- lib/capistrano-scm-local.rb
|
58
|
-
- lib/capistrano/local.rb
|
59
58
|
- lib/capistrano/scm-local.rb
|
60
|
-
- lib/capistrano/tasks/local.rake
|
59
|
+
- lib/capistrano/tasks/scm-local.rake
|
61
60
|
homepage: http://github.com/i-ekho/capistrano-scm-local
|
62
61
|
licenses:
|
63
62
|
- MIT
|
data/lib/capistrano/local.rb
DELETED
@@ -1,63 +0,0 @@
|
|
1
|
-
load File.expand_path("../tasks/local.rake", __FILE__)
|
2
|
-
|
3
|
-
require 'capistrano/scm'
|
4
|
-
|
5
|
-
require 'zlib'
|
6
|
-
require 'archive/tar/minitar'
|
7
|
-
include Archive::Tar
|
8
|
-
require 'tmpdir'
|
9
|
-
require 'fileutils'
|
10
|
-
|
11
|
-
class Capistrano::Local < Capistrano::SCM
|
12
|
-
module DefaultStrategy
|
13
|
-
def check
|
14
|
-
puts repo_url
|
15
|
-
test! " [ -e #{repo_url} ] "
|
16
|
-
end
|
17
|
-
|
18
|
-
def release
|
19
|
-
on release_roles :all, in: :parallel do |host|
|
20
|
-
file_list = Dir.glob(repo_url + '/*').concat(Dir.glob(repo_url + '/.[^.]*'))
|
21
|
-
file_list.each { |r| upload! r, release_path, recursive: true }
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
module ArchiveStrategy
|
27
|
-
def check
|
28
|
-
test! " [ -e #{repo_url} ] "
|
29
|
-
end
|
30
|
-
|
31
|
-
def release
|
32
|
-
archive = ''
|
33
|
-
# preparing archive
|
34
|
-
run_locally do
|
35
|
-
archive = fetch(:tmp_dir, Dir::tmpdir()) + '/' + fetch(:application, 'distr') + "-#{release_timestamp}.tar.gz"
|
36
|
-
unless File.exists?(archive)
|
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)
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
# uploading and unpacking
|
48
|
-
on release_roles :all, in: :parallel do |host|
|
49
|
-
upload! archive, releases_path, verbose: false
|
50
|
-
remote_archive = File.join(releases_path, File.basename(archive))
|
51
|
-
execute :tar, 'xzf', remote_archive, '-C', release_path
|
52
|
-
execute :rm, '-f', remote_archive
|
53
|
-
end
|
54
|
-
|
55
|
-
# removing archive
|
56
|
-
run_locally do
|
57
|
-
execute :rm, '-f', archive
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
set :capistrano_local_archive, Capistrano::Local::ArchiveStrategy
|