Created
November 8, 2011 11:53
-
-
Save omo/1347579 to your computer and use it in GitHub Desktop.
open today's journal. used from emacs.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require "date" | |
Dir::chdir(File::join(ENV["HOME"], "work/octopress")) | |
if (ARGV[0] == "pub") | |
system("bash -l -c 'rvm use 1.9.2 && rake generate deploy'") | |
exit | |
end | |
pattern = Date.today.strftime("source/_posts/%Y-%m-%d-*.markdown") | |
existing = Dir.glob(pattern) | |
if existing.empty? | |
IO.popen("bash -l", "r+") do |io| | |
io.write("rvm use 1.9.2\n") | |
io.write("rake new_post['Today']\n") | |
io.write("exit\n") | |
io.readlines | |
end | |
existing = Dir.glob(pattern) | |
end | |
print File::expand_path(existing[0]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment