Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
require 'rake' require 'fileutils' class DelayedRake def initialize(task, options = {}) @task = task @options = options end ## # Called by Delayed::Job. def perform FileUtils.cd RAILS_ROOT @rake = Rake::Application.new Rake.application = @rake ### Load all the Rake Tasks. Dir[ "./lib/tasks/**/*.rake" ].each { |ext| load ext } @options.stringify_keys!.each do |key, value| ENV[key] = value end begin @rake[@task].invoke rescue => e RAILS_DEFAULT_LOGGER.error "[ERROR]: task \"#{@task}\" failed. #{e}" end end end ## # Stick an Object in the queue. # Delayed::Job.enqueue(DelayedRake.new("util:mongrel_init:name"))
This paste will be private.
From the Design Piracy series on my blog: