setup.py 759 B

1234567891011121314151617181920212223
  1. import subprocess
  2. import sys
  3. import setup_util
  4. from os.path import expanduser
  5. home = expanduser("~")
  6. def start(args):
  7. setup_util.replace_text("dropwizard/hello-world.yml", "url: jdbc:mysql://localhost/hello_world", "url: jdbc:mysql://" + args.database_host + ":3306/hello_world")
  8. try:
  9. subprocess.check_call("mvn package;", shell=True, cwd="dropwizard")
  10. subprocess.check_call("java -jar target/hello-world-0.0.1-SNAPSHOT.jar server hello-world.yml", shell=True, cwd="dropwizard")
  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