From 2667f4fb16d4773b26d80e4bd54e46d73ce94fd0 Mon Sep 17 00:00:00 2001 From: davor Date: Thu, 9 Aug 2012 17:21:19 +0200 Subject: Added default config. --- lib/opentox.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/opentox.rb b/lib/opentox.rb index 3d1092a..ac66b57 100644 --- a/lib/opentox.rb +++ b/lib/opentox.rb @@ -1,7 +1,8 @@ require 'sinatra/base' ENV["RACK_ENV"] ||= "production" require "sinatra/reloader" if ENV["RACK_ENV"] == "development" -require File.join(ENV["HOME"],".opentox","config","#{SERVICE}.rb") +require File.join(ENV["HOME"],".opentox","config","default.rb") +require File.join(ENV["HOME"],".opentox","config","#{SERVICE}.rb") if File.exist?(File.join(ENV["HOME"],".opentox","config","#{SERVICE}.rb")) logfile = File.join(ENV['HOME'], ".opentox","log","#{ENV["RACK_ENV"]}.log") -- cgit v1.2.3 From 53c61cdc1c032f80748b102f5aeb87a306da0d86 Mon Sep 17 00:00:00 2001 From: davor Date: Thu, 9 Aug 2012 18:29:02 +0200 Subject: Added bin/installer. --- bin/opentox-server-install | 63 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100755 bin/opentox-server-install diff --git a/bin/opentox-server-install b/bin/opentox-server-install new file mode 100755 index 0000000..e9d10e3 --- /dev/null +++ b/bin/opentox-server-install @@ -0,0 +1,63 @@ +#!/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 + +# Adjust ruby version here! +RUBY_NUM_VER="1.9.3-p194" + +echo +echo "Welcome to service installation ( 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 + +LOG="$OT_PREFIX/tmp/`basename $0`.log" +check_utils "rbenv find" +echo +echo "Installation ('$LOG'):" +echo + +if [ "$OT_BRANCH" = "development" ]; then + cmd="test -d $OT_PREFIX/opentox-client" && run_cmd "$cmd" "Opentox-client" +fi + +# ruby +[ "`$RBENV local 2>/dev/null`" = "$RUBY_NUM_VER" ] || install_ruby + +# self +echo +install_with_bundler + +echo +echo "Installation finished." +echo +echo "IMPORTANT: How to configure your system:" +echo "IMPORTANT: a) Include '$OT_UI_CONF' in shell startup (e.g. ~/.bashrc)." +echo "IMPORTANT: b) Manually source '$OT_UI_CONF' every time." +echo "IMPORTANT: The command in both cases: '. $OT_UI_CONF'" +echo "IMPORTANT: NOW would be the best time to configure!" +echo +echo "Thank you for your attention." +echo + +# return to wd +cd "$DIR" -- cgit v1.2.3 From f68801665dd06144c5e16f1d57b330790b3bb70a Mon Sep 17 00:00:00 2001 From: davor Date: Thu, 16 Aug 2012 18:47:19 +0200 Subject: Added functions from utils.sh --- bin/opentox-server-install | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/bin/opentox-server-install b/bin/opentox-server-install index e9d10e3..4c6504a 100755 --- a/bin/opentox-server-install +++ b/bin/opentox-server-install @@ -30,11 +30,8 @@ RUBY_DIR="$HOME/.rbenv/versions/$RUBY_NUM_VER" # # # Install -LOG="$OT_PREFIX/tmp/`basename $0`.log" check_utils "rbenv find" -echo -echo "Installation ('$LOG'):" -echo +check_log $SELF if [ "$OT_BRANCH" = "development" ]; then cmd="test -d $OT_PREFIX/opentox-client" && run_cmd "$cmd" "Opentox-client" @@ -47,17 +44,7 @@ fi echo install_with_bundler -echo -echo "Installation finished." -echo -echo "IMPORTANT: How to configure your system:" -echo "IMPORTANT: a) Include '$OT_UI_CONF' in shell startup (e.g. ~/.bashrc)." -echo "IMPORTANT: b) Manually source '$OT_UI_CONF' every time." -echo "IMPORTANT: The command in both cases: '. $OT_UI_CONF'" -echo "IMPORTANT: NOW would be the best time to configure!" -echo -echo "Thank you for your attention." -echo +notify # return to wd cd "$DIR" -- cgit v1.2.3 From f844ca5a9f18b8ca10275b3cc3a46053373cabbd Mon Sep 17 00:00:00 2001 From: Christoph Helma Date: Fri, 17 Aug 2012 16:46:39 +0200 Subject: intermediate fix for 4store RestClient errors --- lib/4store.rb | 16 ++++++++-------- lib/opentox.rb | 5 ++++- 2 files changed, 12 insertions(+), 9 deletions(-) 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 3d1092a..1e7b791 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","#{SERVICE}.rb") @@ -20,6 +20,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 -- cgit v1.2.3 From b464a5cad8afbc55550144828338f73509a9b162 Mon Sep 17 00:00:00 2001 From: Christoph Helma Date: Mon, 20 Aug 2012 14:40:26 +0200 Subject: version set to 5.0.0pre1 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 3eefcb9..8c5ba87 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.0.0 +5.0.0pre1 -- cgit v1.2.3 From 0b1752773ef94ea0359c0bcae6e9b30f47660cf0 Mon Sep 17 00:00:00 2001 From: Andreas Maunz Date: Tue, 21 Aug 2012 13:23:22 +0300 Subject: Removed Ruby Check --- bin/opentox-server-install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/opentox-server-install b/bin/opentox-server-install index 4c6504a..c4701c3 100755 --- a/bin/opentox-server-install +++ b/bin/opentox-server-install @@ -38,7 +38,7 @@ if [ "$OT_BRANCH" = "development" ]; then fi # ruby -[ "`$RBENV local 2>/dev/null`" = "$RUBY_NUM_VER" ] || install_ruby +install_ruby # self echo -- cgit v1.2.3 From 0642f95461e7edf9cde575db67d63f74b528ce84 Mon Sep 17 00:00:00 2001 From: Christoph Helma Date: Thu, 23 Aug 2012 09:04:56 +0200 Subject: version set to 1.0.0.pre1 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 8c5ba87..274edc4 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -5.0.0pre1 +1.0.0pre1 -- cgit v1.2.3 From 492126c5c36d7861635793abd5c36936b5247659 Mon Sep 17 00:00:00 2001 From: davor Date: Thu, 23 Aug 2012 13:24:49 +0200 Subject: Added File check. --- lib/opentox.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/opentox.rb b/lib/opentox.rb index 87d6186..3fb0088 100644 --- a/lib/opentox.rb +++ b/lib/opentox.rb @@ -1,7 +1,7 @@ require 'sinatra/base' require "sinatra/reloader" ENV["RACK_ENV"] ||= "production" -require File.join(ENV["HOME"],".opentox","config","default.rb") +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") -- cgit v1.2.3 From fc9440e18adb81992098f999d8fc1f4742219ffd Mon Sep 17 00:00:00 2001 From: Andreas Maunz Date: Mon, 3 Sep 2012 16:57:50 +0200 Subject: Fixed ruby version --- bin/opentox-server-install | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/opentox-server-install b/bin/opentox-server-install index c4701c3..e832cd4 100755 --- a/bin/opentox-server-install +++ b/bin/opentox-server-install @@ -6,9 +6,6 @@ SELF=$(basename $0 -install) [ "`id -u`" = "0" ] && echo "This script must be run as non-root." 1>&2 && exit 1 -# Adjust ruby version here! -RUBY_NUM_VER="1.9.3-p194" - echo echo "Welcome to service installation ( to continue)." read delete_me @@ -37,6 +34,9 @@ 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 -- cgit v1.2.3