puma 3.1.1-java → 3.2.0-java

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of puma might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 013549c1c74b323e15771e89b2c1c0c27cdf53ad
4
- data.tar.gz: 40fa22c3cfe076d1d8477029c292de4834a0f8a5
3
+ metadata.gz: 32fc56019517c78ed4aabd97f6759bc310fcf6c2
4
+ data.tar.gz: 262c36c31b4d6354b2a9e6d0e9a25b04a9a098b9
5
5
  SHA512:
6
- metadata.gz: c11697e44440b4f4572d4298d23f66e9cebd2f396e971b3ec6d1706988f63914b015876451783cf11fef7051d0e1003fc8d276ba28a8e61674491389df0b5699
7
- data.tar.gz: 4e9a1422eeb368be02f8a43cbe9969e0a9f44213de3eb1fa41d913c0c6d536c75deecd8f6df046510e4b265476127c8ea5a0818c789365b888bc1d1520bd7692
6
+ metadata.gz: fd24a0e6dcfa0db75fcf26057484e2588b3ba2d192353aa9d5b43439f65957a7b00af7adcfa5c305ae13d5678189d048e50036aca6c2f06d05e5eadc63243fac
7
+ data.tar.gz: e671d9b1fac537db72df428f717d4a1b9315cc4db64d7e422aadfece6248063acf41a465db929f650d1430ec6670a577c17e2720cf23dacdb2cc25e8fcc1d487
@@ -1,3 +1,17 @@
1
+ === 3.2.0 / 2016-03-20
2
+
3
+ * 1 deprecation removal:
4
+ * Delete capistrano.rb
5
+
6
+ * 3 bug fixes:
7
+ * Detect gems.rb as well as Gemfile
8
+ * Simplify and fix logic for directory to use when restarting for all phases
9
+ * Speed up phased-restart start
10
+
11
+ * 2 PRs merged:
12
+ * Merge pull request #927 from jlecour/gemfile_variants
13
+ * Merge pull request #931 from joneslee85/patch-10
14
+
1
15
  === 3.1.1 / 2016-03-17
2
16
 
3
17
  * 4 bug fixes:
@@ -29,7 +29,6 @@ lib/puma.rb
29
29
  lib/puma/accept_nonblock.rb
30
30
  lib/puma/app/status.rb
31
31
  lib/puma/binder.rb
32
- lib/puma/capistrano.rb
33
32
  lib/puma/cli.rb
34
33
  lib/puma/client.rb
35
34
  lib/puma/cluster.rb
@@ -31,10 +31,9 @@ module Puma
31
31
 
32
32
  # Be sure to change the directory again before loading
33
33
  # the app. This way we can pick up new code.
34
- if dir = @options[:worker_directory]
35
- log "+ Changing to #{dir}"
36
- Dir.chdir dir
37
- end
34
+ dir = @launcher.restart_dir
35
+ log "+ Changing to #{dir}"
36
+ Dir.chdir dir
38
37
  end
39
38
 
40
39
  def redirect_io
@@ -219,8 +218,12 @@ module Puma
219
218
 
220
219
  # If we're not running under a Bundler context, then
221
220
  # report the info about the context we will be using
222
- if !ENV['BUNDLE_GEMFILE'] and File.exist?("Gemfile")
223
- log "+ Gemfile in context: #{File.expand_path("Gemfile")}"
221
+ if !ENV['BUNDLE_GEMFILE']
222
+ if File.exist?("Gemfile")
223
+ log "+ Gemfile in context: #{File.expand_path("Gemfile")}"
224
+ elsif File.exist?("gems.rb")
225
+ log "+ Gemfile in context: #{File.expand_path("gems.rb")}"
226
+ end
224
227
  end
225
228
 
226
229
  # Invoke any worker boot hooks so they can get
@@ -298,10 +301,9 @@ module Puma
298
301
  end
299
302
 
300
303
  def reload_worker_directory
301
- if dir = @options[:worker_directory]
302
- log "+ Changing to #{dir}"
303
- Dir.chdir dir
304
- end
304
+ dir = @launcher.restart_dir
305
+ log "+ Changing to #{dir}"
306
+ Dir.chdir dir
305
307
  end
306
308
 
307
309
  def stats
@@ -422,12 +424,21 @@ module Puma
422
424
  @launcher.events.fire_on_booted!
423
425
 
424
426
  begin
427
+ force_check = false
428
+
425
429
  while @status == :run
426
430
  begin
