sv 0.2.0 → 0.2.1

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/sv/server.rb +16 -0
  3. data/lib/sv/version.rb +1 -1
  4. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 17ce5f7abd7cc5bb17e2f17ddca5941b042e4018
4
- data.tar.gz: c06c15226cd7af2df7889a513ec2e1f0c5570156
3
+ metadata.gz: a91c30e6b02d359c7ce54a75001f0c47126818e0
4
+ data.tar.gz: dbb3c98d6847f33b4dc073c2877d41f81f632b3c
5
5
  SHA512:
6
- metadata.gz: 3e62dd67db1c134a14f1c2ba4bbfd17ba1d01c6cf08a969d6615fdafedda2f7943cf3868ef866011577f20f0cf161310a420dd5207e1ea9c6d6f2af23530c984
7
- data.tar.gz: 19d0aace59f1b5e39549bcc87814e84d8150ea8fc35da0422091cb452be428806e3947106776d947b4c8d2dada9af73a0425bf2806984425a8032594ac11b7d7
6
+ metadata.gz: 475256d6937be2adbda674267a57fee9d6286b8273b48ac1007dd98065cc5f1bde8a907d20ad12d3b65d449f1c5934230e41d224319847ab6cdd38c905515722
7
+ data.tar.gz: 4f38b49b5a02d3c84896fd52a4e3b761f68047d66868cf6e2cfec8fd93a477fc5e7cd8eefd6399ab9cdccbe423a7ec2a053054316f00b0add82f8e922b2f529c
@@ -15,6 +15,10 @@ module Sv
15
15
 
16
16
  def start(auto_start: false, wait: false)
17
17
  init_once
18
+ if instances == 0
19
+ puts "skipping supervisord start: 0 instances"
20
+ return
21
+ end
18
22
  if server_status.running?
19
23
  puts "supervisor already running with pid #{api.pid}"
20
24
  return
@@ -46,6 +50,11 @@ module Sv
46
50
  start auto_start: true, wait: true
47
51
  return
48
52
  end
53
+ if instances == 0
54
+ puts "stopping supervisord: 0 instances"
55
+ stop
56
+ return
57
+ end
49
58
  supervisor_config.generated_path
50
59
  rolling_restart = RollingRestart.new(config.jobs, api)
51
60
  rolling_restart.run
@@ -57,6 +66,9 @@ module Sv
57
66
  end
58
67
 
59
68
  def health_check
69
+ if instances == 0
70
+ return
71
+ end
60
72
  raise Error, "server not running" if not server_status.running?
61
73
  api.health_check
62
74
  end
@@ -115,5 +127,9 @@ module Sv
115
127
  end
116
128
  end
117
129
 
130
+ def instances
131
+ @instances ||= config.jobs.reduce(0) { |memo, j| memo += j.numprocs }
132
+ end
133
+
118
134
  end
119
135
  end
@@ -1,3 +1,3 @@
1
1
  module Sv
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sv
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Neeraj
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-06 00:00:00.000000000 Z
11
+ date: 2015-08-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -93,7 +93,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
93
93
  version: '0'
94
94
  requirements: []
95
95
  rubyforge_project:
96
- rubygems_version: 2.4.5
96
+ rubygems_version: 2.4.5.1
97
97
  signing_key:
98
98
  specification_version: 4
99
99
  summary: A wrapper for supervisord