about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorJérémy Bobbio <lunar@debian.org>2013-06-23 14:31:30 +0200
committerEric Wong <normalperson@yhbt.net>2013-06-23 20:54:13 +0000
commit3fa5a63b09b9600c1e2a1629fd7be3c5343cc465 (patch)
tree9a216fc36e7aaa3496446bfc93a8b3a9bc3687b5
parent553f9e814f4ffbd021c33b70193c0fd41edb1d2e (diff)
downloadupr-3fa5a63b09b9600c1e2a1629fd7be3c5343cc465.tar.gz
Update Upr::Monitor to use Moneta 0.7 API
We need to deactivate the serialization in Moneta so that the assumption
(currently used in the tests) that the status object will be the same across
the calls to the monitor still hold.
-rw-r--r--lib/upr/monitor.rb9
-rw-r--r--upr.gemspec2
2 files changed, 5 insertions, 6 deletions
diff --git a/lib/upr/monitor.rb b/lib/upr/monitor.rb
index 2b4732c..ec285c9 100644
--- a/lib/upr/monitor.rb
+++ b/lib/upr/monitor.rb
@@ -5,10 +5,10 @@ module Upr
   # This uses any {Moneta}[http://github.com/wycats/moneta]
   # store to monitor upload progress.
   #
-  # Usage (in config.ru with Moneta::Memory store):
+  # Usage (in config.ru with Moneta Memory store):
   #   require 'upr'
-  #   require 'moneta/memory'
-  #   use Upr, :backend => Upr::Monitor.new(Moneta::Memory.new)
+  #   require 'moneta'
+  #   use Upr, :backend => Upr::Monitor.new(Moneta.new(:Memory, :serializer => nil))
   #   run YourApplication.new
   class Monitor < Struct.new(:moneta)
     # nuke anything not read/updated in 60 seconds
@@ -17,8 +17,7 @@ module Upr
     def initialize(moneta_store = nil)
       super
       if moneta_store.nil?
-        require 'moneta/memory' # moneta does not autoload :<
-        self.moneta = Moneta::Memory.new
+        self.moneta = Moneta.new(:Memory, :serializer => nil)
       end
     end
 
diff --git a/upr.gemspec b/upr.gemspec
index f99c088..f6bed03 100644
--- a/upr.gemspec
+++ b/upr.gemspec
@@ -31,7 +31,7 @@ Gem::Specification.new do |s|
   s.require_paths = %w(lib)
   s.rubyforge_project = %q{rainbows}
 
-  s.add_dependency(%q<moneta>)
+  s.add_dependency(%q<moneta>, '~>0.7')
   s.add_dependency(%q<rack>)
 
   # Folks on intranets sharing humongous files can use Unicorn, too