luban 0.10.13 → 0.11.0

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: d2197bc2f1215bc1e7ba625d15b171000605ccb8
4
- data.tar.gz: 11600b62a3bab7f21b82b2c6d20bf23540ed88bc
3
+ metadata.gz: 28913085e6dfeed7d1c4c564666a631a214bad59
4
+ data.tar.gz: 6db8621b76547ad88298ed2dafc0bab3d680f4ec
5
5
  SHA512:
6
- metadata.gz: 2b47441615660507a34779ea1dd357f1f0980053bd4ea08de7fb9c1da933975f5d0b2d5978b52f243c2324efe7a0b6724a1ad1853f2865d193ee7bf3c660cdd4
7
- data.tar.gz: d0a91157712c0214e88ae92c1edec6a339dc86c27a699bf6422df9d6f681f1870032088158d1d024d49b57c1a27528608f38a088dd4b9b11853276541eef2be9
6
+ metadata.gz: 667c8e649af0e5c8e6927447cca4d47033dfda63b3ff71fc3083a43ebfe3bd428d68bafa59ed3e5491af202dd83d5ad637ba96d20e0aeb007cd56377cf29c714
7
+ data.tar.gz: e1b788bdd1192440b8ea611316008281e9a251ecc552acd59cb59057890230f62dc6664488660a9250814d0fe1bd3fcde5884691b6f65d1b5f86957f69db65e6
data/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # Change log
2
2
 
3
+ ## Version 0.11.0 (Jan 04, 2017)
4
+
5
+ New features:
6
+ * Restructured Luban project prepared for containerization with docker support
7
+ * Relocated packages installation path to luban root
8
+ * Relocated releases deployment path to luban root
9
+
10
+ Minor enhancements:
11
+ * Added convenient util method, #with_clean_env, to cleanup Bundler environment before yielding the given code block
12
+ * Cleaned up Bundler environment:
13
+ * In Gem Installer before any gem installations
14
+ * In Bundler Installer before checking the version for installed Bundler
15
+ * In Publisher before installing gems from cache
16
+ * In App Repository before bundling gems required by application
17
+ * In Service Controller for process control actions
18
+
19
+ Bug fixes:
20
+ * Refined SSHKit::Backend::Local and SSHKit::Runner::Abstract to handle local host object properly
21
+
3
22
  ## Version 0.10.13 (Dec 17, 2016)
4
23
 
5
24
  Minor enhancements:
@@ -40,7 +40,7 @@ module Luban
40
40
  def bootstrap
41
41
  assure_dirs(downloads_path, archived_logs_path,
42
42
  tmp_path, app_bin_path, app_tmp_path,
43
- releases_path, shared_path)
43
+ releases_path, packages_path, shared_path)
44
44
  end
45
45
 
46
46
  def create_envrc_files
@@ -163,11 +163,7 @@ module Luban
163
163
  assure_dirs(bundle_config_path, gems_cache_path, bundle_path)
164
164
  sync_gems_cache
165
165
  sync_locked_gemfile
166
- if defined?(Bundler)
167
- Bundler.with_clean_env { install_gems_from_cache }
168
- else
169
- install_gems_from_cache
170
- end
166
+ with_clean_env { install_gems_from_cache }
171
167
  end
172
168
 
173
169
  def sync_gems_cache
@@ -184,13 +184,7 @@ module Luban
184
184
  bundle_path = Pathname.new('vendor').join('bundle')
185
185
  if release_with_gemfile?(gemfile_path)
186
186
  assure_dirs(gems_path)
187
- if defined?(Bundler)
188
- Bundler.with_clean_env do
189
- bundle_gems!(gemfile_path, gems_cache, bundle_path)
190
- end
191
- else
192
- bundle_gems!(gemfile_path, gems_cache, bundle_path)
193
- end
187
+ with_clean_env { bundle_gems!(gemfile_path, gems_cache, bundle_path) }
194
188
  else
195
189
  {}
196
190
  end
@@ -24,7 +24,7 @@ module Luban
24
24
  def release_tag; task.opts.release[:tag]; end
25
25
 
26
26
  def releases_path
27
- @releases_path ||= super.join('app')
27
+ @releases_path ||= super.join(project, application, 'app')
28
28
  end
29
29
 
30
30
  def release_path
@@ -41,8 +41,12 @@ module Luban
41
41
  @current_bin_path ||= current_path.join('bin')
42
42
  end
43
43
 
44
+ def packages_path
45
+ @packages_path ||= super.join(project)
46
+ end
47
+
44
48
  def package_path
45
- @package_path ||= luban_install_path.join('pkg', package_name)
49
+ @package_path ||= packages_path.join(package_name)
46
50
  end
47
51
 
48
52
  def package_versions_path
@@ -199,8 +199,8 @@ module Luban
199
199
  succeeded
200
200
  end
201
201
 
202
- def start_process!; capture(start_command); end
203
- def stop_process!; capture(stop_command); end
202
+ def start_process!; with_clean_env { capture(start_command) }; end
203
+ def stop_process!; with_clean_env { capture(stop_command) }; end
204
204
 
