From 678a9e60be4a9a6b0c59969a0f6e0266885337fa Mon Sep 17 00:00:00 2001 From: gebele Date: Mon, 31 Oct 2016 16:09:18 +0000 Subject: updated README; added service commands for the gem --- README | 10 ---------- README.md | 52 +++++++++++++++++++++++++++++++++++++++++++++++++ bin/nano-lazar-start | 8 ++++++++ bin/nano-lazar-start.sh | 8 ++++++++ bin/nano-lazar-stop | 5 +++++ bin/nano-lazar-stop.sh | 52 +++++++++++++++++++++++++++++++++++++++++++++++++ nano-lazar.gemspec | 12 ++++++++++-- 7 files changed, 135 insertions(+), 12 deletions(-) delete mode 100644 README create mode 100644 README.md create mode 100644 bin/nano-lazar-start create mode 100644 bin/nano-lazar-start.sh create mode 100644 bin/nano-lazar-stop create mode 100644 bin/nano-lazar-stop.sh diff --git a/README b/README deleted file mode 100644 index 12e0783..0000000 --- a/README +++ /dev/null @@ -1,10 +0,0 @@ -IST Software&Services - -Nano Lazar for eNanoMapper project - -installation: -- bundle install - -usage: --run 'unicorn -D' --visit 'localhost:8080' diff --git a/README.md b/README.md new file mode 100644 index 0000000..ce3e52c --- /dev/null +++ b/README.md @@ -0,0 +1,52 @@ +nano-lazar +========== + + nano-lazar for [eNanoMapper](http://www.enanomapper.net/) project. + +Dependencies +------------ + + nano-lazar depends on a couple of external programs and libraries. All required libraries will be installed with the `gem install nano-lazar` or `bundle install` command. The output should give you more verbose information that can help in debugging (e.g. to identify missing libraries). + +Installation +------------ + + ``` + gem install nano-lazar + ``` + + or + + ``` + git clone https://github.com/enanomapper/nano-lazar.git + cd nano-lazar + bundle install + ``` + +Service +------- + + ``` + nano-lazar-start + nano-lazar-stop + ``` + + or + + ``` + cd nano-lazar + unicorn -D + ``` + +Browser +------- + Point your browser to `localhost:8080` (default) or any other port passed within the unicorn start command. + +Documentation +------------- + * [API documentation](http://rdoc.info/gems/nano-lazar) + +Copyright +--------- + + Copyright (c) 2009-2016 Christoph Helma, Micha Rautenberg, Denis Gebele. See LICENSE for details. diff --git a/bin/nano-lazar-start b/bin/nano-lazar-start new file mode 100644 index 0000000..0cbaba5 --- /dev/null +++ b/bin/nano-lazar-start @@ -0,0 +1,8 @@ +#!/usr/bin/env ruby +bin_dir = File.expand_path(File.dirname(__FILE__)) +shell_script_path = File.join(bin_dir, 'nano-lazar-start.sh') +app_dir = File.expand_path('..') +unicorn_conf = File.join(app_dir, 'unicorn.rb') + +`#{shell_script_path}` +`#{unicorn_conf}` diff --git a/bin/nano-lazar-start.sh b/bin/nano-lazar-start.sh new file mode 100644 index 0000000..f772c66 --- /dev/null +++ b/bin/nano-lazar-start.sh @@ -0,0 +1,8 @@ +#!/bin/bash +sudo mongod & +R CMD Rserve +GEMPATH=$(gem path nano-lazar) +cd $GEMPATH +unicorn -c unicorn.rb -E production -D + +exit 0 diff --git a/bin/nano-lazar-stop b/bin/nano-lazar-stop new file mode 100644 index 0000000..b3ef727 --- /dev/null +++ b/bin/nano-lazar-stop @@ -0,0 +1,5 @@ +#!/usr/bin/env ruby +bin_dir = File.expand_path(File.dirname(__FILE__)) +shell_script_path = File.join(bin_dir, 'nano-lazar-stop.sh') + +`#{shell_script_path}` diff --git a/bin/nano-lazar-stop.sh b/bin/nano-lazar-stop.sh new file mode 100644 index 0000000..ec91982 --- /dev/null +++ b/bin/nano-lazar-stop.sh @@ -0,0 +1,52 @@ +#!/bin/bash +grep_nano_lazar=`ps aux | grep -v grep | grep nano-lazar-start` +grep_mongo=`ps aux | grep -v grep | grep mongod` +grep_rserve=`ps aux | grep -v grep | grep Rserve` +grep_unicorn=`ps aux | grep -v grep | grep unicorn` + +# lazar +if [ ${#grep_lazar} -gt 0 ] +then + PID=`ps ax | grep -v grep | grep nano-lazar-start | awk '{ print $1 }'` + for i in "${PID}" + do + `kill $i` + done +else + echo "nano-lazar is stopped." +fi + +# mongod +if [ ${#grep_mongo} -gt 0 ] +then + PID=`ps ax | grep -v grep | grep mongod | awk '{ print $1 }'` + for i in "${PID}" + do + `sudo kill $i` + done +else + echo "MongoDB is not running." +fi + +# rserve +if [ ${#grep_rserve} -gt 0 ] +then + PID=`ps ax | grep -v grep | grep Rserve | awk '{ print $1 }'` + for i in "${PID}" + do + `kill $i` + done +else + echo "Rserve is not running." +fi + +# unicorn +if [ ${#grep_unicorn} -gt 0 ] +then + PID=`ps ax | grep -v grep | grep unicorn | awk '{ print $1 }'` + `kill ${PID[0]}` +else + echo "Unicorn is not running." +fi + +exit 0 diff --git a/nano-lazar.gemspec b/nano-lazar.gemspec index 6e322f3..f3ec373 100644 --- a/nano-lazar.gemspec +++ b/nano-lazar.gemspec @@ -7,9 +7,9 @@ Gem::Specification.new do |s| s.email = ["helma@in-silico.ch","rautenberg@in-silico.ch","gebele@in-silico.ch"] s.homepage = "http://github.com/enanomapper/nano-lazar" s.summary = %q{nano-lazar} - s.description = %q{Graphical User Interface for Nano Lazar Toxicology Predictions} + s.description = %q{Graphical user interface for nano-lazar toxicology predictions} s.license = 'GPL-3' - + s.executables = ["nano-lazar-start", "nano-lazar-stop"] s.rubyforge_project = "nano-lazar" s.files = `git ls-files`.split("\n") @@ -20,4 +20,12 @@ Gem::Specification.new do |s| s.add_runtime_dependency "rdiscount" s.add_runtime_dependency "haml" s.add_runtime_dependency "unicorn" + s.add_runtime_dependency "gem-path", "~> 0.6.1", '>= 0.6.1' + + s.post_install_message = %q{ + How to build nano-lazar prediction models described over here: https://github.com/opentox/lazar-public-data . + Service commands: + nano-lazar-start + nano-lazar-stop + } end -- cgit v1.2.3