427
- res = IO.select([read], nil, nil, 5)
431
+ if @phased_restart
432
+ start_phased_restart
433
+ @phased_restart = false
434
+ end
435
+
436
+ check_workers force_check
428
437
 
429
438
  force_check = false
430
439
 
440
+ res = IO.select([read], nil, nil, 5)
441
+
431
442
  if res
432
443
  req = read.read_nonblock(1)
433
444
 
@@ -453,13 +464,6 @@ module Puma
453
464
  end
454
465
  end
455
466
 
456
- if @phased_restart
457
- start_phased_restart
458
- @phased_restart = false
459
- end
460
-
461
- check_workers force_check
462
-
463
467
  rescue Interrupt
464
468
  @status = :stop
465
469
  end
@@ -100,8 +100,8 @@ module Puma
100
100
  # too taxing on performance.
101
101
  module Const
102
102
 
103
- PUMA_VERSION = VERSION = "3.1.1".freeze
104
- CODE_NAME = "El Niño Winter Wonderland".freeze
103
+ PUMA_VERSION = VERSION = "3.2.0".freeze
104
+ CODE_NAME = "Spring Is A Heliocentric Viewpoint".freeze
105
105
  PUMA_SERVER_STRING = ['puma', PUMA_VERSION, CODE_NAME].join(' ').freeze
106
106
 
107
107
  FAST_TRACK_KA_TIMEOUT = 0.2
@@ -312,13 +312,12 @@ module Puma
312
312
  # The directory to operate out of.
313
313
  def directory(dir)
314
314
  @options[:directory] = dir.to_s
315
-
316
- worker_directory dir
317
315
  end
318
316
 
319
- # Set the directory for workers to start in
317
+ # DEPRECATED: The directory to operate out of.
320
318
  def worker_directory(dir)
321
- @options[:worker_directory] = dir.to_s
319
+ $stderr.puts "worker_directory is deprecated. Please use `directory`"
320
+ directory dir
322
321
  end
323
322
 
324
323
  # Run the app as a raw TCP app instead of an HTTP rack app
@@ -54,8 +54,6 @@ module Puma
54
54
  @binder = Binder.new(@events)
55
55
  @binder.import_from_env
56
56
 
57
- generate_restart_data
58
-
59
57
  @environment = conf.environment
60
58
 
61
59
  # Advertise the Configuration
@@ -65,6 +63,8 @@ module Puma
65
63
 
66
64
  @options = @config.options
67
65
 
66
+ generate_restart_data
67
+
68
68
  if clustered? && (Puma.jruby? || Puma.windows?)
69
69
  unsupported 'worker mode not supported on JRuby or Windows'
70
70
  end
@@ -73,8 +73,7 @@ module Puma
73
73
  unsupported 'daemon mode not supported on Windows'
74
74
  end
75
75
 
76
- dir = @options[:directory]
77
- Dir.chdir(dir) if dir
76
+ Dir.chdir(@restart_dir)
78
77
 
79
78
  prune_bundler if prune_bundler?
80
79
 
@@ -93,7 +92,7 @@ module Puma
93
92
  @status = :run
94
93
  end
95
94
 
96
- attr_reader :binder, :events, :config, :options
95
+ attr_reader :binder, :events, :config, :options, :restart_dir
97
96
 
98
97
  # Return stats about the server
99
98
  def stats
@@ -314,16 +313,18 @@ module Puma
314
313
 
315
314
 
316
315
  def generate_restart_data
317
- # Use the same trick as unicorn, namely favor PWD because
318
- # it will contain an unresolved symlink, useful for when
319
- # the pwd is /data/releases/current.
320
- if dir = ENV['PWD']
316
+ if dir = @options[:directory]
317
+ @restart_dir = dir
318
+
319
+ # Use the same trick as unicorn, namely favor PWD because
320
+ # it will contain an unresolved symlink, useful for when
321
+ # the pwd is /data/releases/current.
322
+ elsif dir = ENV['PWD']
321
323
  s_env = File.stat(dir)
322
324
  s_pwd = File.stat(Dir.pwd)
323
325
 
324
326
  if s_env.ino == s_pwd.ino and (Puma.jruby? or s_env.dev == s_pwd.dev)
325
327
  @restart_dir = dir
326
- @config.configure { |c| c.worker_directory dir }
327
328
  end
328
329
  end
329
330
 
Binary file
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puma
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.1
4
+ version: 3.2.0
5
5
  platform: java
6
6
  authors:
