Skip to content

Instantly share code, notes, and snippets.

@brenes
Created August 20, 2011 09:35
Show Gist options
  • Select an option

  • Save brenes/1158906 to your computer and use it in GitHub Desktop.

Select an option

Save brenes/1158906 to your computer and use it in GitHub Desktop.
Código para ejecutar una tarea rake desde ruby (para tests, por ejemplo)
# Source: http://stackoverflow.com/questions/1255176/test-rake-tasks
def execute_rake(file,task)
require 'rake'
rake = Rake::Application.new
Rake.application = rake
Rake::Task.define_task(:environment)
load "#{Rails.root}/lib/tasks/#{file}"
rake[task].invoke
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment