From 37a12997628fcab722512f8a6370b92d44e33529 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 2 Oct 2009 20:44:03 -0700 Subject: initial revision No tests yet, but the old "gossamer" and "rainbows" branches seem to be basically working. --- lib/rainbows/configurator.rb | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 lib/rainbows/configurator.rb (limited to 'lib/rainbows/configurator.rb') diff --git a/lib/rainbows/configurator.rb b/lib/rainbows/configurator.rb new file mode 100644 index 0000000..449cdd9 --- /dev/null +++ b/lib/rainbows/configurator.rb @@ -0,0 +1,25 @@ +require 'rainbows' +module Rainbows + + class Configurator < ::Unicorn::Configurator + + def use(model) + begin + model = Rainbows.const_get(model) + rescue NameError + raise ArgumentError, "concurrency model #{model.inspect} not supported" + end + + Module === model or + raise ArgumentError, "concurrency model #{model.inspect} not supported" + set[:use] = model + end + + def worker_connections(nr) + (Integer === nr && nr > 0) || nr.nil? or + raise ArgumentError, "worker_connections must be an Integer or nil" + end + + end + +end -- cgit v1.2.3-24-ge0c7