Permalink
Browse files

Removing Puggernaut.env

  • Loading branch information...
1 parent ea08f54 commit b13098f99fcb342529f733c8c775bbc329900b51 @winton committed Jan 17, 2011
Showing with 7 additions and 17 deletions.
  1. +1 −6 bin/puggernaut
  2. +2 −4 lib/puggernaut.rb
  3. +1 −2 lib/puggernaut/client.rb
  4. +1 −3 lib/puggernaut/server.rb
  5. +2 −2 lib/puggernaut/server/http.rb
View
@@ -2,9 +2,4 @@
require File.expand_path(File.dirname(__FILE__) + "/../lib/puggernaut")
-env = ARGV.index('-e')
-port = ARGV.index('-p')
-env = ARGV[env + 1] if env
-port = ARGV[port + 1].to_i if port
-
-Puggernaut::Server.new(*[ env || 'development', port ].compact)
+Puggernaut::Server.new(*[ ARGV[0] ? ARGV[0].to_i : nil ].compact)
View
@@ -14,13 +14,11 @@
module Puggernaut
class <<self
- attr_accessor :env
-
def logger
unless @logger
- base = File.expand_path('../../', __FILE__)
+ base = Dir.pwd
FileUtils.mkdir_p("#{base}/log")
- file = File.open("#{base}/log/#{env}.log", 'a')
+ file = File.open("#{base}/log/puggernaut.log", 'a')
file.sync = true
@logger = Logger.new(file)
end
View
@@ -6,8 +6,7 @@ class Client
attr_accessor :connections
- def initialize(env='development', servers={})
- Puggernaut.env = env
+ def initialize(servers={})
@connections = {}
@retry = []
@servers = servers
View
@@ -9,9 +9,7 @@ class <<self
attr_accessor :rooms
end
- def initialize(env='development', port=8000)
- Puggernaut.env = env
-
+ def initialize(port=8000)
loop do
begin
GC.start
@@ -39,7 +39,7 @@ def receive_data(data)
else
EM::Timer.new(30) { respond }
@subscription_ids = @rooms.collect do |room|
- logger.info "Server::Http#receive_data - Subscribed - #{room}"
+ logger.info "Server::Http#receive_data - Subscribed - #{room.room}"
room.subscribe { |str| respond str }
end
end
@@ -70,7 +70,7 @@ def unbind
@subscription_ids.each do |id|
room = @rooms.shift
room.unsubscribe(id)
- logger.info "Sever::Http#unbind - #{room} - #{id}"
+ logger.info "Sever::Http#unbind - #{room.room} - #{id}"
end
end
end

0 comments on commit b13098f

Please sign in to comment.