webcracy / prologuer-bot

Twitter-like ruby XMPP bot for Prologue, the Wordpress theme that creates a Twitter for teams.

This URL has Read+Write access

prologuer-bot / prologuer.rb
100644 30 lines (25 sloc) 0.823 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#To start (run in the background): ruby prologuer.rb start
#To restart: ruby prologuer.rb restart
#To stop: ruby prologuer.rb stop
#To run in the foreground: ruby prologuer.rb run
 
require 'rubygems'
require 'daemons'
 
def whatstheenv?(envi)
  if envi != nil
    return envi
  elsif envi == nil
    return 'config'
  end
end
 
ENV_SET = whatstheenv?(ARGV[1])
 
if ARGV[0].to_s == 'start' or ARGV[0].to_s == 'run'
  puts "___ Bot running in #{ENV_SET} environnement..."
  puts "___ You can edit prologuer.rb to use other configs"
  puts "___ Type 'ruby prologuer.rb stop' to disconnect the bot"
elsif ARGV[0].to_s == 'restart'
  puts "___ Bot restarted in #{ENV_SET} environnement..."
  puts "___ Type 'ruby prologuer.rb stop' to disconnect the bot"
else
  puts "___ Bot disconnected."
end
 
Daemons.run('lib/prologuer_lib.rb')