tkellem 0.8.2 → 0.8.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -16,7 +16,7 @@ module Tkellem
16
16
  @trace = val
17
17
  end
18
18
  def self.trace
19
- @trace || @trace = true
19
+ @trace || @trace = false
20
20
  end
21
21
 
22
22
  def log_name
@@ -21,7 +21,7 @@ class Bouncer
21
21
  # maps { client_conn => state_hash }
22
22
  @active_conns = {}
23
23
  @welcomes = []
24
- @rooms = ['#tk']
24
+ @rooms = []
25
25
  # maps { client_conn => away_status_or_nil }
26
26
  @away = {}
27
27
  # plugin data
@@ -46,10 +46,6 @@ class Tkellem::Daemon
46
46
  exit(status ? 0 : 1)
47
47
  when 'restart'
48
48
  stop if status(false)
49
- while status(false)
50
- print "."
51
- sleep(0.5)
52
- end
53
49
  daemonize
54
50
  start
55
51
  when 'admin'
@@ -104,18 +100,25 @@ class Tkellem::Daemon
104
100
  @daemon = true
105
101
  File.open(pid_file, 'wb') { |f| f.write(Process.pid.to_s) }
106
102
 
107
- # TODO: set up logging
103
+ # TODO: support syslog
104
+ require 'logger'
105
+ logger = Logger.new(log_file)
108
106
  STDIN.reopen("/dev/null")
109
- STDOUT.reopen("/dev/null")
107
+ STDOUT.reopen(log_file, 'a')
110
108
  STDERR.reopen(STDOUT)
111
- # STDOUT.sync = STDERR.sync = true
109
+ STDOUT.sync = STDERR.sync = true
112
110
  end
113
111
 
114
112
  def stop
115
113
  pid = File.read(pid_file) if File.file?(pid_file)
116
114
  if pid.to_i > 0
117
- puts "Stopping tkellem #{pid}..."
115
+ puts "Stopping tkellem #{pid}"
118
116
  Process.kill('INT', pid.to_i)
117
+ while status(false)
118
+ print "."
119
+ sleep(0.5)
120
+ end
121
+ puts
119
122
  else
120
123
  status
121
124
  end
@@ -152,4 +155,8 @@ class Tkellem::Daemon
152
155
  File.join(path, 'tkellem.socket')
153
156
  end
154
157
 
158
+ def log_file
159
+ File.join(path, 'tkellem.log')
160
+ end
161
+
155
162
  end
@@ -1,3 +1,3 @@
1
1
  module Tkellem
2
- VERSION = "0.8.2"
2
+ VERSION = "0.8.3"
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: tkellem
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.8.2
5
+ version: 0.8.3
6
6
  platform: ruby
7
7
  authors:
8
8
  - Brian Palmer
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-06-13 00:00:00 -06:00
13
+ date: 2011-06-14 00:00:00 -06:00
14
14
  default_executable: tkellem
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency