luban-rack 0.2.16 → 0.2.17

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: 313729df0ba4064d8f42d76cd9575bc1d6a0eac7
4
- data.tar.gz: 4346730b53422db3cc5a927b9a272704e348c9f6
3
+ metadata.gz: 626db6c7b396d14e293e920efe56d3425761ef82
4
+ data.tar.gz: a62a72eeb89fd03d1ba6db97d538423fde5ca2e4
5
5
  SHA512:
6
- metadata.gz: 12a82940fd47c7bf4d17698967d4812b861158a105d652ab4e61eb0900a84668889912b74fcd24e7ad1cad4413b814803171e9d9dd43e88e40ab3566e8f6b83b
7
- data.tar.gz: c07e9df4ecf664e1f2faa43e96d334047a594cede7b75d7a5d6b650b3094831b24dc366edbb723741fc8d7150a2d7f30d0b4731fa511c8a8ef5cffc525dd7f4a
6
+ metadata.gz: 170aa8e0fabb3e51061e634011210820a4e422a6d0d613662991e175f726867e743fc9564629510699907423822986fb6f9d91994d02d4f6ae01f23fe99d0607
7
+ data.tar.gz: b86ae5dc78705ec32a35d50f1f9eee07ccde33c170d80482f7f376cdca0fd0f823c555a78c9444c20daf2ec3eb1e11b15e08e48b31a3f7da3ed88abeb0942765
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Change log
2
2
 
3
+ ## Version 0.2.17 (Nov 14, 2016)
4
+
5
+ Minor enhancements:
6
+ * Added publish callback for web server
7
+ * Added Puma plugin for Luban integration to
8
+ * Solved process tag unchanged during phase restart
9
+ * Loaded app from releast path directly instead of current_app_path
10
+
3
11
  ## Version 0.2.16 (Nov 09, 2016)
4
12
 
5
13
  Bug fixes:
@@ -3,6 +3,13 @@ module Luban
3
3
  module Applications
4
4
  class Rack
5
5
  class Publisher < Luban::Deployment::Application::Publisher
6
+ include WebServer
7
+
8
+ def after_publish
9
+ super
10
+ publish_web_server
11
+ end
12
+
6
13
  protected
7
14
 
8
15
  def init
@@ -2,4 +2,6 @@
2
2
 
3
3
  <% web_server[:opts].each_pair do |key, value| -%>
4
4
  <%= key %> <%= value.is_a?(Array) ? parameterize(*value) : value.inspect %>
5
- <% end %>
5
+ <% end %>
6
+
7
+ plugin 'luban'
@@ -2,7 +2,7 @@ module Luban
2
2
  module Deployment
3
3
  module Applications
4
4
  class Rack
5
- VERSION = '0.2.16'
5
+ VERSION = '0.2.17'
6
6
  end
7
7
  end
8
8
  end
@@ -19,6 +19,8 @@ module Luban
19
19
 
20
20
  def current_web_server; web_server[:name]; end
21
21
 
22
+ def publish_web_server; end
23
+
22
24
  protected
23
25
 
24
26
  def init
@@ -0,0 +1,24 @@
1
+ # Backport :define_singleton_method
2
+ unless Kernel.method_defined? :define_singleton_method
3
+ module Kernel
4
+ def define_singleton_method(*args, &block)
5
+ class << self
6
+ self
7
+ end.send(:define_method, *args, &block)
8
+ end
9
+ end
10
+ end
11
+
12
+ Puma::Plugin.create do
13
+ def start(launcher)
14
+ launcher.define_singleton_method(:phased_restart) do
15
+ init_options = { config_files: @options.all_of(:config_files) }
16
+ @options.instance_variable_set(:@cur, init_options)
17
+ @options.instance_variable_set(:@set, [init_options])
18
+ @config.load
19
+ @restart_dir = dir if dir = @options[:directory]
20
+ set_process_title
21
+ super()
22
+ end
23
+ end
24
+ end
@@ -11,8 +11,7 @@ module Luban
11
11
  address: "127.0.0.1",
12
12
  port: port + 1,
13
13
  socket: socket_file_path.to_s,
14
- #directory: release_path.to_s,
15
- directory: current_app_path.to_s,
14
+ directory: release_path.to_s,
16
15
  environment: stage,
17
16
  # Daemon options
18
17
  daemonize: true,
@@ -30,7 +29,7 @@ module Luban
30
29
  prune_bundler: true,
31
30
  # Control app options
32
31
  control_socket: control_socket_file_path.to_s,
33
- control_opts: { authen_tocken: port.to_s }
32
+ control_opts: { auth_token: port.to_s }
34
33
  }
35
34
  end
36
35
 
@@ -150,6 +149,24 @@ module Luban
150
149
  def phased_restart_command
151
150
  @phased_restart_command ||= bundle_command("#{puma_command} phased-restart")
152
151
  end
152
+
153
+ def publish_web_server
154
+ install_puma_plugins if publish_app?
155
+ end
156
+
157
+ protected
158
+
159
+ def install_puma_plugins
160
+ src_plugin_path = Pathname.new(__FILE__).dirname.join('puma', 'plugin')
161
+ dst_plugin_path = within(release_path) do
162
+ Pathname.new(capture(bundle_executable, :show, 'puma'))
163
+ end.join('lib', 'puma', 'plugin')
164
+ Pathname.glob(src_plugin_path.join('*.rb')).each do |src_plugin|
165
+ dst_plugin = dst_plugin_path.join(src_plugin.basename)
166
+ upload_by_template(file_to_upload: dst_plugin, template_file: src_plugin,
167
+ auto_revision: true)
168
+ end
169
+ end
153
170
  end
154
171
  end
155
172
  end
data/luban-rack.gemspec CHANGED
@@ -15,8 +15,6 @@ Gem::Specification.new do |spec|
15
15
  spec.license = "MIT"
16
16
 
17
17
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
- spec.bindir = "exe"
19
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
18
  spec.require_paths = ["lib"]
21
19
 
22
20
  spec.required_ruby_version = ">= 2.1.0"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: luban-rack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.16
4
+ version: 0.2.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rubyist Chi
8
8
  autorequire:
9
- bindir: exe
9
+ bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-09 00:00:00.000000000 Z
11
+ date: 2016-11-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: luban
@@ -100,6 +100,7 @@ files:
100
100
  - lib/luban/deployment/applications/rack/version.rb
101
101
  - lib/luban/deployment/applications/rack/web_server.rb
102
102
  - lib/luban/deployment/applications/rack/web_servers/puma.rb
103
+ - lib/luban/deployment/applications/rack/web_servers/puma/plugin/luban.rb
103
104
  - lib/luban/deployment/applications/rack/web_servers/thin.rb
104
105
  - lib/luban/rack.rb
105
106
  - luban-rack.gemspec