lib/fluq.rb in fluq-0.7.5 vs lib/fluq.rb in fluq-0.8.0
- old
+ new
@@ -1,51 +1,57 @@
require 'pathname'
require 'uri'
require 'fileutils'
+require 'stringio'
+require 'thread'
require 'securerandom'
require 'forwardable'
require 'logger'
-require 'eventmachine'
-require 'msgpack'
-require 'oj'
-require 'timed_lru'
require 'timeout'
+require 'timed_lru'
+require 'celluloid/io'
+require 'celluloid/autostart'
+require 'multi_json'
+begin
+ require 'msgpack'
+rescue LoadError
+end
+
module FluQ
%w'version error mixins'.each do |name|
require "fluq/#{name}"
end
class << self
- # @attr_reader [String] env runtime environemnt
# @attr_reader [Pathname] root project root
- # @attr_reader [Logger] logger the main logger
- attr_reader :env, :root, :logger
+ attr_reader :root
- # @param [Logger] instance the thread-safe logger instance
- def logger=(instance)
- instance.extend(FluQ::Mixins::Logger)
- @logger = instance
+ # @param [Logger] logger
+ def logger=(logger)
+ Celluloid.logger = logger
end
- def init!
- # Detect environment
- @env = ENV['FLUQ_ENV'] || "development"
+ # @return [Logger] the thread-safe logger instance
+ def logger
+ Celluloid.logger
+ end
+ def init!
# Set root path
@root = Pathname.new(ENV['FLUQ_ROOT'] || ".")
# Setup logger
self.logger = ::Logger.new(STDOUT)
- logger.level = ::Logger::INFO if env == "production"
+ logger.level = ::Logger::INFO
end
protected :init!
end
init!
end
-%w'url event reactor handler input buffer feed dsl'.each do |name|
+%w'url event runner feed worker handler input format dsl'.each do |name|
require "fluq/#{name}"
end