Posted By

draq on 04/18/10


Tagged

rails gnome terminals


Versions (?)

Gnome Terminals for Rails


 / Published in: Bash
 

  1. #!/bin/bash
  2.  
  3. # Rails Terminals for Rails 2.3.5 and Gnome
  4. # A simple script that opens a Gnome terminal with titled tabs:
  5. # 1. Server
  6. # 2. Autospec
  7. # 3. Vim with NERDTree
  8. # 4. bash
  9. # USAGE: railsterminal.sh working_dir
  10.  
  11. dir=$1 # The first argument is the path of the working directory.
  12.  
  13. if [ -z $dir ]; then
  14. echo "Please specify an argument!"
  15. exit
  16. fi
  17.  
  18. # Check whether the executables exist and open the terminals
  19. if [ -d $dir ]; then
  20.  
  21. # If the argument is a relative path, then augment it with
  22. # the current dir.
  23. if [ ${dir:0:1} != '~' -a ${dir:0:1} != '/' ]; then
  24. dir=`pwd`'/'$dir
  25. fi
  26. echo "Working directory: $dir"
  27.  
  28. command="gnome-terminal --working-directory=$dir --geometry=112x30 "
  29. tab1="--tab -e";tab2="-t"
  30. if [ -x "$dir/script/server" ]; then
  31. server_e="bash -c 'script/server && bash'"
  32. else
  33. server_e='bash'
  34. echo "script/server not found."
  35. fi
  36. if [ -x "$dir/script/autospec" ]; then
  37. autospec_e="script/autospec"
  38. else
  39. autospec_e='bash'
  40. echo "script/autospec not found."
  41. fi
  42. server_t="Server";autospec_t="Autospec"
  43. bash_e="bash";bash_t="Bash"
  44. vim_e="vi +NERDTree";vim_t="Vim"
  45.  
  46. echo $command $tab1 "$server_e" $tab2 $server_t \
  47. $tab1 "$autospec_e" $tab2 $autospec_t \
  48. $tab1 "$vim_e" $tab2 $vim_t \
  49. $tab1 "$bash_e" $tab2 $bash_t
  50.  
  51. $command $tab1 "$server_e" $tab2 $server_t \
  52. $tab1 "$autospec_e" $tab2 $autospec_t \
  53. $tab1 "$vim_e" $tab2 $vim_t \
  54. $tab1 "$bash_e" $tab2 $bash_t
  55.  
  56. else
  57. echo "Please specify a working directory as the argument"
  58. fi

Report this snippet  

You need to login to post a comment.