After having found that octopress was a nice easy blogging system, I was almost sure that I would write tones of articles every weeks. I end up writing just a couple of them in few months!
Looking at what’s on Google I found some nice blogs with useful snippets or scripts. But for some reasons, it did not really fit my needs, which was to be able to create, test and publish an article from BBEdit without going into Terminal and do some command line (that I never remember).
So I decided to find a way to make it by myself and wrote some AppleScripts runnable from BBEdit. Let’s see if I will get more articles done that way…
To be honest I first started with a Python Script before to go for AppleScript. Trying the proper way (with my Python script) I couldn’t succeed in changing my Ruby environment from script (with rvm). I might come back with a specific blog post on this one day. So, as I have only little time for my scripting hobby it quickly became an AppleScript that open Terminal app and run some shell commands like “rake new_post”, “rake preview” and “rake deploy”.
Ok this is not the cleanest way, but it works. Here are the 3 AppleScripts that does all that.
BBEdit and Scripts
BBEdit is really a great editor. I very recently discovered that in top of filters you can set you own scripts that could be any kind of scripting languages.
The 3 provided AppleScripts needs to be put in your BBEdit directory so that you can easily access it and even set a keyboard shortcuts.
Folder is:
/Library/Application Support/BBEdit/Scripts/
Then writing a blog article would be run in order:
- “Octopress new article” to open an new article in BBEdit
- “Octopress preview” to launch Chrome for preview on localhost:4000
- “Octopress deploy” to deploy your brand new article