luban 0.10.3 → 0.10.4

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: 55aba9574e332f5a608c7176ec441d73fd4e03f4
4
- data.tar.gz: 547945f3dc755960590af2589663b75412a8ad94
3
+ metadata.gz: a5d01d98fc1561dd61bcf2d415ca796c29a54801
4
+ data.tar.gz: 90e2b6151e3ba31d770bba1d38a4ff0f83b50cf2
5
5
  SHA512:
6
- metadata.gz: f1c6d8e7f8edf67288c2198462beb0d255712aefe04c0c8dc799ac42794cc2ffe46796dbd96d596799d8bb7cdde716e9007fbfde6ffd5520afd528fb5b6f8563
7
- data.tar.gz: a2977dfa28743cf5049367e04cd9af8022a0be5616375a77b0d659d51e529a9599f82a9c1640c853d4102b24f76fecafff7c708601e5d7949d1a0a46eae195d0
6
+ metadata.gz: 6f8003df0b31ecec8fc9f50446da675c5f5dd06b45c35fefe2eed976e21a047a719fcaa13879fcc97e70b2ca1bdf2182a3a11fb2200b24bba63b9dee478ba594
7
+ data.tar.gz: c65e5d86585134818411f3d97f32b1f4aa8c643ebf264a18d20d5f22b2b7e5dac6a774255be992a481b5e8bc0c911576d4e625da76d468f78f1f2eaf6688aaf7
data/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Change log
2
2
 
3
+ ## Version 0.10.4 (Nov 24, 2016)
4
+
5
+ Minor enhancements:
6
+ * Enhanced linked_files become a convention instead of a configuration
7
+ * Checked md5 for gem cache directory before actually sync each gem in gem cache
8
+
9
+ Bug fixes:
10
+ * Excluded *.md5 files, if any, when calculating md5 for a given directory
11
+ * Corrected the md5_file path when calculating md5 for each Ruby gem
12
+
3
13
  ## Version 0.10.3 (Nov 22, 2016)
4
14
 
5
15
  Minor enhancements:
data/exe/luban CHANGED
File without changes
@@ -113,7 +113,7 @@ module Luban
113
113
  def create_symlinks
114
114
  send("create_#{release_type}_symlinks")
115
115
  if has_gemfile?
116
- create_linked_dirs(bundle_linked_dirs, from: shared_path, to: release_path)
116
+ create_linked_dirs(bundle_linked_dirs, to: release_path)
117
117
  end
118
118
  end
119
119
 
@@ -134,11 +134,11 @@ module Luban
134
134
  end
135
135
 
136
136
  def create_symlinks_for_linked_dirs
137
- create_linked_dirs(linked_dirs, from: shared_path, to: release_path)
137
+ create_linked_dirs(to: release_path)
138
138
  end
139
139
 
140
140
  def create_symlinks_for_linked_files
141
- create_linked_files(linked_files, from: profile_path, to: release_path.join('config'))
141
+ create_linked_files(to: release_path)
142
142
  end
143
143
 
144
144
  def update_releases_log
@@ -171,6 +171,7 @@ module Luban
171
171
  end
172
172
 
173
173
  def sync_gems_cache
174
+ return if md5_matched?(gems_cache_path, gems_source[:md5])
174
175
  gems.each_pair do |gem_name, md5|
175
176
  gem_path = gems_cache_path.join(gem_name)
176
177
  unless md5_matched?(gem_path, md5)
@@ -217,7 +217,7 @@ module Luban
217
217
  gem_files = capture(:ls, '-xtd', "#{gems_cache.join('*')} | grep -v \"md5$\"").split
218
218
  gem_files.each do |gem_file|
219
219
  gem_name = File.basename(gem_file)
220
- md5_file = "#{gem_file}.md5"
220
+ md5_file = gems_path.join("#{gem_file}.md5")
221
221
  gems[gem_name] =
222
222
  if file?(md5_file)
223
223
  gems[gem_name] = capture(:cat, md5_file)
@@ -45,7 +45,7 @@ module Luban
45
45
  return if default_templates.empty?
46
46
  puts " Initializing #{service_name} profile"
47
47
  assure_dirs(profile_templates_path, stage_profile_path)
48
- upload_profile_templates
48
+ upload_profile_templates(default_templates)
49
49
  end
50
50
 
51
51
  def update_profile
@@ -56,16 +56,26 @@ module Luban
56
56
 
57
57
  protected
58
58
 
59
- def upload_profile_templates
60
- default_templates.each do |src_path|
61
- next unless file?(src_path)
59
+ def upload_profile_templates(templates, dirs: Pathname.new(''), depth: 2)
60
+ indent = ' ' * depth
61
+ templates.each do |src_path|
62
62
  basename = src_path.basename
