-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcomputerbot.rb
49 lines (43 loc) · 1.82 KB
/
computerbot.rb
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
##########################################################################
#
# Welcome to Computerbot's source, Twitterbot version.
# Copyright 2008 Alexandre Loureiro Solleiro <[email protected]>, http://webcracy.org
# All rights reserved.
# You are free to use, modify and distribute binary and source copies of this application.
# Be nice if you do. It's my right to demand it.
# This notice must never be separated from the code and you must give me credit for binary or source use.
# Read and respect the licenses of third-party software distributed with this package.
# Author: Alexandre Loureiro Solleiro <[email protected]>
# Contact: [email protected]
# Website: http://computer.webcracy.org/
# Documentation: http://computer.webcracy.org/doc/
# Tutorials: http://computer.webcracy.org/tutorials/
# Have fun.
# --------
# To start (runs in the background): ruby computerbot.rb start <env>
# To restart: ruby computerbot.rb restart <env>
# To stop: ruby computerbot.rb stop
# To run in the foreground (debug mode): ruby computerbot.rb run <env>
#
########################################################################
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 computerbot.rb to use other configs"
puts "___ Type 'ruby computerbot.rb stop' to disconnect the bot"
elsif ARGV[0].to_s == 'restart'
puts "___ Bot restarted in #{ENV_SET} environnement..."
puts "___ Type 'ruby computerbot.rb stop' to disconnect the bot"
else
puts "___ Bot disconnected."
end
Daemons.run('lib/computerbot_lib.rb')