aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorzsloan2016-05-18 20:06:41 +0000
committerzsloan2016-05-18 20:06:41 +0000
commitf8c89f7c24cbfcffdafd12ef2087f4de598ed4bd (patch)
treeca233c2f08151377de161a616e69031d557ff808 /bin
parente36ffce0d972334b07ee91b817fc3f30ed3598c4 (diff)
parenta8945cc625f12e9cf733f469426bf0e4b8e83647 (diff)
downloadgenenetwork2-f8c89f7c24cbfcffdafd12ef2087f4de598ed4bd.tar.gz
Merge branch 'staging' of https://github.com/genenetwork/genenetwork2
Diffstat (limited to 'bin')
-rwxr-xr-xbin/genenetwork244
-rwxr-xr-xbin/test-website73
2 files changed, 117 insertions, 0 deletions
diff --git a/bin/genenetwork2 b/bin/genenetwork2
new file mode 100755
index 00000000..bbb2a19f
--- /dev/null
+++ b/bin/genenetwork2
@@ -0,0 +1,44 @@
+#! /bin/bash
+#
+# This will run the GN2 server (with default settings if none supplied).
+#
+# Environment settings can be used to preconfigure as well as a
+# settings.py file.
+
+# Absolute path to this script, e.g. /home/user/bin/foo.sh
+SCRIPT=$(readlink -f "$0")
+# Absolute path this script is in, thus /home/user/bin
+GN2_BASE_PATH=$(dirname $(dirname "$SCRIPT"))
+
+GN2_GUIX_PATH=$GN2_BASE_PATH/lib/python2.7/site-packages/genenetwork2-2.0-py2.7.egg
+if [ -d $GN2_GUIX_PATH ]; then
+ GN2_BASE_PATH=$GN2_GUIX_PATH
+fi
+echo $GN2_BASE_PATH
+
+# Handle settings parameter
+settings=$1
+if [ -z $settings ]; then settings=$GN2_BASE_PATH/etc/default_settings.py ; fi
+if [ ! -e $settings ]; then
+ echo "ERROR: can not locate settings file - pass it in the command line"
+ exit 1
+fi
+export WQFLASK_SETTINGS=$settings
+
+# We may change this one:
+export PYTHONPATH=$GN2_BASE_PATH/wqflask:$PYTHONPATH
+
+# TEMPDIR defaults to /tmp if nothing else
+if [ -z $TEMPDIR ]; then
+ TEMPDIR="/tmp"
+fi
+
+# Start the redis server
+echo -n "dir $TEMPDIR
+dbfilename gn2.rdb
+" | redis-server - &
+
+# Start the flask server running GN2
+cd $GN2_BASE_PATH/wqflask
+echo "Starting with $settings"
+/usr/bin/env python runserver.py
diff --git a/bin/test-website b/bin/test-website
new file mode 100755
index 00000000..aeab459b
--- /dev/null
+++ b/bin/test-website
@@ -0,0 +1,73 @@
+#!/usr/bin/env ruby
+
+
+USAGE = <<EOT
+This is Mechanical-Rob - an automated web server tester for
+ Genenetwork.org that uses the brilliant
+ mechanize gem.
+
+To use this software you need to install mechanize. Run it from
+the root of the genenetwork2 source tree as, for example,
+
+ ./bin/test-website http://localhost:5003/ (default)
+
+For more information see http://genenetwork.org/
+
+EOT
+$stderr.print USAGE
+
+require 'optparse'
+
+options = {}
+opts = OptionParser.new do |o|
+ o.banner = "Usage: #{File.basename($0)} [options] URL"
+
+ o.on('-l','--link-checker', 'Check for dead links') do
+ options[:link_checker] = true
+ end
+
+ o.on('-n','--navigation-test', 'Check for navigation test results') do
+ options[:navigation_test] = true
+ end
+
+ o.separator ""
+ o.on_tail('-h', '--help', 'display this help and exit') do
+ options[:show_help] = true
+ end
+end
+
+opts.parse!(ARGV)
+
+if options[:show_help]
+ print opts
+ exit 1
+end
+
+$host =
+ if ARGV.size>0
+ ARGV.shift
+ else
+ "http://localhost:5003"
+ end
+
+$stderr.print "Testing <",$host,">\n"
+
+require 'mechanize'
+require 'minitest/spec'
+require 'minitest/autorun'
+
+# These are the actual testing modules
+
+libpath = File.dirname(File.dirname(__FILE__))
+$: << File.join(libpath,'test/lib')
+
+if options[:link_checker]
+ require 'link_checker'
+else
+ require 'main_web_functionality'
+end
+
+if options[:navigation_test]
+ require 'NavigationTest'
+end
+