luban 0.7.4 → 0.7.5
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 +4 -4
- data/CHANGELOG.md +10 -0
- data/lib/luban/deployment/cli/application/base.rb +0 -5
- data/lib/luban/deployment/cli/application/constructor.rb +0 -9
- data/lib/luban/deployment/cli/application/publisher.rb +18 -35
- data/lib/luban/deployment/cli/application/repository.rb +1 -1
- data/lib/luban/deployment/cli/service/base.rb +0 -7
- data/lib/luban/deployment/cli/service/installer.rb +22 -0
- data/lib/luban/deployment/helpers/linked_paths.rb +42 -0
- data/lib/luban/deployment/helpers.rb +1 -0
- data/lib/luban/deployment/parameters.rb +0 -4
- data/lib/luban/deployment/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 25350f60e02f4ad3fdb32ef96e950ebd2bc06f68
|
4
|
+
data.tar.gz: 7a290c7c19c41bc551d629d84eb1ab289b84be5c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f17055fec2a3d3daf4cda59716b6e480f0122a80ee97ca3b9b6f798667ed3389bace1b0a26e9f9154493dbced804cebc9a1086338dc04e4860d7b50e13bb45d8
|
7
|
+
data.tar.gz: 68326cb893360e365623305212ddba81eb06355b46ec7ec77d95a2527b72ac8cb48431049b9687ab4a42d1e7b6fef246c50a8e24d9cd15a023d6cb1850cdb8fe
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
# Change log
|
2
2
|
|
3
|
+
## Version 0.7.5 (Aug 30, 2016)
|
4
|
+
|
5
|
+
Minor enhancements:
|
6
|
+
* Extracted linked_dirs/linked_files handling into LinkedPaths module
|
7
|
+
* Used LinkedPaths module to change linked_dirs/linked_files into worker level instance variables instead of global configuration to better cope with different linked paths requirements among different worker classes from Application and Service, like Publisher and Installer
|
8
|
+
|
9
|
+
Bug fixes:
|
10
|
+
* Correctly composed the bundle command when installing gems from cache in Publisher
|
11
|
+
* Extracted Gemfile.lock in addition to Gemfile if any from the release tarball to ensure deploy the exact same set of gems specified from the Gemfile.lock in code repository
|
12
|
+
|
3
13
|
## Version 0.7.4 (Aug 26, 2016)
|
4
14
|
|
5
15
|
Bug fixes:
|
@@ -259,11 +259,6 @@ module Luban
|
|
259
259
|
set_default_profile
|
260
260
|
end
|
261
261
|
|
262
|
-
def set_default_application_parameters
|
263
|
-
super
|
264
|
-
linked_dirs.push('log', 'pids')
|
265
|
-
end
|
266
|
-
|
267
262
|
def set_default_source
|
268
263
|
source(default_source_path, scm: :rsync)
|
269
264
|
release(stage, current: true)
|
@@ -42,15 +42,6 @@ module Luban
|
|
42
42
|
assure_dirs(logrotate_path, downloads_path,
|
43
43
|
tmp_path, app_bin_path, app_tmp_path,
|
44
44
|
releases_path, shared_path)
|
45
|
-
assure_linked_dirs
|
46
|
-
end
|
47
|
-
|
48
|
-
def assure_linked_dirs
|
49
|
-
return if linked_dirs.empty?
|
50
|
-
linked_dirs.each do |dir|
|
51
|
-
linked_dir = shared_path.join(dir)
|
52
|
-
assure(:directory, linked_dir) { mkdir(linked_dir) }
|
53
|
-
end
|
54
45
|
end
|
55
46
|
|
56
47
|
def create_envrc_files
|
@@ -2,6 +2,8 @@ module Luban
|
|
2
2
|
module Deployment
|
3
3
|
class Application
|
4
4
|
class Publisher < Worker
|
5
|
+
include Luban::Deployment::Helpers::LinkedPaths
|
6
|
+
|
5
7
|
def release_type; task.opts.release_pack[:type]; end
|
6
8
|
def release_version; task.opts.release_pack[:version]; end
|
7
9
|
def release_tag; task.opts.release_pack[:tag]; end
|
@@ -118,8 +120,7 @@ module Luban
|
|
118
120
|
def create_symlinks
|
119
121
|
send("create_#{release_type}_symlinks")
|
120
122
|
if file?(gemfile)
|
121
|
-
|
122
|
-
from: linked_dirs_from, to: linked_dirs_to)
|
123
|
+
create_linked_dirs(bundle_linked_dirs, from: shared_path, to: release_path)
|
123
124
|
end
|
124
125
|
end
|
125
126
|
|
@@ -130,39 +131,23 @@ module Luban
|
|
130
131
|
|
131
132
|
def create_app_symlinks
|
132
133
|
create_release_symlink(app_path)
|
133
|
-
|
134
|
-
|
134
|
+
assure_linked_dirs
|
135
|
+
create_symlinks_for_linked_dirs
|
136
|
+
create_symlinks_for_linked_files
|
135
137
|
end
|
136
138
|
|
137
139
|
def create_release_symlink(target_dir)
|
138
140
|
assure_symlink(release_path, target_dir.join(release_type))
|
139
141
|
end
|
140
142
|
|
141
|
-
def
|
142
|
-
|
143
|
-
from: linked_dirs_from, to: linked_dirs_to)
|
143
|
+
def create_symlinks_for_linked_dirs
|
144
|
+
create_linked_dirs(linked_dirs, from: shared_path, to: release_path)
|
144
145
|
end
|
145
146
|
|
146
|
-
def
|
147
|
-
|
148
|
-
from: linked_files_from, to: linked_files_to)
|
147
|
+
def create_symlinks_for_linked_files
|
148
|
+
create_linked_files(linked_files, from: profile_path, to: release_path.join('config'))
|
149
149
|
end
|
150
150
|
|
151
|
-
def create_shared_symlinks_for(linked_paths, type:, from:, to:)
|
152
|
-
linked_paths.each do |path|
|
153
|
-
target_path = to.join(path)
|
154
|
-
assure_dirs(target_path.dirname)
|
155
|
-
rm('-r', target_path) if send("#{type}?", target_path)
|
156
|
-
source_path = from.join(path)
|
157
|
-
assure_symlink(source_path, target_path) if send("#{type}?", source_path)
|
158
|
-
end
|
159
|
-
end
|
160
|
-
|
161
|
-
def linked_dirs_from; shared_path; end
|
162
|
-
def linked_dirs_to; release_path; end
|
163
|
-
def linked_files_from; profile_path; end
|
164
|
-
def linked_files_to; release_path.join('config'); end
|
165
|
-
|
166
151
|
def create_etc_symlinks
|
167
152
|
create_logrotate_symlinks
|
168
153
|
end
|
@@ -216,17 +201,15 @@ module Luban
|
|
216
201
|
end
|
217
202
|
|
218
203
|
def install_gems_from_cache
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
unless
|
224
|
-
|
225
|
-
options << "--without #{bundle_without.join(' ')}"
|
226
|
-
end
|
227
|
-
options << bundle_flags.join(' ')
|
228
|
-
execute(bundle_cmd, :install, *options)
|
204
|
+
options = []
|
205
|
+
options << "--gemfile #{gemfile}"
|
206
|
+
options << "--path #{bundle_path}"
|
207
|
+
unless test(bundle_cmd, :check, *options)
|
208
|
+
unless bundle_without.include?(stage.to_s)
|
209
|
+
options << "--without #{bundle_without.join(' ')}"
|
229
210
|
end
|
211
|
+
options << bundle_flags.join(' ')
|
212
|
+
execute(bundle_cmd, :install, *options)
|
230
213
|
end
|
231
214
|
end
|
232
215
|
end
|
@@ -169,7 +169,7 @@ module Luban
|
|
169
169
|
gems = bundled_gems[:gems] = {}
|
170
170
|
if test(:tar, "-tzf #{release_package_path} #{gemfile_path} > /dev/null 2>&1")
|
171
171
|
within(workspace_path) do
|
172
|
-
execute(:tar, "--strip-components=1 -xzf #{release_package_path} #{gemfile_path}")
|
172
|
+
execute(:tar, "--strip-components=1 -xzf #{release_package_path} #{gemfile_path} #{gemfile_path}.lock > /dev/null 2>&1")
|
173
173
|
options = []
|
174
174
|
options << "--path #{bundle_path}"
|
175
175
|
unless test(:bundle, :check, *options)
|
@@ -30,13 +30,6 @@ module Luban
|
|
30
30
|
def init_profile(args:, opts:)
|
31
31
|
orig_init_profile(args: args, opts: opts.merge(default_templates: default_templates))
|
32
32
|
end
|
33
|
-
|
34
|
-
protected
|
35
|
-
|
36
|
-
def set_parameters
|
37
|
-
super
|
38
|
-
linked_dirs.push('log', 'pids')
|
39
|
-
end
|
40
33
|
end
|
41
34
|
end
|
42
35
|
end
|
@@ -3,6 +3,28 @@ module Luban
|
|
3
3
|
module Service
|
4
4
|
class Installer < Luban::Deployment::Package::Installer
|
5
5
|
include Worker::Base
|
6
|
+
include Luban::Deployment::Helpers::LinkedPaths
|
7
|
+
|
8
|
+
protected
|
9
|
+
|
10
|
+
def bootstrap_install
|
11
|
+
super
|
12
|
+
assure_linked_dirs
|
13
|
+
end
|
14
|
+
|
15
|
+
def create_symlinks!
|
16
|
+
super
|
17
|
+
create_symlinks_for_linked_dirs
|
18
|
+
create_symlinks_for_linked_files
|
19
|
+
end
|
20
|
+
|
21
|
+
def create_symlinks_for_linked_dirs
|
22
|
+
create_linked_dirs(linked_dirs, from: shared_path, to: install_path)
|
23
|
+
end
|
24
|
+
|
25
|
+
def create_symlinks_for_linked_files
|
26
|
+
create_linked_files(linked_files, from: profile_path, to: install_path.join('config'))
|
27
|
+
end
|
6
28
|
end
|
7
29
|
end
|
8
30
|
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module Luban
|
2
|
+
module Deployment
|
3
|
+
module Helpers
|
4
|
+
module LinkedPaths
|
5
|
+
def linked_dirs; @linked_dirs ||= []; end
|
6
|
+
def linked_files; @linked_files ||= []; end
|
7
|
+
|
8
|
+
protected
|
9
|
+
|
10
|
+
def init
|
11
|
+
super
|
12
|
+
linked_dirs.push('log', 'pids')
|
13
|
+
end
|
14
|
+
|
15
|
+
def assure_linked_dirs
|
16
|
+
return if linked_dirs.empty?
|
17
|
+
assure_dirs(linked_dirs.collect { |dir| shared_path.join(dir) })
|
18
|
+
end
|
19
|
+
|
20
|
+
def create_linked_dirs(dirs, from:, to:)
|
21
|
+
dirs.each do |path|
|
22
|
+
target_path = to.join(path)
|
23
|
+
assure_dirs(target_path.dirname)
|
24
|
+
rmdir(target_path) if directory?(target_path)
|
25
|
+
source_path = from.join(path)
|
26
|
+
assure_symlink(source_path, target_path) #if directory?(source_path)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def create_linked_files(files, from:, to:)
|
31
|
+
files.each do |path|
|
32
|
+
target_path = to.join(path)
|
33
|
+
assure_dirs(target_path.dirname)
|
34
|
+
rm(target_path) if file?(target_path)
|
35
|
+
source_path = from.join(path)
|
36
|
+
assure_symlink(source_path, target_path) #if file?(source_path)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -111,16 +111,12 @@ module Luban
|
|
111
111
|
|
112
112
|
parameter :application
|
113
113
|
parameter :scm_role
|
114
|
-
parameter :linked_dirs
|
115
|
-
parameter :linked_files
|
116
114
|
parameter :logrotate_files
|
117
115
|
|
118
116
|
protected
|
119
117
|
|
120
118
|
def set_default_application_parameters
|
121
119
|
set_default :scm_role, :scm
|
122
|
-
set_default :linked_dirs, []
|
123
|
-
set_default :linked_files, []
|
124
120
|
set_default :logrotate_files, []
|
125
121
|
|
126
122
|
setup_default_application_config_finder
|
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.7.
|
4
|
+
version: 0.7.5
|
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-08-
|
11
|
+
date: 2016-08-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: luban-cli
|
@@ -138,6 +138,7 @@ files:
|
|
138
138
|
- lib/luban/deployment/helpers.rb
|
139
139
|
- lib/luban/deployment/helpers/configuration.rb
|
140
140
|
- lib/luban/deployment/helpers/generator.rb
|
141
|
+
- lib/luban/deployment/helpers/linked_paths.rb
|
141
142
|
- lib/luban/deployment/helpers/utils.rb
|
142
143
|
- lib/luban/deployment/packages/bundler.rb
|
143
144
|
- lib/luban/deployment/packages/git.rb
|