Created
March 12, 2015 16:52
-
-
Save Eunoia/15ded6c0dc0d80cb5e0f to your computer and use it in GitHub Desktop.
Turn rails into a static site.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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