One of the problems with using Jekyll, a static website generator, is that you have to copy your files to a server manually if you want the world to see them. Luckily, it is easy to automate.
rsync to copy my generated site to my server. This works like a charm:
rsync -avz "_site/" username@server:~/dir/to/public/
avz flags tell it to be verbose, and both archive and compress the data.
Remembering and typing that
rsync line every time I want to publish my site
is not a good idea, so I dropped the whole thing in a Rake task:
desc 'rsync the contents of ./_site to the server' task :sync do puts '* Publishing files to live server' puts `rsync -avz "_site/" username@server:~/dir/to/public/` end
Publishing my site is now as easy as
rake sync. The good thing about putting
this in a Rake task is that I can now chain the syncing with other tasks:
rake publish will re-generate my site, push code to Github, sync my
site with the server and notify various web services about the changes to my
You can check out my
Rakefile at Github.