summaryrefslogtreecommitdiff
path: root/opentox-ruby.sh
blob: 842c91f34d7ac1a08e8cae869672af1766566eb2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/bash
#
# Installs Opentox-ruby gem.
# Author: Christoph Helma, Andreas Maunz.
#

if [ "$(id -u)" = "0" ]; then
  echo "This script must be run as non-root." 1>&2
  exit 1
fi

# Utils
GIT="`which git`"
if [ ! -e "$GIT" ]; then
  echo "'git' missing. Install 'git' first. Aborting..."
  exit 1
fi

GEM="`which gem`"
if [ ! -e "$GEM" ]; then
  echo "'gem' missing. Install 'gem' first. Aborting..."
  exit 1
fi

RAKE="`which rake`"
if [ ! -e "$RAKE" ]; then
  echo "'rake' missing. Install 'rake' first. Aborting..."
  exit 1
fi


# Pkg
source ./config.sh


echo "This installs the Opentox-ruby gem."
echo "Press <Return> to continue, or <Ctrl+C> to abort."
read

DIR="`pwd`"

$GEM install opentox-ruby
$GEM install builder # not included by spreadsheet gem

SERVERNAME="`hostname`"
ESCAPED_SERVERNAME="`echo $SERVERNAME | sed 's/\/\\\//'`"
LOGGER=":logger: backtrace"
AA="nil"

mkdir -p "$HOME/.opentox/config"
mkdir -p "$HOME/.opentox/log"
sed -e "s/SERVERNAME/$servername/;s/ESCAPEDSERVERNAME/$escapedservername/;s/LOGGER/$logger/;s/AA/$aa/" production.yaml > $HOME/.opentox/config/production.yaml
sed -e "s/SERVERNAME/$servername/;s/ESCAPEDSERVERNAME/$escapedservername/;s/LOGGER/$logger/;s/AA/$aa/" "aa-local.yaml" >> $HOME/.opentox/config/production.yaml

mkdir -p $WWW_DEST/opentox
cd $WWW_DEST/opentox
$GIT clone "git://github.com/opentox/opentox-ruby.git "
cd opentox-ruby
pwd
$GIT remote show origin
$GIT fetch
$GIT checkout -b development origin/development
$GEM install jeweler
$RAKE install
GEM_LIB=`$GEM which opentox-ruby | sed 's/\/opentox-ruby.rb//'`
echo "'$GEM_LIB'"
mv "$GEM_LIB" "$GEM_LIB~"
ln -s "$WWW_DEST/opentox/opentox-ruby/lib" "$GEM_LIB"

cd "$DIR"