Ruby on Rails: Making Rake do tasks

First, you generate the task via the command line: $ rails g task your_task_name_here Then, open the newly generated task file (lib/tasks/your_task_name_here.rake And fill out the guts (an example here): namespace :crawl_quotes do desc “Crawls for stuff” task :get_stuff => :environment do require ‘mechanize’ agent = Mechanize.new agent.get(“http://www.somewebpagehere.com”) agent.page.search(“.somecssclass”).search(‘a’).each do |index, item| # Do something […]