ror命令大全

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