diff options
author | Christoph Helma <helma@in-silico.ch> | 2011-03-03 13:00:47 +0100 |
---|---|---|
committer | Christoph Helma <helma@in-silico.ch> | 2011-03-03 13:00:47 +0100 |
commit | dcd0a5a659c303c50a59d1271947851245db10e7 (patch) | |
tree | eaae695edf72c3a99cde58b9caaa7825d6d4f31a /Rakefile | |
parent | 8b46f5a4f389d7cd54f6e8b38025d275f9d3ed1b (diff) | |
parent | e57856a3c2cd10df207e722301c24a022e9fd802 (diff) |
Merge remote branch 'mguetlein/test' into development
Conflicts:
application.rb
example.rb
lib/validation_db.rb
nightly/nightly.rb
report/environment.rb
test/test_examples.rb
test/test_examples_util.rb
Diffstat (limited to 'Rakefile')
-rwxr-xr-x[-rw-r--r--] | Rakefile | 43 |
1 files changed, 31 insertions, 12 deletions
@@ -1,30 +1,48 @@ require 'rubygems' require 'rake' -require 'tasks/opentox' -REPORT_GEMS = ['rubygems', 'logger', 'fileutils', 'sinatra', 'sinatra/url_for', 'rest_client', - 'yaml', 'opentox-ruby-api-wrapper', 'fileutils', 'mime/types', 'abbrev', - 'rexml/document', 'active_record', 'ar-extensions', 'ruby-plot'] -VALIDATION_GEMS = [ 'rubygems', 'sinatra', 'sinatra/url_for', 'opentox-ruby-api-wrapper', 'logger', 'active_record', 'ar-extensions' ] +REPORT_GEMS = [ 'opentox-ruby', 'mime-types', 'ruby-plot', 'rinruby'] #'ar-extensions', 'activerecord', 'activesupport', +VALIDATION_GEMS = [ 'opentox-ruby', 'ruby-plot'] #'ar-extensions', 'activerecord', 'activesupport', +GEM_VERSIONS = { "ruby-plot" => "= 0.0.2" } +GEM_INSTALL_OPTIONS = {} + +#GEM_VERSIONS = { "activerecord" => "= 2.3.8", "activesupport" => "= 2.3.8", "ar-extensions" => "= 0.9.2", "ruby-plot" => "= 0.0.2" } +## this is needed because otherwihse ar-extensions adds activesupport 3.0.0 which confuses things +#GEM_INSTALL_OPTIONS = { "ar-extensions" => "--ignore-dependencies" } desc "Install required gems" task :install_gems do (REPORT_GEMS + VALIDATION_GEMS).uniq.each do |g| begin - print "> require "+g+" .. " - require g + if GEM_VERSIONS.has_key?(g) + print "> gem "+g+", '"+GEM_VERSIONS[g]+"' .. " + gem g, GEM_VERSIONS[g] + else + print "> gem "+g+" .. " + gem g + end puts "ok" rescue LoadError => ex puts "NOT FOUND" - cmd = "sudo env PATH=$PATH gem install "+g + options = "" + options += "--version '"+GEM_VERSIONS[g]+"' " if GEM_VERSIONS.has_key?(g) + options += GEM_INSTALL_OPTIONS[g]+" " if GEM_INSTALL_OPTIONS.has_key?(g) + cmd = "sudo env PATH=$PATH gem install "+options+" "+g + puts "installing gem, this may take some time..." puts cmd IO.popen(cmd){ |f| puts f.gets } end end end +desc "Perform unit tests" +task :test do + require 'test/unit_test.rb' +end + +=begin desc "Installs gems and inits db migration" task :init => [:install_gems, :migrate] do @@ -35,7 +53,7 @@ end desc "load config" task :load_config do require 'yaml' - ENV['RACK_ENV'] = 'test' unless ENV['RACK_ENV'] + ENV['RACK_ENV'] = 'production' unless ENV['RACK_ENV'] basedir = File.join(ENV['HOME'], ".opentox") config_dir = File.join(basedir, "config") config_file = File.join(config_dir, "#{ENV['RACK_ENV']}.yaml") @@ -46,7 +64,7 @@ task :load_config do puts "config loaded" end -# USER VERSION 0 instead +# USE VERSION 0 instead #desc "Clear database" #task :clear_db => :load_config do # if CONFIG[:database][:adapter]=="mysql" @@ -62,7 +80,8 @@ end desc "Migrate the database through scripts in db/migrate. Target specific version with VERSION=x" task :migrate => :load_config do - require 'active_record' + [ 'rubygems', 'active_record', 'logger' ].each{ |l| require l } + puts "database config: "+@@config[:database].inspect.to_s ActiveRecord::Base.establish_connection( :adapter => CONFIG[:database][:adapter], :host => CONFIG[:database][:host], @@ -74,5 +93,5 @@ task :migrate => :load_config do ActiveRecord::Migrator.migrate('db/migrate', ENV["VERSION"] ? ENV["VERSION"].to_i : 2 ) end - +=end |