I’ve never really touched rake
before, but since switching to Jekyll I’m finding that it’s becoming an essential part of my workflow. In the limited area of blogging, at least.
rake
is a version of make
in which you define all your targets in Ruby. Because practically anything would be an improvement over Makefile
syntax, this is pretty easy to work with. I’m not a huge fan of shell scripting at the best of times, so mixing it in with something else is… not desirable. I still find Ruby less intuitive than Python, but that’s my prejudices talking.
To elaborate… what does posting a new entry look like for me?
rake server
to start up an automatically-rebuilding local webserver copy of my blograke post[raking-jekyll]
to make a new post with the YAML front matter boilerplate- Actually edit the newly created post in an editor
rake deploy
to rsync the local copy to my hosting over ssh
Any part of my routine which looks like it might be scriptable has been replaced with a rake
target. For example, the post
target:
- Copies a template file
- Names it according to the current date and provided title
- Adds an expanded version of the current date into its YAML front matter so sorting will work correctly if I post multiple times a day
Since I rarely know the current date without having to look it up, that certainly saves me some effort.
Here’s my Rakefile, if you want to use anything from it. It’s probably not properly idiomatic Ruby, but it does at least work.
Hi David. 🙂 You can use
contents = <a href="http://File.read" rel="nofollow">File.read</a>()
in the Rakefile to read the template file directly.Cunning!
I made a cool repo for jekyll with rake and grunt together. Take a look http://github.com/jwebcat/rake…
I’m new to jekyll and ruby, this has been very helpful! What was the multiple-posts-a-day issue you ran into?