| ... | ... |
@@ -1,10 +1,30 @@ |
| 1 |
-alias rs='ruby script/rails server' |
|
| 2 |
-alias rg='ruby script/rails generate' |
|
| 3 |
-alias rd='ruby script/rails destroy' |
|
| 4 |
-alias rp='ruby script/rails plugin' |
|
| 1 |
+# Rails 3 aliases, backwards-compatible with Rails 2. |
|
| 2 |
+ |
|
| 3 |
+function _bundle_command {
|
|
| 4 |
+ if command -v bundle && [ -e "Gemfile" ]; then |
|
| 5 |
+ bundle exec $@ |
|
| 6 |
+ else |
|
| 7 |
+ $@ |
|
| 8 |
+ fi |
|
| 9 |
+} |
|
| 10 |
+ |
|
| 11 |
+function _rails_command () {
|
|
| 12 |
+ if [ -e "script/server" ]; then |
|
| 13 |
+ ruby script/$@ |
|
| 14 |
+ else |
|
| 15 |
+ ruby script/rails $@ |
|
| 16 |
+ fi |
|
| 17 |
+} |
|
| 18 |
+ |
|
| 19 |
+alias rc='_rails_command console' |
|
| 20 |
+alias rd='_rails_command destroy' |
|
| 21 |
+alias rdb='_rails_command dbconsole' |
|
| 5 | 22 |
alias rdbm='rake db:migrate db:test:clone' |
| 6 |
-alias rdbmr='rake db:migrate && rake db:migrate:redo' |
|
| 7 |
-alias rc='ruby script/rails console' |
|
| 8 |
-alias rd='ruby script/rails server --debugger' |
|
| 23 |
+alias rg='_rails_command generate' |
|
| 24 |
+alias rp='_rails_command plugin' |
|
| 25 |
+alias rs='_rails_command server' |
|
| 26 |
+alias rsd='_rails_command server --debugger' |
|
| 9 | 27 |
alias devlog='tail -f log/development.log' |
| 10 | 28 |
|
| 29 |
+alias rspec='_bundle_command rspec' |
|
| 30 |
+alias cuke='_bundle_command cucumber' |