Commits

Bożydar Sobczak  committed 52a0db5

refactor: Using rvm-gem to avoid hardcoded paths to rvm

  • Participants
  • Parent commits a46b0ac

Comments (0)

Files changed (3)

 syntax: glob
 *~
 *.kate-swp
+*.swp

File app0/app0.god

+require 'rvm'
+gemset = 'ruby-1.9.3-p194@app0'
+
+env = RVM.environment(gemset).info[gemset]['environment']
+
 God.watch do |w|
   w.name = "app0"
-  
-  gemsets_path = [
-        "/home/bozydar/.rvm/gems/ruby-1.9.3-p194@app0/bin",
-        "/home/bozydar/.rvm/gems/ruby-1.9.3-p194@global/bin/",
-        "/home/bozydar/.rvm/rubies/ruby-1.9.3-p194/bin",
-        "/home/bozydar/.rvm/bin",
-        ENV['PATH'] # inherit this
-    ].join(':')
-
-  w.env      = {
-    "PATH"        => gemsets_path,
-        "GEM_PATH"    => 
-	  ["/home/bozydar/.rvm/gems/ruby-1.9.3-p194@app0",
-	   "/home/bozydar/.rvm/gems/ruby-1.9.3-p194@global"
-	  ].join(":")
+  w.env = {
+      "PATH"        => env['PATH'],
+      "GEM_PATH"    => env['GEM_PATH'] 
     }
   w.dir = "/home/bozydar/workspaces/god-research/app0"
   w.start = "rackup"
   w.keepalive
-end
+end

File app1/app1.god

+require 'rvm'
+gemset = 'ree-1.8.7-2011.03@app1' 
+
+env = RVM.environment(gemset).info[gemset]['environment']
+
 God.watch do |w|
   w.name = "app1"
-  
-  gemsets_path = [
-        "/home/bozydar/.rvm/gems/ree-1.8.7-2011.03@app1/bin",
-        "/home/bozydar/.rvm/gems/ree-1.8.7-2011.03@global/bin/",
-        "/home/bozydar/.rvm/rubies/ree-1.8.7-2011.03/bin",
-        "/home/bozydar/.rvm/bin",
-        ENV['PATH'] # inherit this
-    ].join(':')
 
-  w.env      = {
-    "PATH"        => gemsets_path,
-        "GEM_PATH"    => 
-	  ["/home/bozydar/.rvm/gems/ree-1.8.7-2011.03@app1",
-	   "/home/bozydar/.rvm/gems/ree-1.8.7-2011.03@global"
-	  ].join(":")
+  w.env = {
+    "PATH" => env['PATH'],
+    "GEM_PATH" => env['GEM_PATH'] 
     }
   w.dir = "/home/bozydar/workspaces/god-research/app1"
   w.start = "rackup -p 9293"
   w.keepalive
-end
+end