ITPub博客

首页 > 应用开发 > IT综合 > Rails程序用到的一些脚本命令

Rails程序用到的一些脚本命令

原创 IT综合 作者:CharlesCui 时间:2008-07-28 11:51:40 0 删除 编辑
  1. 一.铁道
  2. 1.1 创建一个Rails应用程序
  3. $ rails app_name
  4. 可选项:
  5. -d, database=xxx 指定安装一个数据库(mysql oracle postgresql sqlite2 sqlite3 ), 默认情况下是数据库
  6. -r, ruby-path= 指定Ruby的安装路径,如果没有指定,scripts使用env去找Ruby
  7. -f, freeze (冻结)freezes Rails在vendor/rails目录
  8. 1.2 API Documentation
  9. $ gem_server
  10. 启动一个WEBrick服务器。这时候你可以通过Http://localhost:8808/ 打开浏览器去查看rails API文档
  11. 1.3 Rake
  12. rake db:fixtures:load
  13. # 载入fixtures到当前环境的数据库
  14. # 载入指定的fixtures使用FIXTURES=x,y
  15. rake db:migrate
  16. # 迁移数据库通过在db/migrate目录下的脚本.可以指定版本号通过VERSION=x
  17. rake db:schema:dump
  18. # 创建一个db/schema.rb文件,通过AR能过够支持任何数据库去使用
  19. rake db:schema:load
  20. # 再入一个schema.rb文件进数据库
  21. rake db:sessions:clear
  22. # 清空sessions表
  23. rake db:sessions:create
  24. # 用CGI::Session::ActiveRecordStore创建一个sessions表为用户
  25. rake db:structure:dump
  26. # 导出数据库结构为一个SQL文件
  27. rake db:test:clone
  28. # 重新创建一个测试数据库从当前环境数据库中
  29. rake db:test:clone_structure
  30. # 重新创建测试数据库从开发模式数据库
  31. rake db:test:prepare
  32. # 准备测试数据库并在入schema
  33. rake db:test:purge
  34. # 清空测试数据库
  35. rake doc:app
  36. # 创建HTML文件的API Documentation
  37. rake doc:clobber_app
  38. # 删除Documentation
  39. rake doc:clobber_plugins
  40. # 删除 plugin Documentation
  41. rake doc:clobber_rails
  42. # 删除Documentation
  43. rake doc:plugins
  44. # 产生Documation为所有安装的plugins
  45. rake doc:rails
  46. # 创建HTML文件的API Documentation
  47. rake doc:reapp
  48. # 强制重新创建HTML文件的API Documentation
  49. rake doc:rerails
  50. # 强制重新创建HTML文件的API Documentation
  51. rake log:clear
  52. # 清空目录log/下的所有日志文件
  53. rake rails:freeze:edge
  54. # Lock this application to latest Edge Rails. Lock a specific revision with REVISION=X
  55. rake rails:freeze:gems
  56. # Lock this application to the current gems (by unpacking them into vendor/rails)
  57. rake rails:unfreeze
  58. # Unlock this application from freeze of gems or edge and return to a fluid use of system gems
  59. rake rails:update
  60. # Update both scripts and public/javascripts from Rails
  61. rake rails:update:javascripts
  62. # Update your javascripts from your current rails install
  63. rake rails:update:scripts
  64. # Add new scripts to the application script/ directory
  65. rake stats
  66. # Report code statistics (KLOCs, etc) from the application
  67. rake test
  68. # Test all units and functionals
  69. rake test:functionals
  70. # Run tests for functionalsdb:test:prepare
  71. rake test:integration
  72. # Run tests for integrationdb:test:prepare
  73. rake test:plugins
  74. # Run tests for pluginsenvironment
  75. rake test:recent
  76. # Run tests for recentdb:test:prepare
  77. rake test:uncommitted
  78. # Run tests for uncommitteddb:test:prepare
  79. rake test:units
  80. # Run tests for unitsdb:test:prepare
  81. rake tmp:cache:clear
  82. # 清空tmp/cache目录下的所有文件
  83. rake tmp:clear
  84. # 清空session, cache, 和socket文件从tmp/目录
  85. rake tmp:create
  86. # 为sessions, cache, and sockets创建tmp/目录
  87. rake tmp:sessions:clear
  88. # 清空所有在tmp/sessions目录下的文件
  89. rake tmp:sockets:clear
  90. # 清空所有在tmp/sessions 目录下的ruby_sess.* 文件
  91. 1.4 Scripts
  92. script/about
  93. # 输出当前环境信息
  94. script/breakpointer
  95. # 启动断点server
  96. script/console
  97. # 启动交换式的Rails控制台
  98. script/destroy
  99. # 删除通过generators创建的文件
  100. script/generate
  101. # -> generators
  102. script/plugin
  103. # -> Plugins
  104. script/runner
  105. # 执行一个任务在rails上下文中
  106. script/server
  107. # 启动开发模式服务器http://localhost:3000
  108. //以下几个不知道怎么去使用
  109. script/performance/profiler
  110. script/performance/benchmarker
  111. script/process/reaper
  112. script/process/spawner
  113. 1.5 Generators
  114. ruby script/generate model ModelName
  115. ruby script/generate controller ListController show edit
  116. ruby script/generate scaffold ModelName ControllerName
  117. ruby script/generate migration AddNewTable
  118. ruby script/generate plugin PluginName
  119. ruby script/generate mailer Notification lost_password signup
  120. ruby script/generate web_service ServiceName api_one api_two
  121. ruby script/generate integration_test TestName
  122. ruby script/generate session_migration
  123. 可选项:
  124. -p, --pretend Run but do not make any changes.
  125. -f, --force Overwrite files that already exist.
  126. -s, --skip Skip files that already exist.
  127. -q, --quiet Suppress normal output.
  128. -t, --backtrace Debugging: show backtrace on errors.
  129. -h, --help Show this help message.
  130. -c, --svn Modify files with subversion. (Note: svn must be in path)
  131. 1.6 Plugins
  132. script/plugin discover
  133. # discover plugin repositories
  134. script/plugin list
  135. # list all available plugins
  136. script/plugin install where
  137. # install the a

    来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/9934490/viewspace-1007958/,如需转载,请注明出处,否则将追究法律责任。

上一篇: Rails动态find_by
请登录后发表评论 登录
全部评论
  • 博文量
    52
  • 访问量
    265787