Skip to content

Commit

Permalink
Fix up the skynet script that installs with skynet_install. Make sure…
Browse files Browse the repository at this point in the history
… it puts the log and pid file in the right place.
  • Loading branch information
phlapjack committed Apr 11, 2008
1 parent 0641472 commit d759a33
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
13 changes: 6 additions & 7 deletions app_generators/skynet_install/templates/skynet
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,21 @@

<% if in_rails -%>
# Load your rails app
require File.dirname(__FILE__) + '/../config/boot'
require File.expand_path(File.dirname(__FILE__) + '/../config/boot')
require File.expand_path(File.dirname(__FILE__)) + '/../config/environment'
<% end -%>

require 'rubygems'
require 'skynet'

Skynet::CONFIG[:LAUNCHER_PATH] = File.expand_path(__FILE__)
Skynet::CONFIG[:SKYNET_LOG_FILE] ||= STDERR
Skynet::CONFIG[:SKYNET_LOG_LEVEL] ||= Logger::ERROR
Skynet::CONFIG[:SKYNET_LOG_LEVEL] = Logger::ERROR
<% if in_rails -%>
Skynet::CONFIG[:SKYNET_PIDS_FILE] ||= File.expand_path("#{RAILS_ROOT}/log/skynet_#{RAILS_ENV}.pid")
Skynet::CONFIG[:SKYNET_LOG_FILE] ||= File.expand_path("#{RAILS_ROOT}/log/skynet_#{RAILS_ENV}.log")
Skynet::CONFIG[:SKYNET_PIDS_FILE] = File.expand_path("#{RAILS_ROOT}/log/skynet_#{RAILS_ENV}.pid")
Skynet::CONFIG[:SKYNET_LOG_FILE] = File.expand_path("#{RAILS_ROOT}/log/skynet_#{RAILS_ENV}.log")
<% else -%>
Skynet::CONFIG[:SKYNET_PIDS_FILE] ||= File.expand_path("../log/skynet.pid")
Skynet::CONFIG[:SKYNET_LOG_FILE] ||= File.expand_path("../log/skynet.log")
Skynet::CONFIG[:SKYNET_PIDS_FILE] = File.expand_path(File.dirname(__FILE__) + "/../log/skynet.pid")
Skynet::CONFIG[:SKYNET_LOG_FILE] = File.expand_path(File.dirname(__FILE__) + "/../log/skynet.log")
<% end -%>
<% if mysql -%>
Expand Down
4 changes: 4 additions & 0 deletions lib/skynet/skynet_console_helper.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
module Skynet::ConsoleHelper
# All of these commands can be run at the 'skynet console'.

def log
Skynet::Logger.get
end

def mq
@mq ||= Skynet::MessageQueue.new
end
Expand Down
6 changes: 6 additions & 0 deletions lib/skynet/skynet_logger.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,13 @@ def self.get
def self.log=(log)
@@log = log
end

def printlog(*args)
self.class.get.unknown(*args)
end

end


# This module can be mixed in to add logging methods to your class.
module Loggable
Expand Down

0 comments on commit d759a33

Please sign in to comment.