luban 0.6.9 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fcaab3a6f85c7700a2a3591f4964bc6588e1d341
4
- data.tar.gz: d4d4038ffdf658f4a50bfcf796a5bec5aa23efe2
3
+ metadata.gz: 1e6d4f9cdf3011d2178e45db658af31c0c177bd3
4
+ data.tar.gz: 601049ece4a58b0b23cb368cc343009723ac887d
5
5
  SHA512:
6
- metadata.gz: 90d73c8299cd2c2197ed996532f859d3728a6cfa1f1ef8c099367adfe29ad4b50cb4f63d212b73cd66e1d774c2a4326e53185a18d6fcffe7c0126e6454d611bb
7
- data.tar.gz: e17cb7ffc3fe8658d73d2cdadf3d06de1cc016056d9f27170614c11261d7ee7f43bc5d0c95aa3a9ff18bbd448c3b8cb3afbb9b180ce680f7ba9f6eba928183ec
6
+ metadata.gz: 13b3bdc0260bbb588b730136cd682a51df4c5a3a91efeca7ea9d9cf6084942e1975f7975b1a879a31f916909e39239977de6cd14efd7bc586ed44c5bdb1b909a
7
+ data.tar.gz: ae4f6b0794889d7eafbb073b34ad2fa842681f64ac99c12aeed7e45102a335bdb1fbdd9a84b69433e7d5d0694a95a949c3390bbf30e53166340948e45290c76c
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Change log
2
2
 
3
+ ## Version 0.7.0 (Aug 18, 2016)
4
+
5
+ New features:
6
+ * Supported app configuration stored in the environment variables
7
+
3
8
  ## Version 0.6.9 (Aug 15, 2016)
4
9
 
5
10
  Minor enhancements:
@@ -5,6 +5,10 @@ module Luban
5
5
  include Luban::Deployment::Worker::Paths::Remote
6
6
  include Luban::Deployment::Service::Worker::Base
7
7
 
8
+ def shell_setup_commands
9
+ super << "cd #{release_path}"
10
+ end
11
+
8
12
  %i(name full_name version major_version patch_level).each do |method|
9
13
  define_method("application_#{method}") { send("target_#{method}") }
10
14
  end
@@ -31,8 +31,7 @@ module Luban
31
31
  end
32
32
 
33
33
  def parent; task.opts.parent; end
34
- def child?; !parent.nil?; end
35
-
34
+ def child?; !parent.nil?; end
36
35
 
37
36
  def current_path
38
37
  @current_path ||= app_path.join(package_name)
@@ -186,11 +186,11 @@ module Luban
186
186
  end
187
187
 
188
188
  def start_process!
189
- capture("#{start_command} 2>&1")
189
+ capture(compose_command(start_command))
190
190
  end
191
191
 
192
192
  def stop_process!
193
- capture("#{stop_command} 2>&1")
193
+ capture(compose_command(stop_command))
194
194
  end
195
195
 
196
196
  def check_process!
@@ -229,15 +229,15 @@ module Luban
229
229
  end
230
230
 
231
231
  def monitor_process!
232
- test("#{monitor_command} 2>&1")
232
+ test(compose_command(monitor_command))
233
233
  end
234
234
 
235
235
  def unmonitor_process!
236
- test("#{unmonitor_command} 2>&1")
236
+ test(compose_command(unmonitor_command))
237
237
  end
238
238
 
239
239
  def reload_monitor_process!
240
- test("#{reload_monitor_command} 2>&1")
240
+ test(compose_command(reload_monitor_command))
241
241
  end
242
242
  end
243
243
 
@@ -3,6 +3,14 @@ module Luban
3
3
  module Service
4
4
  class Worker < Luban::Deployment::Package::Worker
5
5
  module Base
6
+ def shell_setup_commands
7
+ @shell_setup_commands ||= ["source #{envrc_file}"]
8
+ end
9
+
10
+ def compose_command(cmd)
11
+ "#{shell_setup_commands.join('; ')}; #{cmd} 2>&1"
12
+ end
13
+
6
14
  %i(name full_name version major_version patch_level).each do |method|
