#! /usr/bin/env ruby require 'shinmun' ENV['RACK_ENV'] = 'production' case ARGV[0] when 'init' Shinmun::Blog.init ARGV[1] when 'post' blog = Shinmun::Blog.new('.') post = blog.create_post(:title => ARGV[1], :date => Date.today) path = blog.post_file(post) `git checkout master posts` exec "#{ENV['EDITOR']} #{path}" when 'page' blog = Shinmun::Blog.new('.') post = blog.create_page(:title => ARGV[1]) path = blog.post_file(post) `git checkout master pages` exec "#{ENV['EDITOR']} #{path}" else puts "Usage:" puts " shinmun init dir - creates a new blog" puts " shinmun post 'Title of the post' - create a new post" puts " shinmun page 'Title of the page' - create a new page" end