自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

總結(jié)各種Ruby on Rails命令

開發(fā) 開發(fā)工具
Ruby on Rails命令各種各樣,掌握起來還是比較麻煩的。為此我們就幫助大家總結(jié)這些常用命令,方便大家以后查詢。

Ruby on Rails的熟練應(yīng)用可以幫助我們輕松實(shí)現(xiàn)代碼編寫,讓編程變得更加輕松。為了更進(jìn)一步了解Ruby on Rails,我們需要先從Ruby on Rails命令開始了解。#t#

51CTO推薦專題:Ruby on Rails開發(fā)教程

Ruby on Rails命令之創(chuàng)建一個(gè)Rails應(yīng)用程序
$ rails app_name
可選項(xiàng):
-d, database=xxx 指定安裝一個(gè)數(shù)據(jù)庫(mysql oracle postgresql sqlite2 sqlite3 ), 默認(rèn)情況下是數(shù)據(jù)庫
-r, ruby-path= 指定Ruby的安裝路徑,如果沒有指定,scrīpts使用env去找Ruby
-f, freeze (凍結(jié))freezes Rails在vendor/rails目錄

Ruby on Rails命令之API Documentation
$ gem_server
啟動(dòng)一個(gè)WEBrick服務(wù)器。這時(shí)候你可以通過Http://localhost:8808/ 打開瀏覽器去查看rails API文檔

Ruby on Rails命令之Rake
rake db:fixtures:load
# 載入fixtures到當(dāng)前環(huán)境的數(shù)據(jù)庫
# 載入指定的fixtures使用FIXTURES=x,y
rake db:migrate
# 遷移數(shù)據(jù)庫通過在db/migrate目錄下的腳本.可以指定版本號通過VERSION=x
rake db:schema:dump
# 創(chuàng)建一個(gè)db/schema.rb文件,通過AR能過夠支持任何數(shù)據(jù)庫去使用
rake db:schema:load
# 再入一個(gè)schema.rb文件進(jìn)數(shù)據(jù)庫
rake db:sessions:clear
# 清空sessions表
rake db:sessions:create
# 用CGI::Session::ActiveRecordStore創(chuàng)建一個(gè)sessions表為用戶
rake db:structure:dump
# 導(dǎo)出數(shù)據(jù)庫結(jié)構(gòu)為一個(gè)SQL文件
rake db:test:clone
# 重新創(chuàng)建一個(gè)測試數(shù)據(jù)庫從當(dāng)前環(huán)境數(shù)據(jù)庫中
rake db:test:clone_structure
# 重新創(chuàng)建測試數(shù)據(jù)庫從開發(fā)模式數(shù)據(jù)庫
rake db:test:prepare
# 準(zhǔn)備測試數(shù)據(jù)庫并在入schema
rake db:test:purge
# 清空測試數(shù)據(jù)庫
rake doc:app
# 創(chuàng)建HTML文件的API Documentation
rake doc:clobber_app
# 刪除Documentation
rake doc:clobber_plugins
# 刪除 plugin Documentation
rake doc:clobber_rails
# 刪除Documentation
rake doc:plugins
# 產(chǎn)生Documation為所有安裝的plugins
rake doc:rails
# 創(chuàng)建HTML文件的API Documentation
rake doc:reapp
# 強(qiáng)制重新創(chuàng)建HTML文件的API Documentation
rake doc:rerails
# 強(qiáng)制重新創(chuàng)建HTML文件的API Documentation
rake log:clear
# 清空目錄log/下的所有日志文件
rake rails:freeze:edge
# Lock this application to latest Edge Rails. Lock a specific revision with REVISION=X
rake rails:freeze:gems
# Lock this application to the current gems (by unpacking them into vendor/rails)
rake rails:unfreeze
# Unlock this application from freeze of gems or edge and return to a fluid use of system gems
rake rails:update
# Update both scrīpts and public/javascrīpts from Rails
rake rails:update:javascrīpts
# Update your javascrīpts from your current rails install
rake rails:update:scrīpts
# Add new scrīpts to the application scrīpt/ directory
rake stats
# Report code statistics (KLOCs, etc) from the application
rake test
# Test all units and functionals
rake test:functionals
# Run tests for functionalsdb:test:prepare
rake test:integration
# Run tests for integrationdb:test:prepare
rake test:plugins
# Run tests for pluginsenvironment
rake test:recent
# Run tests for recentdb:test:prepare
rake test:uncommitted
# Run tests for uncommitteddb:test:prepare
rake test:units
# Run tests for unitsdb:test:prepare
rake tmp:cache:clear
# 清空tmp/cache目錄下的所有文件
rake tmp:clear
# 清空session, cache, 和socket文件從tmp/目錄
rake tmp:create
# 為sessions, cache, and sockets創(chuàng)建tmp/目錄
rake tmp:sessions:clear
# 清空所有在tmp/sessions目錄下的文件
rake tmp:sockets:clear
# 清空所有在tmp/sessions 目錄下的ruby_sess.* 文件

