Merge branch 'release/v3.2.0'
[compound] / Rakefile
1 require 'rubygems'
2 require 'rake'
3 require 'opentox-ruby'
4
5 @gems = "sinatra rest-client emk-sinatra-url-for sinatra-respond_to"
6
7 namespace :openbabel do
8         desc "Install openbabel"
9         task :install do
10                 puts `sudo gem sources -a http://gems.github.com`
11                 puts `sudo gem install #{@gems}`
12                 begin
13                         require 'openbabel'
14                         puts "Openbabel is already installed"
15                 rescue  Exception => exc
16                         puts "Trying to install openbabel"
17                         Dir.chdir('/tmp')
18                         puts `wget http://downloads.sourceforge.net/project/openbabel/openbabel/2.2.2/openbabel-2.2.2.tar.gz` unless File.exists?('openbabel-2.2.2.tar.gz')
19                         puts `tar xzf openbabel-2.2.2.tar.gz`  unless File.exists?('openbabel-2.2.2')
20                         Dir.chdir('openbabel-2.2.2')
21                         puts `./configure`
22                         puts "Compiling Openbabel - this may take some time ..."
23                         puts `make`
24                         puts `sudo make install`
25                         Dir.chdir('scripts/ruby')
26                         puts `ruby extconf.rb --with-openbabel-include=../../include --with-openbabel-lib=../../src/.libs`
27                         puts "Compiling Ruby extension for Openbabel - this may take some time ..."
28                         puts `make`
29                         puts `sudo make install`
30                         begin
31                                 require 'openbabel'
32                                 puts "Openbabel sucessfully installed"
33                         rescue Exception => exc
34                                 puts "Failed to install Openbabel - please try manually."
35                         end
36                 end
37         end
38 end
39
40 desc "Run tests"
41 task :test do
42         load 'test/test.rb'
43 end
44