Rails command usage
Practical:
Rake-T list all rake commands
Rake-T plugin lists all the rake commands related to plugin.
Rake db: migrate version = 0 CLEAR database data and Structure
1.1 create a Rails Application
$ 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: Test: Prepare
# Prepare the test database and import the schema
Rake DB: Test: purge
# 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 doc: plugins
# 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: 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
# 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
# Deleting files created through 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 € 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