promotion

Monday, June 16, 2014

Rails and Rake Commands

Here is a list of various important commands supported by Rake:
  • rake about - List versions of all Rails frameworks and the environment
  • rake assets:clean[keep] - Remove old compiled assets
  • rake assets:clobber - Remove compiled assets
  • rake assets:environment -Load asset compile environment
  • rake assets:precompile - Compile all the assets named in config.assets.precompile
  • rake clean - Cleanup temporary, log and backup files
  • rake db:create - Create the database from DATABASE_URL or config/database.yml for the current Rails.env (use db:create:all to create all dbs in the config)
  • rake db:drop - Drops the database using DATABASE_URL or the current Rails.env (use db:drop:all to drop all databases)
  • rake db:fixtures:load - Load fixtures into the current environment's database. Load specific fixtures using FIXTURES=x,y
  • rake db:migrate - Migrate the database through scripts in db/migrate. Target specific version with VERSION=x
  • rake db:migrate:status - Display status of migrations
  • rake db:remigrate - Migrate schema to version 0 and back up again
  • rake db:rollback - Rolls the schema back to the previous version (specify steps w/ STEP=n)
  • rake db:schema:cache:clear - Clear a db/schema_cache.dump file
  • rake db:schema:cache:dump - Create a db/schema_cache.dump file
  • rake db:schema:dump - Create a db/schema.rb file that can be portably used against any DB supported by AR.
  • rake db:schema:load - Load a schema.rb file into the database.
  • rake db:seed - Load the seed data from db/seeds.rb
  • rake db:setup - Create the database, load the schema, and initialize with the seed data (use db:reset to also drop the db first)
  • rake db:structure:dump - Dump the database structure to db/structure.sql
  • rake db:version - Retrieves the current schema version number
  • rake db:sessions:clear - Clear the sessions table.
  • rake db:sessions:create - Creates a sessions table for use with CGI::Session::ActiveRecordStore.
  • rake db:structure:dump - Dump the database structure to a SQL file.
  • rake doc:app - Generate docs for the app -- also available doc:rails, doc:guides (options: TEMPLATE=/rdoc-template.rb, TITLE="Custom Title")
  • rake log:clear - Truncates all *.log files in log/ to zero bytes (specify which logs with LOGS=test,development)
  • rake rails:template - Applies the template supplied by LOCATION=(/path/to/template) or URL
  • rake routes - Print out all defined routes in match order, with names
  • rake spec - Run all specs in spec directory (excluding plugin specs)
  • rake spec:features - Run the code examples in spec/features
  • rake spree:install:migrations - Copy migrations from spree to application
  • rake spree:reset_taxon_permalinks - Resets all taxon permalinks
  • rake spree_api:install:migrations - Copy migrations from spree_api to application
  • rake spree_auth:admin:create - Create admin username and password
  • rake spree_auth:install:migrations - Copy migrations from spree_auth to application
  • rake stats - Report code statistics (KLOCs, etc) from the application
  • rake test - Runs test:units, test:functionals, test:integration together
  • rake test:all - Run tests quickly by merging all types and not resetting db
  • rake test:all:db - Run tests quickly, but also reset db
  • rake time:zones:all - Displays all time zones, also available: time:zones:us, time:zones:local -- filter with OFFSET parameter, e.g., OFFSET=-6
  • rake tmp:clear - Clear session, cache, and socket files from tmp/ (narrow w/ tmp:sessions:clear, tmp:cache:clear, tmp:sockets:clear)
  • rake tmp:create - Creates tmp directories for sessions, cache, sockets, and pids

No comments:

Post a Comment