From 0430ae07ffb1e94b7e38c3f69136a26229a680e0 Mon Sep 17 00:00:00 2001 From: Christoph Helma Date: Fri, 9 Mar 2012 21:45:12 +0000 Subject: READE updated, Sinatra::Reloader added --- README | 34 +++++++++++++++++++++++++++++++--- lib/environment.rb | 4 ++++ lib/opentox.rb | 5 +++++ opentox-server.gemspec | 3 ++- 4 files changed, 42 insertions(+), 4 deletions(-) diff --git a/README b/README index 11d3b61..4b5783b 100644 --- a/README +++ b/README @@ -1,4 +1,32 @@ -opentox-server -============= +opentox-server: Common part for OpenTox webservices -Common part for Opentox webservices +Installation: + + gem install opentox-service + +Development: + + git clone git@github.com:.git + cd + bundle install + ./bin/toxbank-investigation-install # if not already installed, do not start webserver + export RACK_ENV=development + # if you are working on opentox-server|client gems as well edit Gemfile e.g. + # gem 'opentox-server', :path => "~/opentox-server" + # gem "opentox-client", :path => "~/opentox-client" + # start webserver in development mode (runs at port 8080, should reload changes from source files) + unicorn + # open new terminal + git flow init + git flow feature start + # code, test, code, ... + git flow feature finish + # test + # create release branch + # increase version (in toxbank-investigation.gemspec) + # install into system gems + rake install + # test + # create master + # release + rake release diff --git a/lib/environment.rb b/lib/environment.rb index 1af76f8..3889dfb 100644 --- a/lib/environment.rb +++ b/lib/environment.rb @@ -9,6 +9,7 @@ config_file = File.join(config_dir, "#{ENV['RACK_ENV']}.yaml") TMP_DIR = File.join(basedir, "tmp") LOG_DIR = File.join(basedir, "log") +=begin if File.exist?(config_file) CONFIG = YAML.load_file(config_file) not_found_error "Could not load configuration from \"#{config_file.to_s}\"" unless CONFIG @@ -19,10 +20,12 @@ else puts "Please edit #{config_file} and restart your application." exit end +=end logfile = "#{LOG_DIR}/#{ENV["RACK_ENV"]}.log" $logger = OTLogger.new(logfile) +=begin if CONFIG[:logger] and CONFIG[:logger] == "debug" $logger.level = Logger::DEBUG else @@ -34,4 +37,5 @@ AA_SERVER = CONFIG[:authorization] ? (CONFIG[:authorization][:server] ? CONFIG[: CONFIG[:authorization][:authenticate_request] = [""] unless CONFIG[:authorization][:authenticate_request] CONFIG[:authorization][:authorize_request] = [""] unless CONFIG[:authorization][:authorize_request] CONFIG[:authorization][:free_request] = [""] unless CONFIG[:authorization][:free_request] +=end diff --git a/lib/opentox.rb b/lib/opentox.rb index 4ca154c..05a8a08 100644 --- a/lib/opentox.rb +++ b/lib/opentox.rb @@ -1,4 +1,5 @@ require 'sinatra/base' +require "sinatra/reloader" module OpenTox # Base class for OpenTox services @@ -12,6 +13,10 @@ module OpenTox set :show_exceptions, false set :static, false + configure :development do + register Sinatra::Reloader + end + error do # TODO: set actor, calling OT::Error with uri parameter does not work error = request.env['sinatra.error'] diff --git a/opentox-server.gemspec b/opentox-server.gemspec index 66d4852..d365a49 100644 --- a/opentox-server.gemspec +++ b/opentox-server.gemspec @@ -23,7 +23,8 @@ Gem::Specification.new do |s| s.add_runtime_dependency 'rack' s.add_runtime_dependency 'rack-contrib' s.add_runtime_dependency 'sinatra' + s.add_runtime_dependency 'sinatra-contrib' s.add_runtime_dependency 'emk-sinatra-url-for' - s.add_runtime_dependency 'spreadsheet' s.add_runtime_dependency 'roo' + s.add_runtime_dependency 'unicorn' end -- cgit v1.2.3