Ruby on Rails development practice command reference

Source: Internet
Author: User
Tags ruby on rails
1.1.rails
1.1 create a rails Application Program
$ Rails app_name
Optional:
-D, database = xxx specifies to install a database (MySQL Oracle PostgreSQL sqlite2 sqlite3), which is a database by default
-R, ruby-Path = specifies the ruby installation path. If not, scripts uses env to find Ruby.
-F, freeze (freeze) freezes rails in the vendor/rails directory

1.2 API documentation
$ Gem_server
Start a webrick server. In this case, you can use http: // localhost: 8808/to open a browser to view the rails API documentation.

1.3 rake
Rake DB: fixtures: Load
# Load fixtures to the database in the current environment
# Load the specified fixtures using fixtures = x, y
Rake DB: migrate
# Migrate the database through the script in the DB/migrate directory. You can specify the version number through version = x
Rake DB: Schema: Dump
# Create a DB/Schema. RB file and use AR to support any database.
Rake DB: Schema: Load
# Re-enter a schema. RB file into the database
Rake DB: Sessions: Clear
# Clearing the sessions table
Rake DB: Sessions: Create
# Use CGI: Session: activerecordstore to create a sessions table for the user
Rake DB: Structure: Dump
# Export the database structure as an SQL File
Rake DB: Test: Clone
# Recreate a test database from the current environment database
Rake DB: Test: clone_structure
# Recreate the test database from the Development Mode Database
Rake DB: testrepare
# Prepare the test database and import the schema
Rake DB: testurge
# Clearing the Test Database
Rake DOC: app
# Create an HTML file API documentation
Rake DOC: clobber_app
# Delete documentation
Rake DOC: clobber_plugins
# Delete plugin documentation
Rake DOC: clobber_rails
# Delete documentation
Rake doclugins
# Generate deployment for all installed plugins
Rake DOC: rails
# Create an HTML file API documentation
Rake DOC: reapp
# Force re-create the HTML file API documentation
Rake DOC: rerails
# Force re-create the HTML file API documentation
Rake log: Clear
# Clear all log files in the directory 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: testrepare
Rake test: Integration
# Run tests for integrationdb: testrepare
Rake testlugins
# Run tests for pluginsenvironment
Rake test: Recent
# Run tests for recentdb: testrepare
Rake test: uncommitted
# Run tests for uncommitteddb: testrepare
Rake test: Units
# Run tests for unitsdb: testrepare
Rake TMP: cache: Clear
# Clear all objects in the tmp/cache directory
Rake TMP: Clear
# Clear session, cache, and socket files from the tmp/directory
Rake TMP: Create
# Create the tmp/directory for sessions, cache, and sockets
Rake TMP: Sessions: Clear
# Clear all files in the tmp/sessions directory
Rake TMP: sockets: Clear
# Clear all ruby_sess. * files in the tmp/sessions directory

1.4 scripts
script/about
# output current Environment Information
script/breakpointer
# Start the breakpoint server
script /console
# Start the exchange-type rails console
script/destroy
# delete files created by generators
script/generate
#-> generators
script/plugin
#-> plugins
script/runner
# execute a task in the rails context
script/server
# start the Development Mode Server HTTP: // localhost: 3000
// do not know how to use the following:
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
Optional:
-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)

1.6 plugins
script/plugin discover
# discover plugin repositories
script/plugin list
# list all available plugins
script/plugin install where
# Install the where 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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.