capistrano-central_git 0.1.2 → 0.1.3
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.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bf734cc53f51b64f8b70d337651ffea0d68c7398
|
4
|
+
data.tar.gz: dbbbb3d5279b341c0b52081a4dca6d3b461cdfbe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 59d366e5c420e2e5a67018a4b20ba4462bc09fc5727f9427949fa011d274fb69569e6e733de68f1775c580b25c14180160bd7e3d65cc6d22ca83090e10a391f2
|
7
|
+
data.tar.gz: c4b01e1aaed395ad9f3f39a353d4954ba7ff319746a60bf38eaff23ff48418077795195c25a9db3b7385058847df136690c1a9c4b260ecb8a6168a1f441ff025
|
data/README.md
CHANGED
@@ -52,8 +52,12 @@ module Capistrano::CentralGit
|
|
52
52
|
@max_parallels ||= fetch(:max_parallels, hosts.size).to_i
|
53
53
|
end
|
54
54
|
|
55
|
-
def self.
|
56
|
-
@
|
55
|
+
def self.keep_central_packages
|
56
|
+
@keep_central_packages ||= fetch(:keep_central_packages, 5).to_i
|
57
|
+
end
|
58
|
+
|
59
|
+
def self.keep_release_packages
|
60
|
+
@keep_release_packages ||= fetch(:keep_release_packages, 5).to_i
|
57
61
|
end
|
58
62
|
end
|
59
63
|
end
|
@@ -79,15 +79,28 @@ module Capistrano::CentralGit
|
|
79
79
|
execute :tar, "zxf", config.release_package_path, "-C", release_path
|
80
80
|
end
|
81
81
|
|
82
|
-
def
|
83
|
-
|
84
|
-
|
82
|
+
def cleanup_central_packages
|
83
|
+
cleanup_packages(config.central_packages_path, config.keep_central_packages)
|
84
|
+
end
|
85
|
+
|
86
|
+
def cleanup_release_packages
|
87
|
+
cleanup_packages(config.release_packages_path, config.keep_release_packages)
|
88
|
+
end
|
89
|
+
|
90
|
+
def fetch_revision
|
91
|
+
capture(:git, "rev-list --max-count=1 --abbrev-commit #{fetch(:branch)}").strip
|
92
|
+
end
|
93
|
+
|
94
|
+
private
|
95
|
+
|
96
|
+
def cleanup_packages(packages_path, keep_packages)
|
97
|
+
packages = capture(:ls, '-xtr', packages_path).split
|
85
98
|
if packages.count >= keep_packages
|
86
99
|
info t(:keeping_packages, host: host.to_s, keep_packages: keep_packages, packages: packages.count)
|
87
|
-
older_packages = (packages - packages.last(
|
100
|
+
older_packages = (packages - packages.last(keep_packages))
|
88
101
|
if older_packages.any?
|
89
102
|
older_packages_str = older_packages.map do |package|
|
90
|
-
|
103
|
+
packages_path.join(package)
|
91
104
|
end.join(" ")
|
92
105
|
execute :rm, '-rf', older_packages_str
|
93
106
|
else
|
@@ -95,9 +108,5 @@ module Capistrano::CentralGit
|
|
95
108
|
end
|
96
109
|
end
|
97
110
|
end
|
98
|
-
|
99
|
-
def fetch_revision
|
100
|
-
capture(:git, "rev-list --max-count=1 --abbrev-commit #{fetch(:branch)}").strip
|
101
|
-
end
|
102
111
|
end
|
103
112
|
end
|
@@ -112,13 +112,19 @@ namespace :central_git do
|
|
112
112
|
end
|
113
113
|
|
114
114
|
desc "Cleanup packages"
|
115
|
-
task
|
115
|
+
task :cleanup do
|
116
116
|
run_central do
|
117
117
|
within central_packages_path do
|
118
|
-
central_git_scm.
|
118
|
+
central_git_scm.cleanup_central_packages
|
119
|
+
end
|
120
|
+
end
|
121
|
+
on release_roles :all do |host|
|
122
|
+
within release_packages_path do
|
123
|
+
central_git_scm.cleanup_release_packages
|
119
124
|
end
|
120
125
|
end
|
121
126
|
end
|
127
|
+
after :"deploy:cleanup", :cleanup
|
122
128
|
|
123
129
|
desc "Show configurations"
|
124
130
|
task :config do
|
@@ -138,7 +144,7 @@ namespace :central_git do
|
|
138
144
|
rsync_options: config.rsync_options,
|
139
145
|
rsync_rsh: config.rsync_rsh,
|
140
146
|
max_parallels: config.max_parallels(hosts),
|
141
|
-
|
147
|
+
keep_central_packages: config.keep_central_packages,
|
142
148
|
}
|
143
149
|
|
144
150
|
max_key_length = pairs.keys.map { |k| k.to_s.length }.max
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-central_git
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Masato Ikeda
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-07-
|
11
|
+
date: 2015-07-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capistrano
|