Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Removing Puggernaut.env

  • Loading branch information...
commit b13098f99fcb342529f733c8c775bbc329900b51 1 parent ea08f54
Winton Welsh authored
7 bin/puggernaut
@@ -2,9 +2,4 @@
2 2
3 3 require File.expand_path(File.dirname(__FILE__) + "/../lib/puggernaut")
4 4
5   -env = ARGV.index('-e')
6   -port = ARGV.index('-p')
7   -env = ARGV[env + 1] if env
8   -port = ARGV[port + 1].to_i if port
9   -
10   -Puggernaut::Server.new(*[ env || 'development', port ].compact)
  5 +Puggernaut::Server.new(*[ ARGV[0] ? ARGV[0].to_i : nil ].compact)
6 lib/puggernaut.rb
@@ -14,13 +14,11 @@
14 14 module Puggernaut
15 15 class <<self
16 16
17   - attr_accessor :env
18   -
19 17 def logger
20 18 unless @logger
21   - base = File.expand_path('../../', __FILE__)
  19 + base = Dir.pwd
22 20 FileUtils.mkdir_p("#{base}/log")
23   - file = File.open("#{base}/log/#{env}.log", 'a')
  21 + file = File.open("#{base}/log/puggernaut.log", 'a')
24 22 file.sync = true
25 23 @logger = Logger.new(file)
26 24 end
3  lib/puggernaut/client.rb
@@ -6,8 +6,7 @@ class Client
6 6
7 7 attr_accessor :connections
8 8
9   - def initialize(env='development', servers={})
10   - Puggernaut.env = env
  9 + def initialize(servers={})
11 10 @connections = {}
12 11 @retry = []
13 12 @servers = servers
4 lib/puggernaut/server.rb
@@ -9,9 +9,7 @@ class <<self
9 9 attr_accessor :rooms
10 10 end
11 11
12   - def initialize(env='development', port=8000)
13   - Puggernaut.env = env
14   -
  12 + def initialize(port=8000)
15 13 loop do
16 14 begin
17 15 GC.start
4 lib/puggernaut/server/http.rb
@@ -39,7 +39,7 @@ def receive_data(data)
39 39 else
40 40 EM::Timer.new(30) { respond }
41 41 @subscription_ids = @rooms.collect do |room|
42   - logger.info "Server::Http#receive_data - Subscribed - #{room}"
  42 + logger.info "Server::Http#receive_data - Subscribed - #{room.room}"
43 43 room.subscribe { |str| respond str }
44 44 end
45 45 end
@@ -70,7 +70,7 @@ def unbind
70 70 @subscription_ids.each do |id|
71 71 room = @rooms.shift
72 72 room.unsubscribe(id)
73   - logger.info "Sever::Http#unbind - #{room} - #{id}"
  73 + logger.info "Sever::Http#unbind - #{room.room} - #{id}"
74 74 end
75 75 end
76 76 end

0 comments on commit b13098f

Please sign in to comment.
Something went wrong with that request. Please try again.