diff options
Diffstat (limited to 'application.rb')
-rwxr-xr-x[-rw-r--r--] | application.rb | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/application.rb b/application.rb index a8ae5a8..ad9653a 100644..100755 --- a/application.rb +++ b/application.rb @@ -1,20 +1,37 @@ require 'rubygems' -gem 'opentox-ruby-api-wrapper', '= 1.6.0' -[ 'sinatra', 'sinatra/url_for', 'opentox-ruby-api-wrapper' ].each do |lib| +gem "opentox-ruby", "~> 0" +[ 'sinatra', 'sinatra/url_for', 'opentox-ruby' ].each do |lib| require lib end +['dm-core', 'dm-serializer', 'dm-timestamps', 'dm-types', 'dm-migrations', 'dm-validations' ].each{|lib| require lib } +DataMapper.setup(:default, { + :adapter => CONFIG[:database][:adapter], + :database => CONFIG[:database][:database], + :username => CONFIG[:database][:username], + :password => CONFIG[:database][:password], + :host => CONFIG[:database][:host]}) +set :lock, true #unless(defined? LOGGER) #LOGGER = Logger.new(STDOUT) #LOGGER.datetime_format = "%Y-%m-%d %H:%M:%S " #end +#require "error_application.rb" + require "example.rb" + get '/examples/?' do LOGGER.info "list examples" - content_type "text/plain" - Example.transform_example + + if request.env['HTTP_ACCEPT'] =~ /text\/html/ + content_type "text/html" + OpenTox.text_to_html Example.transform_example,@subjectid + else + content_type "text/plain" + Example.transform_example + end end get '/prepare_examples/?' do @@ -23,10 +40,11 @@ get '/prepare_examples/?' do Example.prepare_example_resources end -get '/test_examples/?' do - LOGGER.info "test examples" +post '/test_examples/?' do + examples = params[:examples] + LOGGER.info "test examples "+examples.to_s content_type "text/plain" - Example.test_examples + Example.test_examples(examples) end require "test/test_application.rb" @@ -36,6 +54,7 @@ require "nightly/nightly_application.rb" # (otherwise sinatra will try to locate a validation with name examples or report) require "report/report_application.rb" +require "reach_reports/reach_application.rb" require "validation/validation_application.rb" |