depengine 3.0.11 → 3.0.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/depengine/dsl/template.rb +2 -2
- data/lib/depengine/processor/template.rb +1 -1
- data/lib/depengine/publisher/ssh.rb +2 -1
- data/lib/depengine/version.rb +1 -1
- data/spec/ssh_spec.rb +21 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 65323cd0cb0e566052549a932ebf9648b5e9cdff
|
4
|
+
data.tar.gz: e332c30d4454cf4894058dc3b1fc4f1f6c123697
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd0b8f3e5b915c513c177eaceaaa4cba2a85db0f808a3ced5ed1322f156062b21c44a04ebea896f2c77dc83bb5749c1cd0baa077ff733e8f3dc0b08587f3dd01
|
7
|
+
data.tar.gz: e0832ffbb1bf5d715b9041b09dc3bd28ade749b7f7366384d5aa10f007147ce74b8fa88bf790e035199ca06b7790af37d37a28ffc1d150613e137246ef3f1396
|
data/Gemfile.lock
CHANGED
@@ -4,7 +4,7 @@ module Deployment
|
|
4
4
|
def parse_template(source, target, content, options={})
|
5
5
|
template = Processor::Template.new
|
6
6
|
template.cdb = @cdb
|
7
|
-
template.basepath = options[:basepath] || $recipe_config[:deploy_home]
|
7
|
+
template.basepath = options[:basepath] || $recipe_config[:recipe_base_dir] || $recipe_config[:deploy_home]
|
8
8
|
options[:excludes] = [] if options[:excludes].nil?
|
9
9
|
options[:excludes] << '.svn'
|
10
10
|
template.parse_template(source, content, target, options)
|
@@ -13,7 +13,7 @@ module Deployment
|
|
13
13
|
def parse_erb_template(source, target, content, options={})
|
14
14
|
template = Processor::Template.new
|
15
15
|
template.cdb = @cdb
|
16
|
-
template.basepath = options[:basepath] || $recipe_config[:deploy_home]
|
16
|
+
template.basepath = options[:basepath] || $recipe_config[:recipe_base_dir] || $recipe_config[:deploy_home]
|
17
17
|
options[:excludes] = [] if options[:excludes].nil?
|
18
18
|
options[:excludes] << '.svn'
|
19
19
|
template.parse_erb_template(source, content, target, options)
|
@@ -81,7 +81,7 @@ module Processor
|
|
81
81
|
template_content = ""
|
82
82
|
result = ""
|
83
83
|
if File.file? template
|
84
|
-
$log.writer.debug "
|
84
|
+
$log.writer.debug "template #{template} seems to be a file, reading it..."
|
85
85
|
File.open(template, "rb") do |f|
|
86
86
|
c = ""
|
87
87
|
f.ungetc c unless (c = f.getc)=="\uFEFF" # remove BOM, if present
|
@@ -59,7 +59,8 @@ module Publisher
|
|
59
59
|
|
60
60
|
def remove_old_releases(path, num_of_releases_to_keep, release_name_shema)
|
61
61
|
releases = remote_execute("ls #{path}").split("\n").find_all {|dir| dir =~ release_name_shema}.sort
|
62
|
-
|
62
|
+
num_to_remove = releases.size-num_of_releases_to_keep
|
63
|
+
releases_to_delete = releases.take(num_to_remove < 0 ? 0 : num_to_remove)
|
63
64
|
releases_to_delete.each do |dir|
|
64
65
|
$log.writer.debug "removing #{path}/#{dir}"
|
65
66
|
remote_execute("rm -rf #{path}/#{dir}")
|
data/lib/depengine/version.rb
CHANGED
data/spec/ssh_spec.rb
CHANGED
@@ -51,5 +51,25 @@ describe "the ssh publisher" do
|
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
54
|
-
|
54
|
+
context "when no previous release" do
|
55
|
+
it "does not remove anything" do
|
56
|
+
tmp_dir = Dir.mktmpdir
|
57
|
+
begin
|
58
|
+
worker = Publisher::Ssh.new
|
59
|
+
worker.remote_host = 'localhost'
|
60
|
+
worker.remote_user = ENV['USER']
|
61
|
+
worker.ssh_key_file = ENV['HOME']+"/.ssh/id_rsa"
|
62
|
+
|
63
|
+
newest_release = Time.now.strftime("%Y-%m-%d_%s")
|
64
|
+
FileUtils.mkdir_p(File.join(tmp_dir, newest_release))
|
55
65
|
|
66
|
+
worker.remove_old_releases(tmp_dir, 2, /[0-9]{4}\-[0-9]{2}\-[0-9]{2}_[0-9]+.*/)
|
67
|
+
Dir.glob(tmp_dir+"/*").size.should be 1
|
68
|
+
Dir.glob(tmp_dir+"/*").first.should include(newest_release)
|
69
|
+
|
70
|
+
ensure
|
71
|
+
FileUtils.remove_entry tmp_dir
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: depengine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Team Automatisierung
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|