Skip to content

Instantly share code, notes, and snippets.

@jackdempsey
Created September 27, 2010 19:04
Show Gist options
  • Save jackdempsey/599611 to your computer and use it in GitHub Desktop.
Save jackdempsey/599611 to your computer and use it in GitHub Desktop.
~ > cat ~/bin/switch
#!/bin/sh
sudo ln -s -f /etc/apache2/other/passenger_ruby_$1.config /etc/apache2/other/passenger_active.conf
rvm $1 --passenger
sudo apachectl restart
########## in /etc/apache2/other #############
apache2/other > ls -l
total 32
-r--r--r-- 1 root wheel 73B May 18 2009 bonjour.conf
-rw-r--r-- 1 root wheel 120B Sep 26 13:18 passenger.conf
lrwxr-xr-x 1 root wheel 44B Sep 27 15:02 passenger_active.conf@ -> /etc/apache2/other/passenger_ruby_1.9.2.config
-rw-r--r-- 1 root wheel 241B Sep 26 13:18 passenger_ruby_1.8.7.config
-rw-r--r-- 1 root wheel 254B Sep 26 14:38 passenger_ruby_1.9.2.config
###### configs look like ##########
apache2/other > cat /etc/apache2/other/passenger_ruby_1.8.7.config
LoadModule passenger_module /Users/jack/.rvm/gems/ruby-1.8.7-p248/gems/passenger-2.2.15/ext/apache2/mod_passenger.so
PassengerRoot /Users/jack/.rvm/gems/ruby-1.8.7-p248/gems/passenger-2.2.15
PassengerRuby /Users/jack/.rvm/bin/passenger_ruby
########## usage ##########
apache2/other > switch 1.8.7
apache2/other > ls -l
total 32
-r--r--r-- 1 root wheel 73B May 18 2009 bonjour.conf
-rw-r--r-- 1 root wheel 120B Sep 26 13:18 passenger.conf
lrwxr-xr-x 1 root wheel 44B Sep 27 15:03 passenger_active.conf@ -> /etc/apache2/other/passenger_ruby_1.8.7.config
-rw-r--r-- 1 root wheel 241B Sep 26 13:18 passenger_ruby_1.8.7.config
-rw-r--r-- 1 root wheel 254B Sep 26 14:38 passenger_ruby_1.9.2.config
I have includes in apache set to include conf files in other: other/*.conf
This has made jumping around a between various versions of ruby with passenger a bit nicer/easier
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment