Skip to content

Instantly share code, notes, and snippets.

@Eunoia
Created March 12, 2015 16:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Eunoia/15ded6c0dc0d80cb5e0f to your computer and use it in GitHub Desktop.
Save Eunoia/15ded6c0dc0d80cb5e0f to your computer and use it in GitHub Desktop.
Turn rails into a static site.
namespace :static do
desc 'Generate static site in ./out/ directory'
task :generate do
Dir.mkdir 'out' unless File.exist? 'out'
Dir.chdir 'out' do
`wget -mnH http://localhost:3000/`
end
`rsync -ruv --exclude=.svn/ public/ out/`
end
desc 'Run tiny HTTP server from ./out/ directory'
task :server do
Dir.chdir 'out' do
puts 'Started HTTP server at http://localhost:8000/. Press CTRL+C to exit.'
`python -m SimpleHTTPServer`
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment