root/t2-web/trunk/bin/t2-web @ 220

Revision 220, 1.2 KB (checked in by kostas.karasavvas@…, 23 months ago)

added comment of current problem

Line 
1#!/usr/bin/env ruby
2
3require 'optparse'
4require 't2-web'
5
6# Set up and parse arguments
7opts = OptionParser.new do |opt|
8  opt.banner = "Usage: t2-web [options] start|stop|restart"
9  opt.separator("\nSupports the following options:")
10  opt.on("-d", "--daemonize", "Run daemonized in the background")
11  opt.on("-p", "--port PORT", "Use PORT (default: 3000)")
12  opt.on("-s", "--servers NUM", "Number of servers to start")
13  opt.on_tail("-v", "--version", "Show the version") do
14    puts "Taverna 2 Web Interface Generator version: #{T2Web::VERSION}"
15    exit
16  end
17  opt.on_tail("-h", "-?", "--help", "Show this message") do
18    puts opt
19    exit
20  end
21end
22
23# parse options (currently only displaying and passing all to thin!)
24opts.parse!
25
26if ARGV.size == 0
27  puts opts
28  exit
29end
30
31# TODO: call webapp via rack and ruby rather than from the prompt!!
32
33INSTALL_DIR = `gem environment gemdir`.chomp + "/gems/t2-web-#{T2Web::VERSION}/bin"
34
35# cd to proper dir and run thin $* for now
36success = `cd #{INSTALL_DIR} ; thin #{$*.join(' ')}`
37
38# TODO This script does not work properly!! It hangs and seems to do nothing!
39# Maybe the sub-shell loses some of the environment
40
41if success
42  puts "Running: thin #{$*.join(' ')} !"
43else
44  puts "Failed running: thin #{$*} !"
45end
46
Note: See TracBrowser for help on using the browser.