mcfearsome (owner)

Revisions

gist: 112345 Download_button fork
public
Public Clone URL: git://gist.github.com/112345.git
Embed All Files: show embed
snippet.sh #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
########
# RUBY #
########
# use readline, completion and require rubygems by default for irb
alias irb='irb --simple-prompt -r irb/completion -rubygems'
 
# really awesome function, use: cdgem <gem name>, cd's into your gems directory
# and opens gem that best matches the gem name provided
function cdgem {
  cd `gem env gemdir`/gems
  cd `ls | grep $1 | sort | tail -1`
}
function gemdoc {
  GEMDIR=`gem env gemdir`/doc
  open $GEMDIR/`ls $GEMDIR | grep $1 | sort | tail -1`/rdoc/index.html
}
function mategem {
  GEMDIR=`gem env gemdir`/gems
  mate $GEMDIR/`ls $GEMDIR | grep $1 | sort | tail -1`
}
 
#########
# RAILS #
#########
alias sc='script/console'
alias ss='script/server' # start up the beast; use "ss -d" to detach
 
# stop daemonized Rails server
function sst() {
  if [ -f tmp/pids/mongrel.pid ]; then
echo "Stopping Mongrel ..."
    kill `cat tmp/pids/mongrel.pid`
  elif [ -f tmp/pids/server.pid ]; then
echo "Stopping server ..."
    kill `cat tmp/pids/server.pid`
  fi
}
 
# restart Rails application
function sr() {
  if [ -f tmp/pids/mongrel.pid ]; then
echo "Restarting Mongrel ..."
    kill -USR2 `cat tmp/pids/mongrel.pid`
  elif [ -f tmp/pids/server.pid ]; then
echo "Restarting server ..."
    kill -USR2 `cat tmp/pids/server.pid`
  else
echo "Restarting Passenger instances ..."
    touch tmp/restart.txt
  fi
}
 
# see http://railstips.org/2007/5/31/even-edgier-than-edge-rails
function edgie() {
  ruby ~/.coral/rails/rails/railties/bin/rails $1 && cd $1 && ln -s ~/.coral/rails/rails vendor/rails
}
 
 
complete -C $HOME/.profile.d/scripts/rake_and_cap_completion.rb -o default rake
complete -C $HOME/.profile.d/scripts/rake_and_cap_completion.rb -o default cap
 
export RSPEC=true