7
7
  - Evan Phoenix
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-18 00:00:00.000000000 Z
11
+ date: 2016-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -122,7 +122,6 @@ files:
122
122
  - lib/puma/accept_nonblock.rb
123
123
  - lib/puma/app/status.rb
124
124
  - lib/puma/binder.rb
125
- - lib/puma/capistrano.rb
126
125
  - lib/puma/cli.rb
127
126
  - lib/puma/client.rb
128
127
  - lib/puma/cluster.rb
@@ -1,94 +0,0 @@
1
- $stderr.puts "DEPRECATED: To manage puma with capistrano, use https://github.com/seuros/capistrano-puma"
2
-
3
- Capistrano::Configuration.instance.load do
4
-
5
- # Ensure the tmp/sockets directory is created by the deploy:setup task and
6
- # symlinked in by the deploy:update task. This is not handled by Capistrano
7
- # v2 but is fixed in v3.
8
- shared_children.push('tmp/sockets')
9
-
10
- _cset(:puma_default_hooks) { true }
11
- _cset(:puma_cmd) { "#{fetch(:bundle_cmd, 'bundle')} exec puma" }
12
- _cset(:pumactl_cmd) { "#{fetch(:bundle_cmd, 'bundle')} exec pumactl" }
13
- _cset(:puma_env) { fetch(:rack_env, fetch(:rails_env, 'production')) }
14
- _cset(:puma_state) { "#{shared_path}/sockets/puma.state" }
15
- _cset(:puma_socket) { "unix://#{shared_path}/sockets/puma.sock" }
16
- _cset(:puma_role) { :app }
17
-
18
- if fetch(:puma_default_hooks)
19
- after 'deploy:stop', 'puma:stop'
20
- after 'deploy:start', 'puma:start'
21
- after 'deploy:restart', 'puma:restart'
22
- end
23
-
24
- namespace :puma do
25
- desc 'Start puma'
26
- task :start, :roles => lambda { puma_role }, :on_no_matching_servers => :continue do
27
- run "cd #{current_path} && #{puma_rails_additional_env} #{puma_cmd} #{start_options}", :pty => false
28
- end
29
-
30
- desc 'Stop puma'
31
- task :stop, :roles => lambda { puma_role }, :on_no_matching_servers => :continue do
32
- run "cd #{current_path} && #{pumactl_cmd} -S #{state_path} stop"
33
- end
34
-
35
- desc 'Restart puma'
36
- task :restart, :roles => lambda { puma_role }, :on_no_matching_servers => :continue do
37
- begin
38
- run "cd #{current_path} && #{puma_rails_additional_env} #{pumactl_cmd} -S #{state_path} restart"
39
- rescue Capistrano::CommandError => ex
40
- puts "Failed to restart puma: #{ex}\nAssuming not started."
41
- start
42
- end
43
- end
44
-
45
- desc 'Restart puma (phased restart)'
46
- task :phased_restart, :roles => lambda { puma_role }, :on_no_matching_servers => :continue do
47
- begin
48
- run "cd #{current_path} && #{puma_rails_additional_env} #{pumactl_cmd} -S #{state_path} phased-restart"
49
- rescue Capistrano::CommandError => ex
50
- puts "Failed to restart puma: #{ex}\nAssuming not started."
51
- start
52
- end
53
- end
54
-
55
- end
56
-
57
- def start_options
58
- if config_file
59
- "-q -d -e #{puma_env} -C #{config_file}"
60
- else
61
- "-q -d -e #{puma_env} -b '#{puma_socket}' -S #{state_path} --control 'unix://#{shared_path}/sockets/pumactl.sock'"
62
- end
63
- end
64
-
65
- def config_file
66
- @_config_file ||= begin
67
- file = fetch(:puma_config_file, nil)
68
- file = "./config/puma/#{puma_env}.rb" if !file && File.exists?("./config/puma/#{puma_env}.rb")
69
- file
70
- end
71
- end
72
-
73
- def puma_env
74
- fetch(:rack_env, fetch(:rails_env, 'production'))
75
- end
76
-
77
- #add additional env when start rails, such as : secret key, db username, db pwd or other what you want.
78
- def puma_rails_additional_env
79
- fetch(:puma_rails_additional_env, '')
80
- end
81
-
82
- def state_path
83
- (config_file ? configuration.options[:state] : nil) || puma_state
84
- end
85
-
86
- def configuration
87
- require 'puma'
88
- require 'puma/configuration'
89
-
90
- config = Puma::Configuration.new(:config_file => config_file)
91
- config.load
92
- config
93
- end
94
- end