slackbot_frd 0.0.2 → 0.0.3

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 (3) hide show
  1. checksums.yaml +4 -4
  2. data/bin/slackbot-frd +13 -3
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 13a08ffadb9cd54f73c63639c08a1ea18ec13433
4
- data.tar.gz: cc02227f5e2563e12055fa7acbdab07d36b68921
3
+ metadata.gz: 04cee0faa28be4076894f5b61e49fb303430c138
4
+ data.tar.gz: 1e72aadc3cab4e5e7a7760a5445a13e28e661028
5
5
  SHA512:
6
- metadata.gz: f7c931ec908432fd850989608a8009842daa1dec90bcd4bc82bb240efa84fe32c9904a99e2bd2825b46e0e391e533e25577a3cef15d99a3bbd64695dbfc250fa
7
- data.tar.gz: 646772e155bff7d015d64df6a78524a46dda856ccf05fd68b3031afdbc2c1f44d5efa74b5ced7a61ea4715e92b14da38a85ac5cace09346aecc9c814ccee7e84
6
+ metadata.gz: ad3b57ef770214cc5696afcb3bd1d12a232cad10b38068760dc4a88513fc53c990a0a2d61e0e7039ef1e5b1dabe8cc09b27bd86ea1615a5a2aa4a0e2a7016da6
7
+ data.tar.gz: 38438e35bba579a89a20ac5c123582981c9ad7eef0f5460756c50b10fbbed03f3c3ebb46c321887ca193f373fa2ec22f7880bed817889d1b613ce7e6af0b58d1
data/bin/slackbot-frd CHANGED
@@ -32,6 +32,15 @@ class SlackbotFrdBin < Thor
32
32
  # TODO
33
33
  end
34
34
 
35
+ desc "status", "Report status on daemon procs"
36
+ def status
37
+ if running?(watcher_pid)
38
+ puts "Daemon running as pid '#{watcher_pid}'".green
39
+ else
40
+ puts "Daemon not running".red
41
+ end
42
+ end
43
+
35
44
  desc "genconfig", "Generate a skeleton config file"
36
45
  long_desc <<-LONGDESC
37
46
  genconfig will generate a skeleton config file that
@@ -99,7 +108,7 @@ class SlackbotFrdBin < Thor
99
108
  end
100
109
 
101
110
  if daemonize
102
- set_watcher_pid(Process.fork{ watch_connection(bots, token, botdir, true) })
111
+ Process.fork{ watch_connection(bots, token, botdir, true) }
103
112
  else
104
113
  watch_connection(bots, token, botdir)
105
114
  end
@@ -169,6 +178,7 @@ class SlackbotFrdBin < Thor
169
178
  private
170
179
  def watch_connection(bots, token, botdir, daemonize = false)
171
180
  Process.daemon if daemonize
181
+ set_watcher_pid(Process.pid)
172
182
  until errors
173
183
  pid = Process.fork { BotStarter.start_bots(ERROR_FILE, token, botdir, bots) }
174
184
  set_connection_pid(pid)
@@ -205,13 +215,13 @@ class SlackbotFrdBin < Thor
205
215
 
206
216
  private
207
217
  def watcher_pid
208
- File.read(PID_FILE_WATCHER).to_i if File.exists?(PID_FILE_WATCHER)
218
+ return File.read(PID_FILE_WATCHER).to_i if File.exists?(PID_FILE_WATCHER)
209
219
  nil
210
220
  end
211
221
 
212
222
  private
213
223
  def connection_pid
214
- File.read(PID_FILE_CONNECTION).to_i if File.exists?(PID_FILE_CONNECTION)
224
+ return File.read(PID_FILE_CONNECTION).to_i if File.exists?(PID_FILE_CONNECTION)
215
225
  nil
216
226
  end
217
227
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slackbot_frd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Porter