setup.py 795 B

12345678910111213141516171819202122
  1. import subprocess
  2. import sys
  3. import setup_util
  4. def start(args):
  5. setup_util.replace_text("compojure/hello/src/hello/handler.clj", ":subname \"//.*:3306", ":subname \"//" + args.database_host + ":3306")
  6. try:
  7. subprocess.check_call("lein ring uberwar", shell=True, cwd="compojure/hello")
  8. subprocess.check_call("rm -rf $RESIN_HOME/webapps/*", shell=True)
  9. subprocess.check_call("cp compojure/hello/target/hello-compojure-standalone.war $RESIN_HOME/webapps/compojure.war", shell=True)
  10. subprocess.check_call("$RESIN_HOME/bin/resinctl start", shell=True)
  11. return 0
  12. except subprocess.CalledProcessError:
  13. return 1
  14. def stop():
  15. try:
  16. subprocess.check_call("$RESIN_HOME/bin/resinctl shutdown", shell=True)
  17. return 0
  18. except subprocess.CalledProcessError:
  19. return 1