I upgrade my app from rails2 to rails3. Now every time I run a task I get this error:
➜ cimm git:(master) ✗ ruby -v
ruby 1.9.3p448 (2013-06-27 revision 41675) [x86_64-darwin13.0.0]
➜ cimm git:(master) ✗ rails -v
Rails 3.0.20
➜ cimm git:(master) ✗ bundle exec rake sitemaps:servicos --trace
** Invoke sitemaps:servicos (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute sitemaps:servicos
/Users/netto/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/test/unit.rb:167:in `block in non_options': file not found: sitemaps:servicos (ArgumentError)
from /Users/netto/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/test/unit.rb:146:in `map!'
from /Users/netto/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/test/unit.rb:146:in `non_options'
from /Users/netto/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/test/unit.rb:207:in `non_options'
from /Users/netto/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/test/unit.rb:52:in `process_args'
from /Users/netto/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/minitest/unit.rb:891:in `_run'
from /Users/netto/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/minitest/unit.rb:884:in `run'
from /Users/netto/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/test/unit.rb:21:in `run'
from /Users/netto/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/test/unit.rb:326:in `block (2 levels) in autorun'
from /Users/netto/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/test/unit.rb:27:in `run_once'
from /Users/netto/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/test/unit.rb:325:in `block in autorun'
I don't know why is loading something about Test Unit if I'm using Rspec. I tried change rake version, changing the require 'rails/all' but none fixed this issue.
But my tasks are loaded, so seems this is kind of a warning. But I'd to know how to fix this.
Update 1
These errors only appear when my task interact with Model/Controllers.
My Rakefile:
require File.expand_path('../config/application', __FILE__)
require 'rake'
CIMM::Application.load_tasks
Check your Rakefile. it probably loading TestUnit
You should show the custom task if you want more help.
➜ cimm git:(master) ✗ rake -T
rake about # List versions of all Rails frameworks and the environment
rake airbrake:deploy # Notify Airbrake of a new deploy.
rake airbrake:heroku:add_deploy_notification # Install Heroku deploy notifications addon
rake airbrake:test # Verify your gem installation by sending a test exception to the airbrake service / Verify your gem instal...
rake db:create # Create the database from config/database.yml for the current Rails.env (use db:create:all to create all d...
rake db:drop # Drops the database for the current Rails.env (use db:drop:all to drop all databases)
rake db:fixtures:load # Load fixtures into the current environment's database.
rake db:migrate # Migrate the database (options: VERSION=x, VERBOSE=false).
rake db:migrate:status # Display status of migrations
rake db:rollback # Rolls the schema back to the previous version (specify steps w/ STEP=n).
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...
rake db:structure:dump # Dump the database structure to an SQL file
rake db:version # Retrieves the current schema version number
rake doc:app # Generate docs for the app -- also available doc:rails, doc:guides, doc:plugins (options: TEMPLATE=/rdoc-t...
rake log:clear # Truncates all *.log files in log/ to zero bytes
rake middleware # Prints out your Rack middleware stack
rake notes # Enumerate all annotations (use notes:optimize, :fixme, :todo for focus)
rake notes:custom # Enumerate a custom annotation, specify with ANNOTATION=CUSTOM
rake rails:template # Applies the template supplied by LOCATION=(/path/to/template) or URL
rake rails:update # Update both configs and public/javascripts from Rails (or use just update:javascripts or update:configs)
rake rails:upgrade:backup # Backs up your likely modified files so you can run the Rails 3 generator on your app with little risk
rake rails:upgrade:check # Runs a battery of checks on your Rails 2.x app and generates a report on required upgrades for Rails 3
rake rails:upgrade:configuration # Extracts your configuration code so you can create a new config/application.rb
rake rails:upgrade:gems # Generates a Gemfile for your Rails 3 app out of your config.gem directives
rake rails:upgrade:routes # Create a new, upgraded route file from your current routes.rb
rake routes # Print out all defined routes in match order, with names.
rake secret # Generate a cryptographically secure secret key (this is typically used to generate a secret for cookie se...
rake sitemaps:servicos # Cria sitemap para servicos
rake spec # Run all specs in spec directory (excluding plugin specs)
rake spec:controllers # Run the code examples in spec/controllers
rake stats # Report code statistics (KLOCs, etc) from the application
rake time:zones:all # Displays all time zones, also available: time:zones:us, time:zones:local -- filter with OFFSET parameter,...
rake tire:import # Import data from your model using paginate: rake environment tire:import CLASS='MyModel'.
rake tire:index:drop # Delete indices passed in the INDEX environment variable; separate multiple indices by comma.
rake tmp:clear # Clear session, cache, and socket files from tmp/ (narrow w/ tmp:sessions:clear, tmp:cache:clear, tmp:sock...
rake tmp:create # Creates tmp directories for sessions, cache, sockets, and pids
Related
I can't execute rake routes even if the routes.rb file is empty. This is the output:
➜ rake routes
rake aborted!
Don't know how to build task 'routes' (See the list of available tasks with `rake --tasks`)
(See full trace by running task with --trace)
Output from rake about:
➜ rake about
About your application's environment
Rails version 6.1.0
Ruby version ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-darwin19]
RubyGems version 3.1.4
Rack version 2.2.3
Middleware Webpacker::DevServerProxy, Rack::MiniProfiler, ActionDispatch::HostAuthorization, Rack::Sendfile, ActionDispatch::Static, ActionDispatch::Executor, ActiveSupport::Cache::Strategy::LocalCache::Middleware, Rack::Runtime, Rack::MethodOverride, ActionDispatch::RequestId, ActionDispatch::RemoteIp, Sprockets::Rails::QuietAssets, Rails::Rack::Logger, ActionDispatch::ShowExceptions, WebConsole::Middleware, ActionDispatch::DebugExceptions, ActionDispatch::ActionableExceptions, ActionDispatch::Reloader, ActionDispatch::Callbacks, ActiveRecord::Migration::CheckPending, ActionDispatch::Cookies, ActionDispatch::Session::CookieStore, ActionDispatch::Flash, ActionDispatch::ContentSecurityPolicy::Middleware, ActionDispatch::PermissionsPolicy::Middleware, Rack::Head, Rack::ConditionalGet, Rack::ETag, Rack::TempfileReaper, Warden::Manager
Application root /Users/cobexa/app
Environment development
Database adapter postgresql
Database schema version 20201219225707
And output from rake --tasks:
rake about # List versions of all Rails frameworks and the environment
rake action_mailbox:ingress:exim # Relay an inbound email from Exim to Action Mailbox (URL and INGRESS_PASSWORD required)
rake action_mailbox:ingress:postfix # Relay an inbound email from Postfix to Action Mailbox (URL and INGRESS_PASSWORD required)
rake action_mailbox:ingress:qmail # Relay an inbound email from Qmail to Action Mailbox (URL and INGRESS_PASSWORD required)
rake action_mailbox:install # Installs Action Mailbox and its dependencies
rake action_mailbox:install:migrations # Copy migrations from action_mailbox to application
rake action_text:install # Copy over the migration, stylesheet, and JavaScript files
rake action_text:install:migrations # Copy migrations from action_text to application
rake active_storage:install # Copy over the migration needed to the application
rake app:template # Applies the template supplied by LOCATION=(/path/to/template) or URL
rake app:update # Update configs and some other initially generated files (or use just update:configs or update:bin)
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 cache_digests:dependencies # Lookup first-level dependencies for TEMPLATE (like messages/show or comments/_comment.html)
rake cache_digests:nested_dependencies # Lookup nested dependencies for TEMPLATE (like messages/show or comments/_comment.html)
rake db:create # Creates the database from DATABASE_URL or config/database.yml for the current RAILS_ENV (use db:create:all to create all databases in the config). Without RAILS_ENV or when RAILS_ENV is development, it defaults to creating the development and test databases, except when DATABASE_URL is present
rake db:drop # Drops the database from DATABASE_URL or config/database.yml for the current RAILS_ENV (use db:drop:all to drop all databases in the config). Without RAILS_ENV or when RAILS_ENV is development, it defaults to dropping the development and test databases, except when DATABASE_URL is present
rake db:environment:set # Set the environment value for the database
rake db:fixtures:load # Loads fixtures into the current environment's database
rake db:migrate # Migrate the database (options: VERSION=x, VERBOSE=false, SCOPE=blog)
rake db:migrate:down # Runs the "down" for a given migration VERSION
rake db:migrate:redo # Rolls back the database one migration and re-migrates up (options: STEP=x, VERSION=x)
rake db:migrate:status # Display status of migrations
rake db:migrate:up # Runs the "up" for a given migration VERSION
rake db:prepare # Runs setup if database does not exist, or runs migrations if it does
rake db:reset # Drops and recreates the database from db/schema.rb for the current environment and loads the seeds
rake db:rollback # Rolls the schema back to the previous version (specify steps w/ STEP=n)
rake db:schema:cache:clear # Clears a db/schema_cache.yml file
rake db:schema:cache:dump # Creates a db/schema_cache.yml file
rake db:schema:dump # Creates a database schema file (either db/schema.rb or db/structure.sql, depending on `config.active_record.schema_format`)
rake db:schema:load # Loads a database schema file (either db/schema.rb or db/structure.sql, depending on `config.active_record.schema_format`) into the database
rake db:seed # Loads the seed data from db/seeds.rb
rake db:seed:replant # Truncates tables of each database for current environment and loads the seeds
rake db:setup # Creates the database, loads the schema, and initializes with the seed data (use db:reset to also drop the database first)
rake db:structure:dump # Dumps the database structure to db/structure.sql
rake db:structure:load # Recreates the databases from the structure.sql file
rake db:version # Retrieves the current schema version number
rake log:clear # Truncates all/specified *.log files in log/ to zero bytes (specify which logs with LOGS=test,development)
rake middleware # Prints out your Rack middleware stack
rake restart # Restart app by touching tmp/restart.txt
rake secret # Generate a cryptographically secure secret key (this is typically used to generate a secret for cookie sessions)
rake stats # Report code statistics (KLOCs, etc) from the application or engine
rake test # Runs all tests in test folder except system ones
rake test:all # Runs all tests, including system tests
rake test:db # Run tests quickly, but also reset db
rake test:system # Run system tests only
rake time:zones[country_or_offset] # List all time zones, list by two-letter country code (`bin/rails time:zones[US]`), or list by UTC offset (`bin/rails time:zones[-8]`)
rake tmp:clear # Clear cache, socket and screenshot files from tmp/ (narrow w/ tmp:cache:clear, tmp:sockets:clear, tmp:screenshots:clear)
rake tmp:create # Creates tmp directories for cache, sockets, and pids
rake webpacker # Lists all available tasks in Webpacker
rake webpacker:binstubs # Installs Webpacker binstubs in this application
rake webpacker:check_binstubs # Verifies that webpack & webpack-dev-server are present
rake webpacker:check_node # Verifies if Node.js is installed
rake webpacker:check_yarn # Verifies if Yarn is installed
rake webpacker:clean[keep,age] # Remove old compiled webpacks
rake webpacker:clobber # Remove the webpack compiled output directory
rake webpacker:compile # Compile JavaScript packs using webpack for production with digests
rake webpacker:info # Provide information on Webpacker's environment
rake webpacker:install # Install Webpacker in this application
rake webpacker:install:angular # Install everything needed for Angular
rake webpacker:install:coffee # Install everything needed for Coffee
rake webpacker:install:elm # Install everything needed for Elm
rake webpacker:install:erb # Install everything needed for Erb
rake webpacker:install:react # Install everything needed for React
rake webpacker:install:stimulus # Install everything needed for Stimulus
rake webpacker:install:svelte # Install everything needed for Svelte
rake webpacker:install:typescript # Install everything needed for Typescript
rake webpacker:install:vue # Install everything needed for Vue
rake webpacker:verify_install # Verifies if Webpacker is installed
rake webpacker:yarn_install # Support for older Rails versions
rake yarn:install # Install all JavaScript dependencies as specified via Yarn
rake zeitwerk:check # Checks project structure for Zeitwerk compatibility
I just discovered that rake routes were deprecated on rails 6.1 in favor of rails routes: https://github.com/rails/rails/commit/41ad613e4c5d6c05f20ac0437564ff0d31ab9f5a
bin/rake routes is deprecated. You can Use bin/rails routes
You can try using rails routes instead of rake routes.
You can use rails routes --expanded for a very clean output even on small screens.
I am currently writing a website with Ruby on rails for a few months.
Suddenly (5 or 6 days ago), all the commands like rails db:migrate, rails db:rollback, rails db:*" don't work anymore (and it does not seem to have touched anything...).
I tried to reinstall the gems rake, rails and railsties (which were already in their latest versions) but the problem still persists.
My Gemfile
The result when I execute the command rails db:migrate:
rails aborted!
Don't know how to build task 'db:migrate' (See the list of available tasks with `rake --tasks`)
/usr/local/rvm/gems/ruby-2.5.1/gems/railties-5.2.2/lib/rails/commands/rake/rake_command.rb:23:in `block in perform'
/usr/local/rvm/gems/ruby-2.5.1/gems/railties-5.2.2/lib/rails/commands/rake/rake_command.rb:20:in `perform'
/usr/local/rvm/gems/ruby-2.5.1/gems/railties-5.2.2/lib/rails/command.rb:48:in `invoke'
/usr/local/rvm/gems/ruby-2.5.1/gems/railties-5.2.2/lib/rails/commands.rb:18:in `<top (required)>'
bin/rails:4:in `require'
bin/rails:4:in `<main>'
(See full trace by running task with --trace)
The result when I execute the command rake db:migrate:
rake aborted!
Don't know how to build task 'db:migrate' (See the list of available tasks with `rake --tasks`)
/usr/local/rvm/gems/ruby-2.5.1/gems/rake-12.3.2/exe/rake:27:in `<top (required)>'
/usr/local/rvm/gems/ruby-2.5.1/bin/ruby_executable_hooks:24:in `eval'
/usr/local/rvm/gems/ruby-2.5.1/bin/ruby_executable_hooks:24:in `<main>'
(See full trace by running task with --trace)
The result when I execute the command rails --tasks --all:
rails app:template # Applies the template supplied by LOCATION=(/path/t...
rails app:templates:copy #
rails app:update # Update configs and some other initially generated ...
rails app:update:bin #
rails app:update:configs #
rails app:update:upgrade_guide_info #
rails assets:clean[keep] # Remove old compiled assets
rails assets:clobber # Remove compiled assets
rails assets:environment # Load asset compile environment
rails assets:precompile # Compile all the assets named in config.assets.prec...
rails autoprefixer:info # Show selected browsers and prefixed CSS properties...
rails cache_digests:dependencies # Lookup first-level dependencies for TEMPLATE (like...
rails cache_digests:nested_dependencies # Lookup nested dependencies for TEMPLATE (like mess...
rails default #
rails dev:cache # Toggle development mode caching on/off
rails environment #
rails initializers # Print out all defined initializers in the order th...
rails log:clear # Truncates all/specified *.log files in log/ to zer...
rails middleware # Prints out your Rack middleware stack
rails notes # Enumerate all annotations (use notes:optimize, :fi...
rails notes:custom # Enumerate a custom annotation, specify with ANNOTA...
rails notes:fixme #
rails notes:optimize #
rails notes:todo #
rails restart # Restart app by touching tmp/restart.txt
rails routes # Print out all defined routes in match order, with ...
rails secret # Generate a cryptographically secure secret key (th...
rails stats # Report code statistics (KLOCs, etc) from the appli...
rails test # Runs all tests in test folder except system ones
rails test:controllers #
rails test:db # Run tests quickly, but also reset db
rails test:functionals #
rails test:generators #
rails test:helpers #
rails test:integration #
rails test:jobs #
rails test:mailers #
rails test:models #
rails test:prepare #
rails test:run #
rails test:system # Run system tests only
rails test:units #
rails time:zones[country_or_offset] # List all time zones, list by two-letter country co...
rails time:zones:all #
rails time:zones:local #
rails time:zones:us #
rails tmp #
rails tmp/cache #
rails tmp/cache/assets #
rails tmp/pids #
rails tmp/sockets #
rails tmp:cache:clear #
rails tmp:clear # Clear cache, socket and screenshot files from tmp/...
rails tmp:create # Creates tmp directories for cache, sockets, and pids
rails tmp:pids:clear #
rails tmp:screenshots:clear #
rails tmp:sockets:clear #
rails yarn:install # Install all JavaScript dependencies as specified v...
I would be very grateful if you could help me on this problem !
Thank you in advance !
Aurèle
This happens probably due ruby version upgrade.
Try to install the gems again with bundle install and then try again.
If don't work you'll need to run as bundle exec rails db:migrate for bundle pick the right version of the gems.
EDIT: since your are using rvm, make sure you're using the same Ruby versions. Take a look at this https://rvm.io/workflow/projects and make sure you're in the right version.
Hint: Check the Ruby version in the Gemfile, as it could be the source of your problem.
I'm using the book "Agile Web Development with Rails 4" and am going through Chapter 7 which has to do with testing. The tutorial includes a Product model and has the reader modify the test file product_test.rb which apparently should be in test/models. The Railes Guide for tests also has this structure. Yet for some reason I don't have a models subdirectory in my test directory. My test directory looks like this:
[~/code/depot]: ls test
fixtures functional integration performance test_helper.rb unit
My product_test.rb file is in the "unit" folder.
This is causing problems when I try to run tests as demonstrated in the book. rake test works fine as does ruby -Itest test/unit/product_test.rb but rake test:models produces the following error:
[~/code/depot]: rake test:models
rake aborted!
Don't know how to build task 'test:models'
(See full trace by running task with --trace)
I don't really understand the rake commands but I'm assuming that it's looking for test/models when I run rake test:models? At any rate, it doesn't work, and I have no idea why my test directory structure is lacking the models folder and why my product_test.rb is in test/unit instead. The Rails Guide on testing also indicates that scaffold-generated models should have tests in test/models. Can anyone explain what may have happened or how I should go about fixing this?
EDIT
Output of rake -T:
[~/code/depot]: rake -T
rake about # List versions of all Rails frameworks and the environment
rake assets:clean # Remove compiled assets
rake assets:precompile # Compile all the assets named in config.assets.precompile
rake db:create # Create the database from DATABASE_URL or config/database.yml for the current Rails.env (use db:crea...
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
rake db:migrate # Migrate the database (options: VERSION=x, VERBOSE=false)
rake db:migrate:status # Display status of migrations
rake db:rollback # Rolls the schema back to the previous version (specify steps w/ STEP=n)
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 ...
rake db:structure:dump # Dump the database structure to db/structure.sql
rake db:version # Retrieves the current schema version number
rake doc:app # Generate docs for the app -- also available doc:rails, doc:guides, doc:plugins (options: TEMPLATE=/...
rake log:clear # Truncates all *.log files in log/ to zero bytes
rake middleware # Prints out your Rack middleware stack
rake notes # Enumerate all annotations (use notes:optimize, :fixme, :todo for focus)
rake notes:custom # Enumerate a custom annotation, specify with ANNOTATION=CUSTOM
rake rails:template # Applies the template supplied by LOCATION=(/path/to/template) or URL
rake rails:update # Update configs and some other initially generated files (or use just update:configs, update:scripts...
rake routes # Print out all defined routes in match order, with names
rake secret # Generate a cryptographically secure secret key (this is typically used to generate a secret for coo...
rake stats # Report code statistics (KLOCs, etc) from the application
rake test # Runs test:units, test:functionals, test:integration together (also available: test:benchmark, test:...
rake test:recent # Run tests for {:recent=>"test:prepare"} / Test recent changes
rake test:single # Run tests for {:single=>"test:prepare"}
rake test:uncommitted # Run tests for {:uncommitted=>"test:prepare"} / Test changes since last checkin (only Subversion and...
rake time:zones:all # Displays all time zones, also available: time:zones:us, time:zones:local -- filter with OFFSET para...
rake tmp:clear # Clear session, cache, and socket files from tmp/ (narrow w/ tmp:sessions:clear, tmp:cache:clear, tm...
rake tmp:create # Creates tmp directories for sessions, cache, sockets, and pids
Do you have something like the following in your application.rb?
config.generators do |g|
g.fixture_replacement :factory_girl # if your using factory_girl
g.test_framework :test_unit, :spec => true, :fixture => false
end
Why are some rake tasks not listed by rake -T? Like db:migrate:reset? I can execute it without a problem, but why is it not listed there? Is there a way to get a real full list of rake tasks?
% rake -T
(in /home/zeus/projects/my_project)
rake about # List versions of all Rails frameworks and the environment
rake db:create # Create the database from 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 for the current Rails.env (use db:drop:all to drop all databases)
rake db:fixtures:load # Load fixtures into the current environment's database.
rake db:migrate # Migrate the database (options: VERSION=x, VERBOSE=false).
rake db:migrate:status # Display status of migrations
rake db:rollback # Rolls the schema back to the previous version (specify steps w/ STEP=n).
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 an SQL file
rake db:version # Retrieves the current schema version number
rake doc:app # Generate docs for the app -- also availble doc:rails, doc:guides, doc:plugins (options: TEMPLATE=/rdoc-template.rb, TITLE="Custom Title")
rake erd # Generate an Entity-Relationship Diagram based on your models
rake log:clear # Truncates all *.log files in log/ to zero bytes
rake middleware # Prints out your Rack middleware stack
rake notes # Enumerate all annotations (use notes:optimize, :fixme, :todo for focus)
rake notes:custom # Enumerate a custom annotation, specify with ANNOTATION=CUSTOM
rake rails:template # Applies the template supplied by LOCATION=/path/to/template
rake rails:update # Update both configs and public/javascripts from Rails (or use just update:javascripts or update:configs)
rake routes # Print out all defined routes in match order, with names.
rake secret # Generate a crytographically secure secret key (this is typically used to generate a secret for cookie sessions).
rake spec # Run all specs in spec directory (excluding plugin specs)
rake spec:acceptance # Run the code examples in spec/acceptance
rake spec:controllers # Run the code examples in spec/controllers
rake spec:helpers # Run the code examples in spec/helpers
rake spec:lib # Run the code examples in spec/lib
rake spec:mailers # Run the code examples in spec/mailers
rake spec:models # Run the code examples in spec/models
rake spec:rcov # Run all specs with rcov
rake spec:requests # Run the code examples in spec/requests
rake spec:routing # Run the code examples in spec/routing
rake spec:views # Run the code examples in spec/views
rake stats # Report code statistics (KLOCs, etc) from the application
rake test # Runs test:units, test:functionals, test:integration together (also available: test:benchmark, test:profile, test:plugins)
rake test:recent # Run tests for recenttest:prepare / Test recent changes
rake test:uncommitted # Run tests for uncommittedtest:prepare / Test changes since last checkin (only Subversion and Git)
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
Tasks that don't have a description will not show up.
EDIT: Looks like DHH removed the description from Rails 3 for a few tasks to 'cut down on noise'. rake db:setup has a note about db:reset though.
http://github.com/rails/rails/commit/983815632cc1d316c7c803a47be28f1abe6698fb
You can also use rake db -T -A to show all tasks, even uncommented ones. For reference these switches are doing the following:
-T, --tasks [PATTERN] Display the tasks (matching optional PATTERN) with
descriptions, then exit.
-A, --all Show all tasks, even uncommented ones (in combination
with -T or -D)
You can use rake -P | grep rake to show the names of all Rake tasks.
As a follow up to Thomas Obermüller's answer, since the -T flag takes a positional argument, to get just the 'db' namespace tasks (at least with rake 10.0.3) you need to do: rake -T db -A
On this WIKI - Ruby on Rails/ActiveRecord/Migrations you can find some more information.
For windows user, you do this rake -P | find "rake"
I have trouble getting started with rails 3.0.0, because it just doesn't load the rake tasks
rake gems:install
rake aborted!
Don't know how to build task 'gems:install'
rake -T
rake about # List versions of all Rails frameworks and the environment
rake db:create # Create the database from 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 for the current Rails.env (use db:drop:all to drop all databases)
rake db:fixtures:load # Load fixtures into the current environment's database.
rake db:migrate # Migrate the database (options: VERSION=x, VERBOSE=false).
rake db:migrate:status # Display status of migrations
rake db:rollback # Rolls the schema back to the previous version (specify steps w/ STEP=n).
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 an SQL file
rake db:version # Retrieves the current schema version number
rake doc:app # Generate docs for the app -- also availble doc:rails, doc:guides, doc:plugins (options: TEMPLATE=/rdoc-template.rb, TITLE="Custom Title")
rake log:clear # Truncates all *.log files in log/ to zero bytes
rake middleware # Prints out your Rack middleware stack
rake notes # Enumerate all annotations (use notes:optimize, :fixme, :todo for focus)
rake notes:custom # Enumerate a custom annotation, specify with ANNOTATION=CUSTOM
rake rails:template # Applies the template supplied by LOCATION=/path/to/template
rake rails:update # Update both configs and public/javascripts from Rails (or use just update:javascripts or update:configs)
rake routes # Print out all defined routes in match order, with names.
rake secret # Generate a crytographically secure secret key (this is typically used to generate a secret for cookie sessions).
rake stats # Report code statistics (KLOCs, etc) from the application
rake test # Runs test:units, test:functionals, test:integration together (also available: test:benchmark, test:profile, test:plugins)
rake test:recent # Run tests for recenttest:prepare / Test recent changes
rake test:uncommitted # Run tests for uncommittedtest:prepare / Test changes since last checkin (only Subversion and Git)
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
So the problem is, the gems tasks are not being included.
That's probably also the reason, I can't install compass. It gives me the following error:
rails new testproj -m http://compass-style.org/rails/installer
rake gems:install GEM=haml --trace
rake aborted!
Don't know how to build task 'gems:install'
Is bundler broken on my system? I'm on snow leopard.
You have to use bundler for this, not the rake task.
Try:
bundle install
If you want to install gems, you have to put them in your Gemfile (in the project root) and then install them with bundler. http://github.com/schacon/bundler
in your Gemfile:
gem "haml"
then run the
bundle install