Browse Source

Cleanup rails-stripped

Hamilton Turner 11 years ago
parent
commit
2f96a1631d

+ 7 - 0
frameworks/Ruby/rails-stripped/bash_profile.sh

@@ -0,0 +1,7 @@
+#!/bin/bash
+
+# We assume single-user installation as 
+# done in our rvm.sh script and 
+# in Travis-CI
+source $HOME/.rvm/scripts/rvm
+

+ 7 - 1
frameworks/Ruby/rails-stripped/install.sh

@@ -1,3 +1,9 @@
 #!/bin/bash
 
-fw_depends ruby
+fw_depends rvm nginx java
+
+rvm install ruby-2.0.0-p0
+rvm ruby-2.0.0-p0 do bundle install --gemfile=$TROOT/Gemfile-ruby
+
+rvm install jruby-1.7.8
+rvm jruby-1.7.8 do bundle install --gemfile=$TROOT/Gemfile-jruby

+ 0 - 1
frameworks/Ruby/rails-stripped/setup_jruby.py

@@ -8,7 +8,6 @@ def start(args, logfile, errfile):
   setup_util.replace_text("rails-stripped/config/database.yml", "host: .*", "host: " + args.database_host)
 
   try:
-    subprocess.check_call("rvm jruby-1.7.8 do bundle install --gemfile=Gemfile-jruby", shell=True, cwd="rails-stripped", stderr=errfile, stdout=logfile)
     subprocess.check_call("cp Gemfile-jruby Gemfile", shell=True, cwd="rails-stripped", stderr=errfile, stdout=logfile)
     subprocess.check_call("cp Gemfile-jruby.lock Gemfile.lock", shell=True, cwd="rails-stripped", stderr=errfile, stdout=logfile)
     subprocess.Popen("rvm jruby-1.7.8 do bundle exec torqbox -b 0.0.0.0 -E production", shell=True, cwd="rails-stripped", stderr=errfile, stdout=logfile)

+ 3 - 8
frameworks/Ruby/rails-stripped/setup_ruby.py

@@ -4,23 +4,19 @@ import sys
 import re
 import os
 import setup_util
-from os.path import expanduser
-
-home = expanduser("~")
 
 def start(args, logfile, errfile):
   setup_util.replace_text("rails-stripped/config/database.yml", "host: .*", "host: " + args.database_host)
   try:
-    subprocess.check_call("rvm ruby-2.0.0-p0 do bundle install --gemfile=Gemfile-ruby", shell=True, cwd="rails-stripped", stderr=errfile, stdout=logfile)
     subprocess.check_call("cp Gemfile-ruby Gemfile", shell=True, cwd="rails-stripped", stderr=errfile, stdout=logfile)
     subprocess.check_call("cp Gemfile-ruby.lock Gemfile.lock", shell=True, cwd="rails-stripped", stderr=errfile, stdout=logfile)
-    subprocess.check_call("sudo /usr/local/nginx/sbin/nginx -c " + home + "/FrameworkBenchmarks/rails-stripped/config/nginx.conf", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.Popen("rvm ruby-2.0.0-p0 do bundle exec unicorn_rails -E production -c config/unicorn.rb", shell=True, cwd="rails-stripped", stderr=errfile, stdout=logfile)
+    subprocess.check_call("sudo /usr/local/nginx/sbin/nginx -c $TROOT/config/nginx.conf", shell=True, stderr=errfile, stdout=logfile)
+    subprocess.Popen("rvm ruby-2.0.0-p0 do bundle exec unicorn_rails -E production -c $TROOT/config/unicorn.rb", shell=True, cwd="rails-stripped", stderr=errfile, stdout=logfile)
     return 0
   except subprocess.CalledProcessError:
     return 1
 def stop(logfile, errfile):
-  subprocess.call("sudo /usr/local/nginx/sbin/nginx -s stop", shell=True, stderr=errfile, stdout=logfile)
+  subprocess.call("sudo /usr/local/nginx/sbin/nginx -c $TROOT/config/nginx.conf -s stop", shell=True, stderr=errfile, stdout=logfile)
   try:
     p = subprocess.Popen(['ps', 'aux'], stdout=subprocess.PIPE)
     out, err = p.communicate()
@@ -28,7 +24,6 @@ def stop(logfile, errfile):
       if 'unicorn' in line and 'master' in line:
         pid = int(line.split(None, 2)[1])
         os.kill(pid, 15)
-    # subprocess.check_call("rvm ruby-2.0.0-p0 do bundle exec passenger stop --pid-file=$HOME/FrameworkBenchmarks/rack/rack.pid", shell=True, cwd='rack')
     subprocess.check_call("rm Gemfile", shell=True, cwd="rails-stripped", stderr=errfile, stdout=logfile)
     subprocess.check_call("rm Gemfile.lock", shell=True, cwd="rails-stripped", stderr=errfile, stdout=logfile)
     return 0