luban 0.9.14 → 0.9.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/lib/luban/deployment/cli/application/publisher.rb +6 -5
- data/lib/luban/deployment/cli/application/repository.rb +46 -30
- data/lib/luban/deployment/helpers/utils.rb +11 -2
- data/lib/luban/deployment/version.rb +1 -1
- data/lib/luban/deployment/worker/paths.rb +1 -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: 33000a33b27913c0433ef4a5c597ea5586b111cf
|
4
|
+
data.tar.gz: 1ce53ac76b5ad8fe85c6ec3552b0506db817223c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90e6d4a88b8336bea742037a7415dacaa0955e3aff0be3c4f64246e395211559b689fecd80bab9dd47dd404deec7c0247a731731a3ab524579e0fa785efdbb27
|
7
|
+
data.tar.gz: 90ef31818a038040f3d784fe310aaa6bafb6a6da0b0d5e214b6e63ffdb1bfd401f254f023b23b5b0a26f5b6c98bf05deba4ffa1485f2190896a3ebfce348064c
|
data/CHANGELOG.md
CHANGED
@@ -85,7 +85,7 @@ module Luban
|
|
85
85
|
|
86
86
|
def after_publish
|
87
87
|
create_symlinks
|
88
|
-
bundle_gems unless
|
88
|
+
bundle_gems unless locked_gemfile.nil?
|
89
89
|
end
|
90
90
|
|
91
91
|
protected
|
@@ -167,13 +167,14 @@ module Luban
|
|
167
167
|
end
|
168
168
|
|
169
169
|
def sync_gems_cache
|
170
|
-
capture(:ls, '-xt', gems_cache_path).split.each do |gem_name|
|
171
|
-
rm(gems_cache_path.join(gem_name)) unless gems.has_key?(gem_name)
|
172
|
-
end
|
173
170
|
gems.each_pair do |gem_name, md5|
|
174
171
|
gem_path = gems_cache_path.join(gem_name)
|
175
172
|
unless md5_matched?(gem_path, md5)
|
176
|
-
|
173
|
+
if file?(gem_file = gems_source[:path].join(gem_name))
|
174
|
+
upload!(gem_file.to_s, gem_path.to_s)
|
175
|
+
else
|
176
|
+
upload!("#{gem_file.to_s}/", gem_path.to_s, recursive: true)
|
177
|
+
end
|
177
178
|
end
|
178
179
|
end
|
179
180
|
end
|
@@ -23,6 +23,10 @@ module Luban
|
|
23
23
|
@workspace_path ||= app_path.join('.luban')
|
24
24
|
end
|
25
25
|
|
26
|
+
def gems_path
|
27
|
+
@gems_path ||= workspace_path.join('gems')
|
28
|
+
end
|
29
|
+
|
26
30
|
def clone_path
|
27
31
|
@clone_path ||= workspace_path.join('repositories', type)
|
28
32
|
end
|
@@ -170,46 +174,58 @@ module Luban
|
|
170
174
|
end
|
171
175
|
end
|
172
176
|
|
177
|
+
def release_with_gemfile?(gemfile_path)
|
178
|
+
test(:tar, "-tzf #{release_package_path} #{gemfile_path} > /dev/null 2>&1")
|
179
|
+
end
|
180
|
+
|
173
181
|
def bundle_gems
|
174
182
|
gemfile_path = Pathname.new(release_tag).join('Gemfile')
|
175
183
|
gems_cache = Pathname.new('vendor').join('cache')
|
176
184
|
bundle_path = Pathname.new('vendor').join('bundle')
|
185
|
+
if release_with_gemfile?(gemfile_path)
|
186
|
+
assure_dirs(gems_path)
|
187
|
+
bundle_gems!(gemfile_path, gems_cache, bundle_path)
|
188
|
+
else
|
189
|
+
{}
|
190
|
+
end
|
191
|
+
end
|
192
|
+
|
193
|
+
def bundle_gems!(gemfile_path, gems_cache, bundle_path)
|
177
194
|
bundled_gems = {}
|
178
195
|
gems = bundled_gems[:gems] = {}
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
unless
|
186
|
-
|
187
|
-
options << "--without #{bundle_without.join(' ')}"
|
188
|
-
end
|
189
|
-
options << "--quiet"
|
190
|
-
execute(bundle_cmd, :install, *options)
|
191
|
-
info "Package gems bundled in Gemfile"
|
192
|
-
execute(bundle_cmd, :package, "--all --quiet")
|
193
|
-
end
|
194
|
-
gem_files = capture(:ls, '-xt', gems_cache.join('*.gem')).split
|
195
|
-
gem_files.each do |gem_file|
|
196
|
-
gem_name = File.basename(gem_file)
|
197
|
-
md5_file = "#{gem_file}.md5"
|
198
|
-
gems[gem_name] =
|
199
|
-
if file?(workspace_path.join(md5_file))
|
200
|
-
gems[gem_name] = capture(:cat, md5_file)
|
201
|
-
else
|
202
|
-
md5_for_file(gem_file).tap { |md5|
|
203
|
-
execute(:echo, "#{md5} > #{md5_file}")
|
204
|
-
}
|
205
|
-
end
|
196
|
+
within(gems_path) do
|
197
|
+
paths_to_extract = [gemfile_path, "#{gemfile_path}.lock", "#{release_tag}/vendor/gems"]
|
198
|
+
execute(:tar, "--strip-components=1 -xzf #{release_package_path} #{paths_to_extract.join(' ')} > /dev/null 2>&1; true")
|
199
|
+
options = []
|
200
|
+
options << "--path #{bundle_path}"
|
201
|
+
unless test(bundle_cmd, :check, *options)
|
202
|
+
unless bundle_without.include?(stage.to_s)
|
203
|
+
options << "--without #{bundle_without.join(' ')}"
|
206
204
|
end
|
205
|
+
options << "--quiet"
|
206
|
+
execute(bundle_cmd, :install, *options)
|
207
|
+
info "Package gems bundled in Gemfile"
|
208
|
+
execute(bundle_cmd, :package, "--all --quiet")
|
207
209
|
end
|
208
|
-
|
209
|
-
|
210
|
-
|
210
|
+
|
211
|
+
gem_files = capture(:ls, '-xtd', "#{gems_cache.join('*')} | grep -v \"md5$\"").split
|
212
|
+
gem_files.each do |gem_file|
|
213
|
+
gem_name = File.basename(gem_file)
|
214
|
+
md5_file = "#{gem_file}.md5"
|
215
|
+
gems[gem_name] =
|
216
|
+
if file?(md5_file)
|
217
|
+
gems[gem_name] = capture(:cat, md5_file)
|
218
|
+
else
|
219
|
+
md5_for(gem_file).tap { |md5| execute(:echo, "#{md5} > #{md5_file}") }
|
220
|
+
end
|
211
221
|
end
|
212
222
|
end
|
223
|
+
gems_path.join(gems_cache).tap do |p|
|
224
|
+
bundled_gems[:gems_cache] = { path: p, md5: md5_for_dir(p) }
|
225
|
+
end
|
226
|
+
gems_path.join('Gemfile.lock').tap do |p|
|
227
|
+
bundled_gems[:locked_gemfile] = { path: p, md5: md5_for_file(p) }
|
228
|
+
end
|
213
229
|
bundled_gems
|
214
230
|
end
|
215
231
|
end
|
@@ -88,10 +88,19 @@ module Luban
|
|
88
88
|
capture("$(type -p readlink greadlink|head -1) #{source_file}")
|
89
89
|
end
|
90
90
|
|
91
|
+
def md5_for(path)
|
92
|
+
file?(path) ? md5_for_file(path) : md5_for_dir(path)
|
93
|
+
end
|
94
|
+
|
91
95
|
def md5_for_file(file)
|
92
96
|
capture(:cat, "#{file} 2>/dev/null | openssl md5")[/\h+$/]
|
93
97
|
end
|
94
98
|
|
99
|
+
def md5_for_dir(dir)
|
100
|
+
#capture(:tar, "-cf - #{dir} 2>/dev/null | openssl md5")[/\h+$/]
|
101
|
+
capture(:find, "#{dir} -type f 2>/dev/null | LC_ALL=C sort -u | xargs cat | openssl md5")[/\h+$/]
|
102
|
+
end
|
103
|
+
|
95
104
|
def sudo(*args)
|
96
105
|
execute(:sudo, *args)
|
97
106
|
end
|
@@ -165,8 +174,8 @@ module Luban
|
|
165
174
|
backend.capture(*args, raise_on_non_zero_exit: false, &blk).chomp
|
166
175
|
end
|
167
176
|
|
168
|
-
def md5_matched?(
|
169
|
-
file?(
|
177
|
+
def md5_matched?(path, md5)
|
178
|
+
file?(path) ? md5 == md5_for_file(path) : md5 == md5_for_dir(path)
|
170
179
|
end
|
171
180
|
|
172
181
|
#def execute(*args, &blk)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: luban
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rubyist Lei
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-11-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: luban-cli
|