Difference between revisions of "Code"

From mx Help Wiki
Jump to: navigation, search
m (Add a number of empty lots)
Line 2: Line 2:
  
  
== Console! ==
+
=== Console! ===
  
 
  ruby script/console <environment>
 
  ruby script/console <environment>
Line 17: Line 17:
 
  r += 1
 
  r += 1
 
  end
 
  end
 +
 +
=== Krishna's notes on setting up MySQL/Mongrel/Apache2 on OS 10.3.9 ===
 +
 +
follow the macports installation instructions here: http://trac.macosforge.org/projects/macports/wiki/InstallingMacPorts
 +
except i set $PATH in /etc/profile with
 +
  export PATH=/opt/local/bin:/opt/local/sbin:$PATH
 +
 +
then
 +
  sudo port selfupdate
 +
 +
  sudo port install gperf
 +
(ran into errors with "gperf: invalid option -- m" before doing this)
 +
 +
  sudo port install rb-termios
 +
(crashed installing ruby, but not needed)
 +
 +
  sudo port install autoconf
 +
(ran into old version issue before doing this)
 +
 +
  sudo port install apache2
 +
add the "APACHE2=-YES-" line to /etc/hostconfig as instructed
 +
added following to /etc/profile
 +
  PATH="/opt/local/apache2/bin:$PATH"
 +
copied httpd.conf.example to httpd.conf
 +
added proxy section:
 +
 +
 +
uncommented vhost.conf include
 +
 +
in extra/vhost
 +
 +
  <Directory "/Library/Rails/mx/current/public">
 +
  Options FollowSymLinks
 +
  AllowOverride None
 +
  Order allow,deny
 +
  Allow from all
 +
  </Directory>
 +
 +
RewriteEngine On
 +
RewriteRule ^/$ /index.html [QSA]
 +
RewriteRule ^([^.]+)$ $1.html [QSA]
 +
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
 +
RewriteRule ^/(.*)$ balancer://mongrel_cluster%{REQUEST_URI} [P,QSA,L]
 +
 +
 +
presuming rails and rake are installed, do:
 +
  sudo gem install --include-dependencies termios
 +
  sudo gem install --include-dependencies capistrano
 +
  sudo gem install --include-dependencies mongrel
 +
  sudo gem install --include-dependencies mongrel_cluster
 +
 +
 +
 +
Note: if capistrano hangs, try reinstalling ruby as described here:
 +
http://weblog.jamisbuck.org/2005/9/24/switchtower-on-osx
 +
 +
if you get 'command not found' errors, try setting the ssh env as in:
 +
http://forum.textdrive.com/viewtopic.php?id=12629
 +
 +
 +
sudo  mongrel_rails cluster::start -C /Library/Rails/mx/current/config/mongrel_cluster.yml

Revision as of 10:15, 20 March 2007

Contents

A whiteboard for Code snippets, notes, etc. that might otherwise be lost or might be useful down the road, etc.

Console!

ruby script/console <environment>

Add a number of empty lots

$person_id = 2
$proj_id = 51
@proj = Proj.find(51)
r = 0
while r < 800 do
l = Lot.new(:otu_id => 8222, :key_specimens => 999, :rarity => "", :source_quality => "", :notes => 'Auto-created for ETOH move.')
l.save!
r += 1
end

Krishna's notes on setting up MySQL/Mongrel/Apache2 on OS 10.3.9

follow the macports installation instructions here: http://trac.macosforge.org/projects/macports/wiki/InstallingMacPorts except i set $PATH in /etc/profile with

 export PATH=/opt/local/bin:/opt/local/sbin:$PATH

then

 sudo port selfupdate
 sudo port install gperf

(ran into errors with "gperf: invalid option -- m" before doing this)

 sudo port install rb-termios

(crashed installing ruby, but not needed)

 sudo port install autoconf

(ran into old version issue before doing this)

 sudo port install apache2

add the "APACHE2=-YES-" line to /etc/hostconfig as instructed added following to /etc/profile

 PATH="/opt/local/apache2/bin:$PATH"

copied httpd.conf.example to httpd.conf added proxy section:


uncommented vhost.conf include

in extra/vhost

 <Directory "/Library/Rails/mx/current/public">
 Options FollowSymLinks
 AllowOverride None
 Order allow,deny
 Allow from all
 </Directory>

RewriteEngine On RewriteRule ^/$ /index.html [QSA] RewriteRule ^([^.]+)$ $1.html [QSA] RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f RewriteRule ^/(.*)$ balancer://mongrel_cluster%{REQUEST_URI} [P,QSA,L]


presuming rails and rake are installed, do:

 sudo gem install --include-dependencies termios
 sudo gem install --include-dependencies capistrano
 sudo gem install --include-dependencies mongrel
 sudo gem install --include-dependencies mongrel_cluster


Note: if capistrano hangs, try reinstalling ruby as described here: http://weblog.jamisbuck.org/2005/9/24/switchtower-on-osx

if you get 'command not found' errors, try setting the ssh env as in: http://forum.textdrive.com/viewtopic.php?id=12629


sudo mongrel_rails cluster::start -C /Library/Rails/mx/current/config/mongrel_cluster.yml

Personal tools