205
205
  def check_process!
206
206
  if pid_file_missing?
@@ -206,6 +206,11 @@ module Luban
206
206
  Time.now().strftime("%d/%m/%Y %H:%M:%S")
207
207
  end
208
208
 
209
+ def with_clean_env
210
+ return unless block_given?
211
+ defined?(Bundler) ? Bundler.with_clean_env { yield } : yield
212
+ end
213
+
209
214
  #def method_missing(sym, *args, &blk)
210
215
  # backend.respond_to?(sym) ? backend.send(sym, *args, &blk) : super
211
216
  #end
@@ -9,7 +9,7 @@ module Luban
9
9
 
10
10
  def installed?
11
11
  return false unless file?(bundler_executable)
12
- match?("#{bundler_executable} -v", package_version)
12
+ with_clean_env { match?("#{bundler_executable} -v", package_version) }
13
13
  end
14
14
 
15
15
  protected
@@ -58,11 +58,15 @@ module Luban
58
58
  end
59
59
 
60
60
  def install_gem!
61
- test("#{gem_executable} install #{install_opts.join(' ')} #{src_cache_path} >> #{install_log_file_path} 2>&1")
61
+ with_clean_env do
62
+ test("#{gem_executable} install #{install_opts.join(' ')} #{src_cache_path} >> #{install_log_file_path} 2>&1")
63
+ end
62
64
  end
63
65
 
64
66
  def uninstall_gem!
65
- test("#{gem_executable} uninstall #{package_name} -a -x -I >> #{install_log_file_path} 2>&1")
67
+ with_clean_env do
68
+ test("#{gem_executable} uninstall #{package_name} -a -x -I >> #{install_log_file_path} 2>&1")
69
+ end
66
70
  end
67
71
  end
68
72
  end
@@ -0,0 +1,15 @@
1
+ class SSHKit::Backend::Local
2
+ def initialize(host = Host.new(:local), &block)
3
+ super
4
+ end
5
+ end
6
+
7
+ class SSHKit::Runner::Abstract
8
+ def backend(host, &block)
9
+ if host.local?
10
+ SSHKit::Backend::Local.new(host, &block)
11
+ else
12
+ SSHKit.config.backend.new(host, &block)
13
+ end
14
+ end
15
+ end
@@ -1,5 +1,5 @@
1
1
  module Luban
2
2
  module Deployment
3
- VERSION = "0.10.13"
3
+ VERSION = "0.11.0"
4
4
  end
5
5
  end
@@ -17,6 +17,10 @@ module Luban
17
17
  end
18
18
 
19
19
  module Remote
20
+ def releases_path
21
+ @releases_path ||= luban_root_path.join('releases')
22
+ end
23
+
20
24
  def env_path
21
25
  @env_path ||= luban_root_path.join('env')
22
26
  end
@@ -54,10 +58,6 @@ module Luban
54
58
  @app_tmp_path ||= app_path.join('tmp')
55
59
  end
56
60
 
57
- def releases_path
58
- @releases_path ||= app_path.join('releases')
59
- end
60
-
61
61
  def shared_path
62
62
  @shared_path ||= app_path.join('shared')
63
63
  end
@@ -70,13 +70,13 @@ module Luban
70
70
  @unset_envrc_file ||= app_path.join(".unset_envrc")
71
71
  end
72
72
 
73
- def luban_install_path
74
- @luban_install_path ||= project_path.join('.luban')
73
+ def packages_path
74
+ @packages_path ||= luban_root_path.join('packages')
75
75
  end
76
76
 
77
77
  def package_install_path(package_name)
78
- luban_install_path.join('pkg', package_name.to_s, 'versions',
79
- packages[package_name.to_sym].current_version)
78
+ packages_path.join(project, package_name.to_s, 'versions',
79
+ packages[package_name.to_sym].current_version)
80
80
  end
81
81
 
82
82
  def package_bin_path(package_name)
@@ -1,5 +1,6 @@
1
1
  require_relative 'deployment/version'
2
2
  require_relative 'deployment/error'
3
+ require_relative 'deployment/sshkit_refinements'
3
4
  require_relative 'deployment/configuration'
4
5
  require_relative 'deployment/helpers'
5
6
  require_relative 'deployment/parameters'
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.13
4
+ version: 0.11.0
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-12-17 00:00:00.000000000 Z
11
+ date: 2017-01-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: luban-cli
@@ -154,6 +154,7 @@ files:
154
154
  - lib/luban/deployment/packages/yaml.rb
155
155
  - lib/luban/deployment/parameters.rb
156
156
  - lib/luban/deployment/runner.rb
157
+ - lib/luban/deployment/sshkit_refinements.rb
157
158
  - lib/luban/deployment/templates/application/config/deploy.rb.erb
158
159
  - lib/luban/deployment/templates/application/config/deploy/__stage.rb.erb
159
160
  - lib/luban/deployment/templates/application/config/deploy/__stage/env_vars.rb