setup.py 1.3 KB

1234567891011121314151617181920212223242526272829303132
  1. import subprocess
  2. import sys
  3. import setup_util
  4. import os
  5. def start(args):
  6. setup_util.replace_text("spring/src/main/webapp/WEB-INF/resin-web.xml", "mysql:\/\/.*:3306", "mysql://" + args.database_host + ":3306")
  7. try:
  8. subprocess.check_call("mvn clean compile war:war", shell=True, cwd="spring")
  9. if os.name == 'nt':
  10. subprocess.check_call('rmdir /S /Q "%RESIN_HOME%\\webapps\\"', shell=True)
  11. subprocess.check_call('mkdir "%RESIN_HOME%\\webapps\\"', shell=True)
  12. subprocess.check_call('copy spring\\target\\spring-1.0.0-SNAPSHOT.war "%RESIN_HOME%\\webapps\\spring.war"', shell=True)
  13. subprocess.check_call('"%RESIN_HOME%\\bin\\start.bat"', shell=True)
  14. else:
  15. subprocess.check_call("rm -rf $RESIN_HOME/webapps/*", shell=True)
  16. subprocess.check_call("cp spring/target/spring-1.0.0-SNAPSHOT.war $RESIN_HOME/webapps/spring.war", shell=True)
  17. subprocess.check_call("$RESIN_HOME/bin/resinctl start", shell=True)
  18. return 0
  19. except subprocess.CalledProcessError:
  20. return 1
  21. def stop():
  22. try:
  23. if os.name == 'nt':
  24. subprocess.check_call('"%RESIN_HOME%\\bin\\stop.bat"', shell=True)
  25. else:
  26. subprocess.check_call("$RESIN_HOME/bin/resinctl shutdown", shell=True)
  27. return 0
  28. except subprocess.CalledProcessError:
  29. return 1