Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add monitor executable file

  • Loading branch information...
commit aa45426326c407ddc280aea78b10319427511c86 1 parent 53c462c
@plukevdh authored
View
6 bin/kthxbye-monitor
@@ -12,11 +12,13 @@ require 'kthxbye/web_interface'
require 'kthxbye/config'
Vegas::Runner.new(Kthxbye::WebInterface, 'kthxbye-monitor') do |runner, args, app|
+ Kthxbye::Config.setup
+
args.on('-S SERVER', '--server SERVER', "set the redis server") {|server|
- Kthxbye::Config.setup(:redis_server => server)
+ Kthxbye::Config.options[:redis_server] = server
}
args.on('-P PORT', '--port PORT', "set the redis port") {|port|
- Kthxbye::Config.setup(:redis_port => port)
+ Kthxbye::Config.options[:redis_port] = port
}
end
View
5 lib/kthxbye/config.rb
@@ -20,7 +20,7 @@ module Config
#
# NEEDS TO BE REWORKED FOR RAILS APPS
def self.setup( args=nil )
- @options = DEFAULT.dup
+ @options ||= DEFAULT.dup
@options.merge!( YAML.load('./config/kthxbye.yaml') ) if File.exist?( './config/kthxbye.yaml' )
@options.merge!( args ) if args
end
@@ -28,7 +28,8 @@ def self.setup( args=nil )
# Quick access to the options hash. Works for setting individual options
# during runtime.
def self.options
- @options ||= DEFAULT.dup
+ return @options if @options
+ Config.setup
end
end
View
2  lib/kthxbye/worker.rb
@@ -103,8 +103,6 @@ def startup #:nodoc:
def clean_workers
workers = Kthxbye.workers
known = worker_pids
- puts workers
- puts known
workers.each do |worker|
host,pid,queues = worker.id.split(":")
next unless host == hostname
View
4 test/test_kthxbye.rb
@@ -4,7 +4,7 @@ class TestKthxbye < Test::Unit::TestCase
context "See Kthxbye Configuration" do
should "configure an app with given params" do
- k = Kthxbye::Config.setup(:redis_server => "localhost", :redis_port => 8080, :verbose => true)
+ Kthxbye::Config.setup(:redis_server => "localhost", :redis_port => 8080, :verbose => true)
assert_equal 'localhost', Kthxbye::Config.options[:redis_server]
assert_equal 8080, Kthxbye::Config.options[:redis_port]
@@ -23,7 +23,7 @@ class TestKthxbye < Test::Unit::TestCase
context "See Kthxbye" do
setup do
- Kthxbye::Config.setup
+ Kthxbye::Config.setup(:verbose => false)
Kthxbye.redis.flushall
end
Please sign in to comment.
Something went wrong with that request. Please try again.