Ruby on Rails命令之scrīpts
scrīpt/about
# 輸出當(dāng)前環(huán)境信息
scrīpt/breakpointer
# 啟動(dòng)斷點(diǎn)server
scrīpt/console
# 啟動(dòng)交換式的Rails控制臺(tái)
scrīpt/destroy
# 刪除通過generators創(chuàng)建的文件
scrīpt/generate
# -> generators
scrīpt/plugin
# -> Plugins
scrīpt/runner
# 執(zhí)行一個(gè)任務(wù)在rails上下文中
scrīpt/server
# 啟動(dòng)開發(fā)模式服務(wù)器http://localhost:3000
//以下幾個(gè)不知道怎么去使用
scrīpt/performance/profiler
scrīpt/performance/benchmarker
scrīpt/process/reaper
scrīpt/process/spawner

Ruby on Rails命令之Generators
ruby scrīpt/generate model ModelName
ruby scrīpt/generate controller ListController show edit
ruby scrīpt/generate scaffold ModelName ControllerName
ruby scrīpt/generate migration AddNewTable
ruby scrīpt/generate plugin PluginName
ruby scrīpt/generate mailer Notification lost_password signup
ruby scrīpt/generate web_service ServiceName api_one api_two
ruby scrīpt/generate integration_test TestName
ruby scrīpt/generate session_migration

可選項(xiàng):
-p, --pretend Run but do not make any changes.
-f, --force Overwrite files that already exist.
-s, --skip Skip files that already exist.
-q, --quiet Suppress normal output.
-t, --backtrace Debugging: show backtrace on errors.
-h, --help Show this help message.
-c, --svn Modify files with subversion. (Note: svn must be in path)

Ruby on Rails命令之Plugins
scrīpt/plugin discover
# discover plugin repositories
scrīpt/plugin list
# list all available plugins
scrīpt/plugin install where
# install the a

責(zé)任編輯:曹凱 來源: 博客園
相關(guān)推薦

2009-12-16 17:24:26

Ruby on Rai

2009-08-27 10:21:22

Ruby on Rai

2009-08-06 09:13:36

Ruby on Rai

2015-10-10 11:00:05

RubyRails性能

2009-12-16 16:37:59

Ruby on Rai

2015-10-14 17:27:18

性能

2009-12-14 15:30:43

安裝Ruby on R

2009-12-23 16:39:55

WPF命令

2010-10-09 08:58:03

NginxRuby on Rai

2009-09-29 17:04:29

2009-12-16 16:24:00

Ruby on Rai

2010-07-12 09:22:05

RubyRuby on rai

2013-03-28 12:42:02

RubyRails

2009-12-16 15:23:33

Ruby on rai

2009-12-16 15:41:10

Ruby on Rai

2009-12-16 17:37:31

Ruby on Rai

2009-12-17 17:37:42

Ruby on Rai

2010-09-25 14:39:29

Bruce Tate

2009-12-18 15:16:49

Ruby on Rai

2009-12-14 15:37:35

Ruby on Rai
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號