Skip to content

Instantly share code, notes, and snippets.

@jch
Created November 17, 2011 15:33
Show Gist options
  • Save jch/1373423 to your computer and use it in GitHub Desktop.
Save jch/1373423 to your computer and use it in GitHub Desktop.
# lib/tasks/export.rake
require 'pathname'
def export(path)
path = Pathname.new('export' + path) # prefix a folder to export to to
path.dirname.mkpath # creates any intermediate folders
`curl http://localhost:3000/#{path} > #{path.to_s}`
end
desc "Export pages"
task :export => :environment do
include Rails.application.routes.url_helpers
# name the specific routes you'd like exported
export welcome_path
export root_path
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment