setup.py 982 B

12345678910111213141516171819202122
  1. import subprocess
  2. import sys
  3. import setup_util
  4. def start(args, logfile, errfile):
  5. setup_util.replace_text("tapestry/hello/src/main/webapp/WEB-INF/resin-web.xml", "mysql:\/\/.*:3306", "mysql://" + args.database_host + ":3306")
  6. try:
  7. subprocess.check_call("mvn clean compile war:war", shell=True, cwd="tapestry/hello", stderr=errfile, stdout=logfile)
  8. subprocess.check_call("rm -rf $RESIN_HOME/webapps/*", shell=True, stderr=errfile, stdout=logfile)
  9. subprocess.check_call("cp tapestry/hello/target/tapestry.war $RESIN_HOME/webapps/tapestry.war", shell=True, stderr=errfile, stdout=logfile)
  10. subprocess.check_call("$RESIN_HOME/bin/resinctl start", shell=True, stderr=errfile, stdout=logfile)
  11. return 0
  12. except subprocess.CalledProcessError:
  13. return 1
  14. def stop(logfile, errfile):
  15. try:
  16. subprocess.check_call("$RESIN_HOME/bin/resinctl shutdown", shell=True, stderr=errfile, stdout=logfile)
  17. return 0
  18. except subprocess.CalledProcessError:
  19. return 1