summaryrefslogtreecommitdiff
path: root/Rakefile
diff options
context:
space:
mode:
authormguetlein <martin.guetlein@gmail.com>2010-06-25 20:52:28 +0200
committermguetlein <martin.guetlein@gmail.com>2010-06-25 20:52:28 +0200
commit7b8dfc1b6f8daa8305d6506ceb54b7ffff5f72f6 (patch)
tree46d22df1b9ce9166cba4265d8beecb99915242e1 /Rakefile
parent6c663f3bb95b45d5cb7e356ff6d1913a3e03212c (diff)
reorganized requires, added install_gems to Rakefile, text/x-yaml to application/x-yaml
Diffstat (limited to 'Rakefile')
-rw-r--r--Rakefile35
1 files changed, 24 insertions, 11 deletions
diff --git a/Rakefile b/Rakefile
index 185f948..67862b0 100644
--- a/Rakefile
+++ b/Rakefile
@@ -1,23 +1,36 @@
require 'rubygems'
require 'rake'
-@gems = "sinatra emk-sinatra-url-for builder datamapper json_pure do_sqlite3 opentox-ruby-api-wrapper"
+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' ]
+
+
desc "Install required gems"
-task :install do
- puts `sudo gem install #{@gems}`
+task :install_gems do
+ (REPORT_GEMS + VALIDATION_GEMS).uniq.each do |g|
+ begin
+ print "> require "+g+" .. "
+ require g
+ puts "ok"
+ rescue LoadError => ex
+ puts "NOT FOUND"
+ cmd = "sudo gem install "+g
+ puts cmd
+ IO.popen(cmd){ |f| puts f.gets }
+ end
+ end
end
-desc "Update required gems"
-task :update do
- puts `sudo gem update #{@gems}`
-end
-desc "Run tests"
-task :test do
- load 'test.rb'
+desc "Installs gems and inits db"
+task :init => [:install_gems, :migrate] do
+ #do nothing
end
+
desc "load config"
task :load_config do
require 'yaml'
@@ -57,7 +70,7 @@ task :migrate => :load_config do
:password => @@config[:database][:password]
)
ActiveRecord::Base.logger = Logger.new($stdout)
- ActiveRecord::Migrator.migrate('db/migrate', ENV["VERSION"] ? ENV["VERSION"].to_i : nil )
+ ActiveRecord::Migrator.migrate('db/migrate', ENV["VERSION"] ? ENV["VERSION"].to_i : 2 )
end