7
15
  define_method("service_#{method}") { send("target_#{method}") }
8
16
  end
@@ -161,8 +161,10 @@ module Luban
161
161
  def load_stage_configuration
162
162
  target.load_configuration_file(stage_config_file)
163
163
  if File.directory?(stage_config_path)
164
- Dir[stage_config_path.join("{packages}/**/*.rb")].each do |file|
165
- target.load_configuration_file(file)
164
+ ["*.rb", "{packages}/**/*.rb"].each do |pattern|
165
+ Dir[stage_config_path.join(pattern)].each do |file|
166
+ target.load_configuration_file(file)
167
+ end
166
168
  end
167
169
  end
168
170
  end
@@ -25,6 +25,7 @@ module Luban
25
25
 
26
26
  parameter :stages
27
27
  parameter :applications
28
+ parameter :env_vars
28
29
 
29
30
  parameter :work_dir
30
31
  parameter :apps_path
@@ -37,6 +38,7 @@ module Luban
37
38
  def set_default_general_parameters
38
39
  set_default :luban_roles, %i(app)
39
40
  set_default :luban_root_path, DefaultLubanRootPath
41
+ set_default :env_vars, {}
40
42
  set_default :user, ENV['USER']
41
43
  set_default :config_finder, {}
42
44
  end
@@ -0,0 +1,3 @@
1
+ # Environment variables setup for <%= stage %> application <%= application_class_name %>
2
+
3
+ # env_vars[:key] = "value"
@@ -22,6 +22,11 @@ else
22
22
  PATH="$LUBAN_ROOT/bin:$PATH"
23
23
  export LUBAN_ROOT
24
24
  export PATH
25
-
25
+ <%- env_vars.each_pair do |name, value| -%>
26
+ <%= name.upcase %>=<%= value.inspect %>
27
+ <%- end -%>
28
+ <%- env_vars.each_key do |name| -%>
29
+ export <%= name.upcase %>
30
+ <%- end -%>
26
31
  echo_line "Environment <%= env_name %> is activated!"
27
32
  fi
@@ -2,4 +2,5 @@
2
2
  /Gemfile.lock
3
3
  .luban/
4
4
  vendor/cache/
5
+ env_vars.rb
5
6
  .DS_Store
@@ -11,6 +11,9 @@ if [ -n "${LUBAN_ROOT:+x}" ]; then
11
11
  PATH=${PATH//$LUBAN_ROOT\/bin:/}
12
12
  unset LUBAN_ROOT
13
13
  export PATH
14
+ <%- env_vars.each_key do |name| -%>
15
+ unset <%= name.upcase %>
16
+ <%- end -%>
14
17
  echo_line "Environment <%= env_name %> is de-activated!"
15
18
  else
16
19
  local current_env=${LUBAN_ROOT##*env/}
@@ -1,5 +1,5 @@
1
1
  module Luban
2
2
  module Deployment
3
- VERSION = "0.6.9"
3
+ VERSION = "0.7.0"
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.6.9
4
+ version: 0.7.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-08-15 00:00:00.000000000 Z
11
+ date: 2016-08-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: luban-cli
@@ -149,6 +149,7 @@ files:
149
149
  - lib/luban/deployment/runner.rb
150
150
  - lib/luban/deployment/templates/application/config/deploy.rb.erb
151
151
  - lib/luban/deployment/templates/application/config/deploy/__stage.rb.erb
152
+ - lib/luban/deployment/templates/application/config/deploy/__stage/env_vars.rb
152
153
  - lib/luban/deployment/templates/application/config/deploy/__stage/packages/.gitkeep
153
154
  - lib/luban/deployment/templates/application/config/deploy/__stage/profile/.gitkeep
154
155
  - lib/luban/deployment/templates/application/config/deploy/__stage/templates/.gitkeep