about summary refs log tree commit homepage
path: root/lib/upr.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/upr.rb')
-rw-r--r--lib/upr.rb35
1 files changed, 35 insertions, 0 deletions
diff --git a/lib/upr.rb b/lib/upr.rb
new file mode 100644
index 0000000..825562e
--- /dev/null
+++ b/lib/upr.rb
@@ -0,0 +1,35 @@
+# -*- encoding: binary -*-
+
+require 'moneta'
+module Upr
+
+  # Upr version number
+  VERSION = '0.1.0'
+
+  # this is what we store in the Moneta-backed monitor
+  class Status < Struct.new(:seen, :length)
+  end
+
+  autoload :Monitor, 'upr/monitor'
+  autoload :InputWrapper, 'upr/input_wrapper'
+
+  # Initializes a new instance of Upr::InputWrapper.  Usage in config.ru:
+  #
+  #   use Upr, :path_info => %w(/upload),
+  #            :drb => "druby://192.168.0.1:666",
+  #            :frequency => 1
+  #
+  # This middleware MUST be be loaded before any parameter parsers
+  # like ActionController::ParamsParser in Rails.
+  #
+  # For use in RAILS_ROOT/config/environment.rb, the following
+  # works insdie the Rails::Initializer.run block:
+  #
+  #   config.middleware.insert_before('ActionController::ParamsParser',
+  #       'Upr', :path_info => '/', :drb => "druby://192.168.0.1:666")
+  #
+  def self.new(*args)
+    InputWrapper.new(*args)
+  end
+
+end