×¢²á | µÇ¼ Íü¼ÇÃÜÂ룿 51ctoÊ×Ò³ | ²©¿Í | ÂÛ̳ | ÕÐÆ¸
ÈȵãÎÄÕ [ÒµÄÚ´«ÎÅ]½ñÌ죬7ÔÂ25ÈÕ..
¡¡°ïÖú

Ruby on Rails Command Rerference


2007-04-03 02:28:12
1.1.Rails
1.1 ´´½¨Ò»¸öRailsÓ¦ÓóÌÐò
 $ rails app_name
 ¿ÉÑ¡Ïî:
 -d, database=xxx Ö¸¶¨°²×°Ò»¸öÊý¾Ý¿â(mysql oracle postgresql sqlite2 sqlite3 ), ĬÈÏÇé¿öÏÂÊÇÊý¾Ý¿â
 -r, ruby-path= Ö¸¶¨RubyµÄ°²×°Â·¾¶,Èç¹ûûÓÐÖ¸¶¨£¬scriptsʹÓÃenvÈ¥ÕÒRuby
 -f, freeze (¶³½á)freezes RailsÔÚvendor/railsĿ¼
1.2 API Documentation
 $ gem_server
 Æô¶¯Ò»¸öWEBrick·þÎñÆ÷¡£ÕâʱºòÄã¿ÉÒÔͨ¹ýHttp://localhost:8808/ ´ò¿ªä¯ÀÀÆ÷È¥²é¿´rails APIÎĵµ
1.3 Rake
 rake db:fixtures:load
  # ÔØÈëfixturesµ½µ±Ç°»·¾³µÄÊý¾Ý¿â
  # ÔØÈëÖ¸¶¨µÄfixturesʹÓÃFIXTURES=x,y
 rake db:migrate
 # Ç¨ÒÆÊý¾Ý¿âͨ¹ýÔÚdb/migrateĿ¼ÏµĽű¾.¿ÉÒÔÖ¸¶¨°æ±¾ºÅͨ¹ýVERSION=x
 rake db:schema:dump
 # ´´½¨Ò»¸ödb/schema.rbÎļþ£¬Í¨¹ýARÄܹý¹»Ö§³ÖÈκÎÊý¾Ý¿âȥʹÓÃ
 rake db:schema:load
 # ÔÙÈëÒ»¸öschema.rbÎļþ½øÊý¾Ý¿â
 rake db:sessions:clear
 # Çå¿Õsessions±í
 rake db:sessions:create
 # ÓÃCGI::Session::ActiveRecordStore´´½¨Ò»¸ösessions±íΪÓû§
 rake db:structure:dump
 # µ¼³öÊý¾Ý¿â½á¹¹ÎªÒ»¸öSQLÎļþ
 rake db:test:clone
 # ÖØÐ´´½¨Ò»¸ö²âÊÔÊý¾Ý¿â´Óµ±Ç°»·¾³Êý¾Ý¿âÖÐ
 rake db:test:clone_structure
 # ÖØÐ´´½¨²âÊÔÊý¾Ý¿â´Ó¿ª·¢Ä£Ê½Êý¾Ý¿â
 rake db:test:prepare
 # ×¼±¸²âÊÔÊý¾Ý¿â²¢ÔÚÈëschema
 rake db:test:purge
 # Çå¿Õ²âÊÔÊý¾Ý¿â
 rake doc:app
 # ´´½¨HTMLÎļþµÄAPI Documentation
 rake doc:clobber_app
 # ɾ³ýDocumentation
 rake doc:clobber_plugins
 # ɾ³ý plugin Documentation
 rake doc:clobber_rails
 # ɾ³ýDocumentation
 rake doc:plugins
 # ²úÉúDocumationΪËùÓа²×°µÄplugins
 rake doc:rails
 # ´´½¨HTMLÎļþµÄAPI Documentation
 rake doc:reapp
 # Ç¿ÖÆÖØÐ´´½¨HTMLÎļþµÄAPI Documentation
 rake doc:rerails
 # Ç¿ÖÆÖØÐ´´½¨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 scripts and public/javascripts from Rails
 rake rails:update:javascripts
 # Update your javascripts from your current rails install
 rake rails:update:scripts
 # Add new scripts to the application script/ 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´´½¨tmp/Ŀ¼
 rake tmp:sessions:clear
 # Çå¿ÕËùÓÐÔÚtmp/sessionsĿ¼ÏµÄÎļþ
 rake tmp:sockets:clear
 # Çå¿ÕËùÓÐÔÚtmp/sessions Ŀ¼ÏµÄruby_sess.* Îļþ
1.4 Scripts
 script/about
 # Êä³öµ±Ç°»·¾³ÐÅÏ¢
 script/breakpointer
 # Æô¶¯¶Ïµãserver
 script/console
 # Æô¶¯½»»»Ê½µÄRails¿ØÖÆÌ¨
 script/destroy
 # ɾ³ýͨ¹ýgenerators´´½¨µÄÎļþ
 script/generate
 # -> generators
 script/plugin
 # -> Plugins
 script/runner
 # Ö´ÐÐÒ»¸öÈÎÎñÔÚrailsÉÏÏÂÎÄÖÐ
 script/server
 # Æô¶¯¿ª·¢Ä£Ê½·þÎñÆ÷http://localhost:3000
 //ÒÔϼ¸¸ö²»ÖªµÀÔõôȥʹÓÃ
 script/performance/profiler
 script/performance/benchmarker
 script/process/reaper
 script/process/spawner
1.5 Generators
 ruby script/generate model ModelName
 ruby script/generate controller ListController show edit
 ruby script/generate scaffold ModelName ControllerName
 ruby script/generate migration AddNewTable
 ruby script/generate plugin PluginName
 ruby script/generate mailer Notification lost_password signup
 ruby script/generate web_service ServiceName api_one api_two
 ruby script/generate integration_test TestName
 ruby script/generate session_migration
 ¿ÉÑ¡Ïî:
 -p, ¨Cpretend Run but do not make any changes.
 -f, ¨Cforce Overwrite files that already exist.
 -s, ¨Cskip Skip files that already exist.
 -q, ¨Cquiet Suppress normal output.
 -t, ¨Cbacktrace Debugging: show backtrace on errors.
 -h, ¨Chelp Show this help message.
 -c, ¨Csvn Modify files with subversion. (Note: svn must be in path) 
1.6 Plugins
 script/plugin discover
 # discover plugin repositories
 script/plugin list
 # list all available plugins
 script/plugin install where
 # install the a€wherea€? plugin
 script/plugin install -x where
 # install where plugin as SVN external
 script/plugin install http://invisible.ch/projects/plugins/where
 script/plugin update
 # update installed plugins
 script/plugin source
 # add a source repository
 script/plugin unsource
 # removes a source repository
 script/plugin sources
 # lists source repositories
 


ÉÏһƪ ROR ! something¡¡¡¡ÏÂһƪ Ruby on Rails ¹ú¼Ê»¯Ó¦ÓÃ



    ÎÄÕÂÆÀÂÛ
 
 

·¢±íÆÀÂÛ

êÇ   ³Æ£º
ÑéÖ¤Â룺 ¡¡µã»÷ͼƬ¿ÉË¢ÐÂÑéÖ¤Âë¡¡¡¡²©¿Í¹ý2¼¶£¬ÎÞÐèÌîдÑéÖ¤Âë
ÄÚ   ÈÝ£º