63
+ print indent + "- #{basename}"
64
+
65
+ if directory?(src_path)
66
+ [profile_templates_path, stage_profile_path].each do |p|
67
+ assure_dirs(p.join(dirs).join(basename))
68
+ end
69
+ puts
70
+ upload_profile_templates(src_path.children, dirs: dirs.join(basename), depth: depth + 1)
71
+ next
72
+ end
73
+
63
74
  dst_path = if src_path.extname == '.erb'
64
75
  profile_templates_path
65
76
  else
66
77
  stage_profile_path
67
- end.join(basename)
68
- print " - #{basename}"
78
+ end.join(dirs).join(basename)
69
79
  if file?(dst_path)
70
80
  puts " [skipped]"
71
81
  else
@@ -20,11 +20,11 @@ module Luban
20
20
  end
21
21
 
22
22
  def create_symlinks_for_linked_dirs
23
- create_linked_dirs(linked_dirs, from: shared_path, to: install_path)
23
+ create_linked_dirs(to: install_path)
24
24
  end
25
25
 
26
26
  def create_symlinks_for_linked_files
27
- create_linked_files(linked_files, from: profile_path, to: install_path.join('config'))
27
+ create_linked_files(to: install_path)
28
28
  end
29
29
  end
30
30
  end
@@ -50,7 +50,7 @@ module Luban
50
50
 
51
51
  def copy_dir(src_path, dst_path, stages: [], depth: 1)
52
52
  indent = ' ' * depth
53
- print indent + "- #{dst_path.basename}"
53
+ print indent + "- #{dst_path.basename}"
54
54
  mkdir(dst_path)
55
55
  src_files = []
56
56
  src_path.each_child do |p|
@@ -5,19 +5,42 @@ module Luban
5
5
  def linked_dirs; @linked_dirs ||= []; end
6
6
  def linked_files; @linked_files ||= []; end
7
7
 
8
+ def linked_files_dir
9
+ @linked_files_dir ||= 'config'
10
+ end
11
+
12
+ def linked_files_root
13
+ @linked_files_root ||= config_finder[:application].stage_profile_path.join(profile_name)
14
+ end
15
+
16
+ def linked_files_from
17
+ @linked_files_from ||= linked_files_root.join(linked_files_dir)
18
+ end
19
+
8
20
  protected
9
21
 
10
22
  def init
11
23
  super
24
+ init_linked_dirs
25
+ init_linked_files
26
+ end
27
+
28
+ def init_linked_dirs
12
29
  linked_dirs.push('log', 'pids')
13
30
  end
14
31
 
32
+ def init_linked_files
33
+ Dir.chdir(linked_files_from) do
34
+ linked_files.concat(Pathname.glob("**/*").select { |f| f.file? })
35
+ end
36
+ end
37
+
15
38
  def assure_linked_dirs
16
39
  return if linked_dirs.empty?
17
40
  assure_dirs(linked_dirs.collect { |dir| shared_path.join(dir) })
18
41
  end
19
42
 
20
- def create_linked_dirs(dirs, from:, to:)
43
+ def create_linked_dirs(dirs = linked_dirs, from: shared_path, to:)
21
44
  dirs.each do |path|
22
45
  target_path = to.join(path)
23
46
  assure_dirs(target_path.dirname)
@@ -27,9 +50,9 @@ module Luban
27
50
  end
28
51
  end
29
52
 
30
- def create_linked_files(files, from:, to:)
53
+ def create_linked_files(files = linked_files, from: profile_path, to:)
31
54
  files.each do |path|
32
- target_path = to.join(path)
55
+ target_path = to.join(linked_files_dir).join(path)
33
56
  assure_dirs(target_path.dirname)
34
57
  rm(target_path) if file?(target_path)
35
58
  source_path = from.join(path)
@@ -101,8 +101,7 @@ module Luban
101
101
  end
102
102
 
103
103
  def md5_for_dir(dir)
104
- #capture(:tar, "-cf - #{dir} 2>/dev/null | openssl md5")[/\h+$/]
105
- capture(:find, "#{dir} -type f 2>/dev/null | LC_ALL=C sort -u | xargs cat | openssl md5")[/\h+$/]
104
+ capture(:find, "#{dir} -type f ! -name '*.md5' 2>/dev/null | LC_ALL=C sort -u | xargs cat | openssl md5")[/\h+$/]
106
105
  end
107
106
 
108
107
  def sudo(*args)
@@ -1,5 +1,5 @@
1
1
  module Luban
2
2
  module Deployment
3
- VERSION = "0.10.3"
3
+ VERSION = "0.10.4"
4
4
  end
5
5
  end
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.10.3
4
+ version: 0.10.4
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-22 00:00:00.000000000 Z
11
+ date: 2016-11-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: luban-cli