diff options
author | rautenberg <rautenberg@in-silico.ch> | 2012-09-04 11:35:11 +0200 |
---|---|---|
committer | rautenberg <rautenberg@in-silico.ch> | 2012-09-04 11:35:11 +0200 |
commit | 68b616f0a3609c38e91dce2c726ae3b56376e40e (patch) | |
tree | d22c5bce2c3e8b12cad0a59bd9ee95dafb6f23a6 | |
parent | 9e6fb4240c32d3e4f075ba904eae0f59541a303b (diff) | |
parent | fc9440e18adb81992098f999d8fc1f4742219ffd (diff) |
solve merge conflicts
-rw-r--r-- | VERSION | 2 | ||||
-rwxr-xr-x | bin/opentox-server-install | 50 | ||||
-rw-r--r-- | lib/4store.rb | 16 | ||||
-rw-r--r-- | lib/opentox.rb | 5 |
4 files changed, 63 insertions, 10 deletions
@@ -1 +1 @@ -1.0.0 +1.0.0pre1 diff --git a/bin/opentox-server-install b/bin/opentox-server-install new file mode 100755 index 0000000..e832cd4 --- /dev/null +++ b/bin/opentox-server-install @@ -0,0 +1,50 @@ +#!/bin/sh + +# Installs Opentox Webservice. +# Author: Christoph Helma, Andreas Maunz. + +SELF=$(basename $0 -install) +[ "`id -u`" = "0" ] && echo "This script must be run as non-root." 1>&2 && exit 1 + +echo +echo "Welcome to service installation (<Return> to continue)." +read delete_me + + +# check wd is root of service +DIR=`pwd` +if echo $DIR | grep "$SELF/bin" >/dev/null 2>&1 ; then cd ..; fi + +# # # Boot the script + +# load base config, helper funs, environment +OT_CONFIG_DIR="$HOME/.opentox" +! [ -f "$OT_CONFIG_DIR/config/install/config.sh" ] && echo "config.sh not found." 1>&2 && exit 1 || . $OT_CONFIG_DIR/config/install/config.sh +! [ -f "$OT_PREFIX/install/utils.sh" ] && echo "utils.sh not found." 1>&2 && exit 1 || . $OT_PREFIX/install/utils.sh +[ -f $OT_CONFIG_DIR/opentox-ui.sh ] && . $OT_CONFIG_DIR/opentox-ui.sh # should have been done by user already +RUBY_DIR="$HOME/.rbenv/versions/$RUBY_NUM_VER" + + +# # # Install + +check_utils "rbenv find" +check_log $SELF + +if [ "$OT_BRANCH" = "development" ]; then + cmd="test -d $OT_PREFIX/opentox-client" && run_cmd "$cmd" "Opentox-client" +fi + +# Adjust ruby version here! +RUBY_NUM_VER="1.9.3-p194" + +# ruby +install_ruby + +# self +echo +install_with_bundler + +notify + +# return to wd +cd "$DIR" diff --git a/lib/4store.rb b/lib/4store.rb index f6879b0..8715ea7 100644 --- a/lib/4store.rb +++ b/lib/4store.rb @@ -29,11 +29,11 @@ module OpenTox bad_request_error "'#{mime_type}' is not a supported content type. Please use one of #{@@content_type_formats.join(", ")}." unless @@content_type_formats.include? mime_type or mime_type == "multipart/form-data" bad_request_error "Reqest body empty." unless rdf mime_type = "application/x-turtle" if mime_type == "text/plain" # ntriples is turtle in 4store - #begin + begin RestClient.post File.join(four_store_uri,"data")+"/", :data => rdf, :graph => uri, "mime-type" => mime_type - #rescue - #rest_call_error $!.message, File.join(four_store_uri,"data")+"/" - #end + rescue + bad_request_error $!.message, File.join(four_store_uri,"data")+"/" + end end def self.put uri, rdf, mime_type @@ -41,9 +41,9 @@ module OpenTox bad_request_error "Reqest body empty." unless rdf mime_type = "application/x-turtle" if mime_type == "text/plain" #begin - RestClient.put File.join(four_store_uri,"data",uri), rdf, :content_type => mime_type + RestClientWrapper.put File.join(four_store_uri,"data",uri), rdf, :content_type => mime_type #rescue - #rest_call_error $!.message, File.join(four_store_uri,"data",uri) + #bad_request_error $!.message, File.join(four_store_uri,"data",uri) #end end @@ -91,8 +91,8 @@ module OpenTox # TODO: check if this prevents SPARQL injections bad_request_error "Only SELECT and CONSTRUCT are accepted SPARQL statements." end - #rescue - #rest_call_error $!.message, sparql_uri + rescue + bad_request_error $!.message, sparql_uri end def self.klass diff --git a/lib/opentox.rb b/lib/opentox.rb index 551e318..3fb0088 100644 --- a/lib/opentox.rb +++ b/lib/opentox.rb @@ -1,6 +1,6 @@ require 'sinatra/base' +require "sinatra/reloader" ENV["RACK_ENV"] ||= "production" -require "sinatra/reloader" if ENV["RACK_ENV"] == "development" require File.join(ENV["HOME"],".opentox","config","default.rb") if File.exist? File.join(ENV["HOME"],".opentox","config","default.rb") require File.join(ENV["HOME"],".opentox","config","#{SERVICE}.rb") @@ -21,6 +21,9 @@ module OpenTox configure :development do register Sinatra::Reloader + also_reload "./*.rb" + also_reload "../opentox-client/lib/*.rb" + also_reload File.join(ENV["HOME"],".opentox","config","#{SERVICE}.rb") end before do |