Browse Source

Updated RingoJS

I am not super-happy with this as it requires the runner
to have sudo privileges, but since the current suite is
allowing it, I have no choice. In the future, we should
make an effort to disallow sudo in framework scripts if
possible.
msmith-techempower 10 years ago
parent
commit
67489ddd70

+ 0 - 34
frameworks/JavaScript/ringojs-convenient/setup.py

@@ -1,34 +0,0 @@
-
-import subprocess
-import sys
-import setup_util
-import os
-
-def start(args, logfile, errfile):
-  setup_util.replace_text("ringojs-convenient/app/models.js", "dbHost = '.*';", "dbHost = '" + args.database_host + "';")
-
-  try:
-
-    subprocess.check_call("sudo rm -rf /usr/share/ringojs/packages/*", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.check_call("sudo ringo-admin install oberhamsi/sql-ringojs-client", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.check_call("sudo ringo-admin install grob/ringo-sqlstore", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.check_call("sudo ringo-admin install ringo/stick", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.check_call("sudo ringo-admin install oberhamsi/reinhardt", shell=True, stderr=errfile, stdout=logfile)
-
-    subprocess.check_call("sudo mkdir -p /usr/share/ringojs/packages/ringo-sqlstore/jars/", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.check_call("sudo cp /usr/share/ringojs//packages/sql-ringojs-client/jars/mysql.jar /usr/share/ringojs/packages/ringo-sqlstore/jars/", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.Popen("ringo --production -J-server -J-Xmx1g -J-Xms1g ringo-main.js", shell=True, cwd="ringojs-convenient", stderr=errfile, stdout=logfile)
-    return 0
-  except subprocess.CalledProcessError:
-    return 1
-def stop(logfile, errfile):
-  p = subprocess.Popen(['ps', 'aux'], stdout=subprocess.PIPE)
-  out, err = p.communicate()
-  for line in out.splitlines():
-    if 'ringo-main.js' in line:
-      pid = int(line.split(None, 2)[1])
-      try:
-        os.kill(pid, 15)
-      except OSError:
-        pass
-  return 0

+ 13 - 0
frameworks/JavaScript/ringojs-convenient/setup.sh

@@ -0,0 +1,13 @@
+#!/bin/bash
+
+sed -i 's|dbHost = \x27.*\x27;|dbHost = \x27'"${DBHOST}"'\x27|g' app/models.js
+
+sudo rm -rf /usr/share/ringojs/packages/*
+sudo ringo-admin install oberhamsi/sql-ringojs-client
+sudo ringo-admin install grob/ringo-sqlstore
+sudo ringo-admin install ringo/stick
+sudo ringo-admin install oberhamsi/reinhardt
+
+sudo mkdir -p /usr/share/ringojs/packages/ringo-sqlstore/jars/
+sudo cp /usr/share/ringojs//packages/sql-ringojs-client/jars/mysql.jar /usr/share/ringojs/packages/ringo-sqlstore/jars/
+ringo --production -J-server -J-Xmx1g -J-Xms1g ringo-main.js &

+ 0 - 27
frameworks/JavaScript/ringojs/setup.py

@@ -1,27 +0,0 @@
-
-import subprocess
-import sys
-import setup_util
-import os
-
-def start(args, logfile, errfile):
-  setup_util.replace_text("ringojs/ringo-main.js", "dbHost = '.*';", "dbHost = '" + args.database_host + "';")
-
-  try:
-    subprocess.check_call("sudo rm -rf /usr/share/ringojs/packages/*", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.check_call("sudo ringo-admin install oberhamsi/sql-ringojs-client", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.Popen("ringo --production -J-server -J-Xmx1g -J-Xms1g ringo-main.js", shell=True, cwd="ringojs", stderr=errfile, stdout=logfile)
-    return 0
-  except subprocess.CalledProcessError:
-    return 1
-def stop(logfile, errfile):
-  p = subprocess.Popen(['ps', 'aux'], stdout=subprocess.PIPE)
-  out, err = p.communicate()
-  for line in out.splitlines():
-    if 'ringo-main.js' in line:
-      pid = int(line.split(None, 2)[1])
-      try:
-        os.kill(pid, 15)
-      except OSError:
-        pass
-  return 0

+ 7 - 0
frameworks/JavaScript/ringojs/setup.sh

@@ -0,0 +1,7 @@
+#!/bin/bash
+
+sed -i 's|dbHost = \x27.*\x27;|dbHost = \x27'"${DBHOST}"'\x27|g' ringo-main.js
+
+sudo rm -rf /usr/share/ringojs/packages/*
+sudo ringo-admin install oberhamsi/sql-ringojs-client
+ringo --production -J-server -J-Xmx1g -J-Xms1g ringo-main.js &