summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorroot <root@ot-dev.in-silico.ch>2011-02-25 17:54:39 +0000
committerroot <root@ot-dev.in-silico.ch>2011-02-25 17:54:39 +0000
commitd3dfccb8e46e1d5677877b833fa81acad4d026d4 (patch)
tree5ce6db2f7d0e5ceae27f73acfa4d9cb40a88eeb5
parent96e7db0a280ed3f28266a117a27cc69cb800063f (diff)
ohm/redis backend
-rw-r--r--Rakefile1
-rw-r--r--lib/environment.rb2
-rw-r--r--lib/opentox-ruby.rb2
-rw-r--r--lib/overwrite.rb6
4 files changed, 10 insertions, 1 deletions
diff --git a/Rakefile b/Rakefile
index 2578bb4..e49efc3 100644
--- a/Rakefile
+++ b/Rakefile
@@ -27,6 +27,7 @@ begin
"yajl-ruby",
"tmail",
"rinruby",
+ "ohm",
"rjb"
].each { |dep| gem.add_dependency dep }
[ "dm-core",
diff --git a/lib/environment.rb b/lib/environment.rb
index 5b16e4a..73df64e 100644
--- a/lib/environment.rb
+++ b/lib/environment.rb
@@ -52,6 +52,8 @@ if CONFIG[:database]
#DataMapper.setup(:default, {:adapter => "redis"})
#DataMapper::Model.raise_on_save_failure = true
+ require 'ohm'
+ Ohm.connect :thread_safe => true
end
# load mail settings for error messages
diff --git a/lib/opentox-ruby.rb b/lib/opentox-ruby.rb
index 735b845..ab8d824 100644
--- a/lib/opentox-ruby.rb
+++ b/lib/opentox-ruby.rb
@@ -1,4 +1,4 @@
-['rubygems', 'sinatra', 'sinatra/url_for', 'rest_client', 'yaml', 'cgi', 'spork', 'error', 'overwrite', 'environment'].each do |lib|
+['rubygems', 'sinatra', 'sinatra/url_for', 'ohm', 'rest_client', 'yaml', 'cgi', 'spork', 'error', 'overwrite', 'environment'].each do |lib|
require lib
end
diff --git a/lib/overwrite.rb b/lib/overwrite.rb
index b5c3942..fbe775d 100644
--- a/lib/overwrite.rb
+++ b/lib/overwrite.rb
@@ -137,3 +137,9 @@ class OTLogger < Logger
end
+# make migration from datamapper more straightforward
+class Ohm::Model
+ def self.get(id)
+ self[id]
+ end
+end