# [RAILS_ROOT]/lib/tasks/sample.rake
desc "print hello world!" # description.
task "hello_world" do # rake task name.
p "hello world!" # print "hello world!"
end
namespace :myapp do
desc "import data from somewhere"
# load rails environment
task :import_data => :environment do
end
desc "drop and create db task."
task "drop_and_create" => ["db:drop", "db:create"] do
end
end
### in your console
# show rake task
rake hello_world
rake hello_world
rake myapp:import_data