Posted By

chrisaiv on 03/19/10


Tagged

Bash rails


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

octoberborn
NARKOZ


Rails: Commands I wish I could remember


 / Published in: Rails
 

URL: http://support.tigertech.net/freeze-rails#2

  1. ###############################
  2. #Generating a Model
  3. ###############################
  4. #Generate a new User Model
  5. ruby script/generate model User
  6.  
  7. ###############################
  8. #Generating a Controller
  9. ###############################
  10. #Generate a new controller with html page
  11. ruby script/generate controller <ControllerName> [optional actions]
  12. ruby script/generate controller Site index help about
  13.  
  14. ###############################
  15. #Out of the box helper methods
  16. ###############################
  17. #HREF's
  18. link_to "Home", :action => "index"
  19. <%= link_to_unless_current "Home", { :action => "index"}, { :id => "home" } %>
  20. link_to_if
  21. link_to_image
  22. link_to_remote
  23. link_to_unless
  24.  
  25. ###############################
  26. #Rails Testing
  27. ###############################
  28. #Test a controller using functional tests
  29. ruby -Itest test/functional/nameOfController_controller.rb
  30.  
  31. #Prepare a project for Rails testing by copying the db dev env into test db
  32. rake db:test:prepare
  33.  
  34. #Test a model through unit
  35. rake test:units
  36.  
  37. #Run both functional tests and unit tests
  38. rake
  39.  
  40. #Check out your code to test ratios
  41. rake stats
  42.  
  43. ###############################
  44. #BASH Commands
  45. ###############################
  46. #Setting MySQL in your environment variables
  47. echo 'export PATH=/usr/local/mysql/bin:$PATH' >> ~/.bash_profile
  48.  
  49. #Update rails
  50. gem update rails
  51. gem update rails --include-dependencies
  52.  
  53. #Install MySQL adaptor for Rails +2.2 for OSX 10.5
  54. gem install mysql --include-dependencies
  55.  
  56. #Install MySQL adaptor for Rails +2.2 for OSX 10.6 (This is for Intel Core 2 Duo Macs)
  57. #If you hit trouble with OsX10.6.6 -> http://stackoverflow.com/questions/4605659/mysql-wont-start-on-mac-osx
  58. sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
  59.  
  60. #Install MySQL adaptor for Rails +2.2 for OSX 10.4 (32-bit or Indtel Core Duo Macs)
  61. sudo env ARCHFLAGS="-arch i386" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
  62.  
  63. #Update Gem System
  64. gem update --system
  65.  
  66. ###############################
  67. #Capistrano
  68. ###############################
  69. $ capify /path/to/rails/application/

Report this snippet  

You need to login to post a comment.