multi_daemons 0.1.0 → 0.1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e9f3fa45368cb760d0004b51bcda3081d1856597b8c14d717acf84031ec618c7
4
- data.tar.gz: c01dc7b03c4980d62533a2c74e12b9f41995083d79b9a5c77622802c37cbdda5
3
+ metadata.gz: 884d762758262b136594eb0bde0ef2d41ba62b735c95ec1754d073f5a102b27f
4
+ data.tar.gz: 1f4bf17914dfcb8867242d701944b3e590148828c64ffbc880dc8bbd6f8f6b5c
5
5
  SHA512:
6
- metadata.gz: 7f8b14e13ab996ab4e0b74d13cf833926a0818be37484b9e3330fc83fe5b723190a3d417e1de3dcd231a4fbeb48d330cf54bf76345ac13bb230800039c0788d2
7
- data.tar.gz: dfc6fc3bfce2bd7b6e19641a6d8215f6b664e227aefdc643dbe39a6688f1d73ffcff09f581cddec1fb4627ae30f02cfafcd21f403304fd7d5e006d64bc86120d
6
+ metadata.gz: 007899a5dc724ebdc4c06b7a478053025533a1cb394df0cd270e69530c59d9ab6d3a891610bc3ff958f3acf33d6b180b5ed9c21b5c76eff500db662ec48a8313
7
+ data.tar.gz: 21368526243c75f07350c87a83d12e97f8e3e767f926e9aa58cfcd7de90f4abc0ca1e0eec7842711f252686fcc23f56214bf2c2c985768daeeaa9fd3d9090cdd
data/CONTRIBUTING.md ADDED
@@ -0,0 +1 @@
1
+ Bug reports and pull requests are welcome on GitHub at https://github.com/santhanakarthikeyan/multi_daemons. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- multi_daemons (0.1.0)
4
+ multi_daemons (0.1.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -30,8 +30,8 @@ proc_code = Proc do
30
30
  end
31
31
  end
32
32
 
33
- scheduler = MultiDaemons::Daemon.new('scripts/scheduler', name: 'scheduler', type: :script, {})
34
- looper = MultiDaemons::Daemon.new(proc_code, name: 'looper', type: :proc, {})
33
+ scheduler = MultiDaemons::Daemon.new('scripts/scheduler', name: 'scheduler', type: :script, options: {})
34
+ looper = MultiDaemons::Daemon.new(proc_code, name: 'looper', type: :proc, options: {})
35
35
  MultiDaemons.runner([scheduler, looper], { force_kill_timeout: 60 })
36
36
  ```
37
37
 
@@ -49,7 +49,7 @@ proc_code = Proc do
49
49
  sleep 5
50
50
  end
51
51
  end
52
- looper = MultiDaemons::Daemon.new(proc_code, name: 'looper', type: :proc, {})
52
+ looper = MultiDaemons::Daemon.new(proc_code, name: 'looper', type: :proc, options: {})
53
53
  looper.start # start daemon
54
54
  # Do some other activity
55
55
  looper.stop # stop daemon
@@ -62,7 +62,7 @@ proc_code = Proc do
62
62
  sleep 5
63
63
  end
64
64
  end
65
- looper = MultiDaemons::Daemon.new(proc_code, name: 'looper', type: :proc, {})
65
+ looper = MultiDaemons::Daemon.new(proc_code, name: 'looper', type: :proc, options: {})
66
66
  MultiDaemons.runner([looper], { force_kill_timeout: 60 })
67
67
  ```
68
68
 
@@ -80,7 +80,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
80
80
 
81
81
  ## Contributing
82
82
 
83
- Bug reports and pull requests are welcome on GitHub at https://github.com/santhanakarthikeyan/multi_daemons. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
83
+ Bug reports and pull requests are welcome. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
84
84
 
85
85
  ## License
86
86
 
data/lib/multi_daemons.rb CHANGED
@@ -25,6 +25,8 @@ module MultiDaemons
25
25
  when 'restart'
26
26
  controller.stop
27
27
  controller.start
28
+ when 'status'
29
+ controller.status
28
30
  else
29
31
  raise 'Invalid argument. Specify start, stop or restart'
30
32
  end
@@ -25,8 +25,32 @@ module MultiDaemons
25
25
  PidStore.cleanup(pid_files)
26
26
  end
27
27
 
28
+ def status
29
+ daemon_attrs = []
30
+ daemons.each do |daemon|
31
+ daemon_attrs << { name: daemon.name, pids: daemon.pids }
32
+ end
33
+ daemon_attrs.each do |hsh|
34
+ hsh[:pids].each do |pid|
35
+ puts "#{hsh[:name]}(#{pid}): #{print_status(Pid.running?(pid))}"
36
+ end
37
+ end
38
+ end
39
+
28
40
  private
29
41
 
42
+ def print_status(status)
43
+ status ? green('Running') : red('Died')
44
+ end
45
+
46
+ def green(msg)
47
+ "\e[32m#{msg}\e[0m"
48
+ end
49
+
50
+ def red(msg)
51
+ "\e[31m#{msg}\e[0m"
52
+ end
53
+
30
54
  def force_kill_timeout
31
55
  options[:force_kill_timeout] || 30
32
56
  end
@@ -1,3 +1,3 @@
1
1
  module MultiDaemons
2
- VERSION = '0.1.0'.freeze
2
+ VERSION = '0.1.1'.freeze
3
3
  end
Binary file
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: multi_daemons
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - santhanakarthikeyan
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-11-14 00:00:00.000000000 Z
11
+ date: 2018-11-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -89,6 +89,7 @@ extensions: []
89
89
  extra_rdoc_files: []
90
90
  files:
91
91
  - CODE_OF_CONDUCT.md
92
+ - CONTRIBUTING.md
92
93
  - Gemfile
93
94
  - Gemfile.lock
94
95
  - LICENSE
@@ -104,6 +105,7 @@ files:
104
105
  - lib/multi_daemons/pid_store.rb
105
106
  - lib/multi_daemons/validate.rb
106
107
  - lib/multi_daemons/version.rb
108
+ - multi_daemons-0.1.0.gem
107
109
  - multi_daemons.gemspec
108
110
  homepage: https://github.com/santhanakarthikeyan/multi_daemons
109
111
  licenses: