procodile 1.0.15 → 1.0.16

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: b2df02f31fea5565a5b982cd4d1ae98b53e6256d
4
- data.tar.gz: a758543c9bb33dbe1f5520c0d38ad9c128cb1255
3
+ metadata.gz: 1f9970119b9f9480ad0894234851c37b852fa29b
4
+ data.tar.gz: 22e30024ec12580a2469d89520c28a03465e4e49
5
5
  SHA512:
6
- metadata.gz: f2ef597c33f6475992e64d577b543d50b4b70da16e634afd61a3a74339cdca4b1cdb20f7ba2bf8ca79939a1b5e0d1d132d0f61ccd4b08f4ae41c528377f7dc81
7
- data.tar.gz: f6bdaa3e8caccccb8a6761536f5f8e77ad7911fd4f0b63f5bb0f318228c29ceec671011622816a4573be0c67411585167dbacfe541d2721a41bad75b95f3bd39
6
+ metadata.gz: 70036e03d4e9940d8460540302b91ebd0d94d70dfac2a8d73bf4ad29a4753bc9a4ed2c5e3c35f69bc7bdb4e707c019c86138da406ada41774f66c189a98bd79e
7
+ data.tar.gz: b8740fbfa8d2ceff5b0f053abef7e8958f934f1d7aaf636aeb18e3195685f58246166c82afd7f87178f4c8f31b3c372df5650236972e448b860609cfc15184f3
data/lib/procodile/cli.rb CHANGED
@@ -432,12 +432,10 @@ module Procodile
432
432
 
433
433
  def supervisor_running?
434
434
  if pid = current_pid
435
- ::Process.getpgid(pid) ? true : false
435
+ self.class.pid_active?(pid)
436
436
  else
437
437
  false
438
438
  end
439
- rescue Errno::ESRCH
440
- false
441
439
  end
442
440
 
443
441
  def current_pid
@@ -449,6 +447,12 @@ module Procodile
449
447
  end
450
448
  end
451
449
 
450
+ def self.pid_active?(pid)
451
+ ::Process.getpgid(pid) ? true : false
452
+ rescue Errno::ESRCH
453
+ false
454
+ end
455
+
452
456
  def process_names_from_cli_option
453
457
  if @options[:processes]
454
458
  processes = @options[:processes].split(',')
@@ -475,6 +479,8 @@ module Procodile
475
479
  run_options[:force_single_log] = options[:foreground]
476
480
  run_options[:port_allocations] = options[:port_allocations]
477
481
 
482
+ tidy_pids(config)
483
+
478
484
  if options[:clean]
479
485
  FileUtils.rm_rf(Dir[File.join(config.pid_root, '*')])
480
486
  puts "Emptied PID directory"
@@ -503,5 +509,21 @@ module Procodile
503
509
  end
504
510
  end
505
511
 
512
+ def self.tidy_pids(config)
513
+ FileUtils.rm_f(config.supervisor_pid_path)
514
+ FileUtils.rm_f(config.sock_path)
515
+ pid_files = Dir[File.join(config.pid_root, '*.pid')]
516
+ pid_files.each do |pid_path|
517
+ file_name = pid_path.split('/').last
518
+ pid = File.read(pid_path).to_i
519
+ if self.pid_active?(pid)
520
+ puts "Could not remove #{file_name} because process (#{pid}) was active"
521
+ else
522
+ FileUtils.rm_f(pid_path)
523
+ puts "Removed #{file_name} because process was not active"
524
+ end
525
+ end
526
+ end
527
+
506
528
  end
507
529
  end
@@ -1,3 +1,3 @@
1
1
  module Procodile
2
- VERSION = '1.0.15'
2
+ VERSION = '1.0.16'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: procodile
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.15
4
+ version: 1.0.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Cooke
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-22 00:00:00.000000000 Z
11
+ date: 2017-05-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -70,7 +70,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
70
70
  version: '0'
71
71
  requirements: []
72
72
  rubyforge_project:
73
- rubygems_version: 2.5.2
73
+ rubygems_version: 2.5.1
74
74
  signing_key:
75
75
  specification_version: 4
76
76
  summary: This gem will help you run Ruby processes from a Procfile on Linux servers