If you have any thoughts on this post, I'd love to hear them. Send me an email through the "Contact me" link on the left.
I like to automate things that are a bit tedious. So, I’ve automated a slightly tedious thing and probably put more time into than will pay off. But perhaps it might help someone else.
To make a post, you put a new file in the _posts/ directory. This file must be named strictly in the form of "yyyy-mm-dd-post-title.md". Once the file is created, a header is required of the following form:
This is all stuff that I want created for me – the computer knows the date, right? Why do I have to type that in? And once I declare the title of the post once, why should I type that again?
Obviously I’m just lazy. So, I wrote the ugliest Ruby code you’ve ever seen to automate the post-file creation.
I placed the script in the _posts/ directory, and added the file to my .gitignore so that Git wouldn’t try to add it to the server.
What does it look like in action?
I’ve never written anything in Ruby before, so this was a fun chance to learn the basics of the language.