Jekyll on Bitbucket
I’m an obstinate old fool; while the cool kids are on GitHub I wanted to stay with BitBucket (it’s not so much the site - I’m more familiar with Mercurial and don’t want to be messing with bridges). At the same time, I’m throwing this together one evening, and want results quickly. So I want to use Jekyll.
Luckily, it turns out that Bitbucket can serve static sites. This is pretty much the same as deploying static sites on GitHub except that, as far as I can tell, there’s no way to tie Jekyll to a post-update hook on the server. Instead, we need to generate the site on the client and then send that to Bitbucket.
That raises one more issue - Bitbucket serves static data from the root
directory of a repo and Jekyll completely wipes the destination directory. So
you can’t have the site in the same repo that contains your Jekyll files
(since Jekyll will wipe them!) Instead, we use two repos (hey - they’re
unlimited). One, with the magic name (see the Bitbucket support link above),
for the generated site, and one for the Jekyll source. We
still generate the site in
_site (targetting the site repo would have Jekyll
.hg), but then copy everything across with a simple shell script.
You can see all the details in the code.
Finally, if you work at ISTI and want to post, here’s what you do:
jekyll(Ruby Gem) and
sudo gem install jekyll
sudo easy_install pygments
Create a new directory:
mkdir bitbucket; cd bitbucket
Clone the source:
hg clone https://bitbucket.org/isti/jekyll-site
Get Bitbucket write access from someone (me).
Clone the deployed site:
hg clone https://firstname.lastname@example.org/isti/isti.bitbucket.org(where you replace “username”)
Add a post to the
_postsdirectory in the source:
cd jekyll-site; emacs _posts/2012...
jekyll2.0 server --watch(check things look OK on http://localhost:4000 - you can edit files then reload your browser until everythings is as you want).
Run the deploy script:
cd _bin; ./deploy.sh "commit message here"
PS Some useful links for use with Jekyll:
- Userspace Oracle XE
- CMake with Check Unit Tests
- Pipes, Clojure and Choco (part 4: Benchmarking)
- Pipes, Clojure and Choco (part 5: Choco)
- Pipes, Clojure and Choco - Optimisation
- Pipes, Clojure and Choco (part 1: Limits of Laziness)
- An ORM for C?
- Wacom Bamboo on Linux 3.1
- OpenSSH Certificates
- How to Average Complex Responses