Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 29 lines (23 sloc) 0.7 kb
a3a9e5d @rtomayko Add about page to landing page and nav
rtomayko authored
1 require "fileutils"
e14c71e @sr thor file to generate website
sr authored
2
94584fb @rtomayko Add Thor task for creating blog entries (blog:new)
rtomayko authored
3 class Blog < Thor
4 TEMPLATE = (<<-TEXT).gsub(/^ +/, '')
5 ---
6 layout: post
7 title: TITLE
8 author: YOUR NAME
9 author_url: http://sinatra.github.com/
10 publish_date: #{Time.now.strftime('%A, %B %d, %Y')}
11 ---
12
13 POST CONTENT HERE
14 TEXT
15
16 desc "new", "Create a new blog post and open in EDITOR"
17 def new(title=nil)
d23879b @sr Ridiculous cosmetic change to Thorfile
sr authored
18 abort("usage: thor blog:new 'Post Title'") if title.nil?
94584fb @rtomayko Add Thor task for creating blog entries (blog:new)
rtomayko authored
19
20 post = TEMPLATE.sub('TITLE', title)
21 date = Time.now.strftime('%Y-%m-%d')
22 file = "_posts/#{date}-#{title.downcase.gsub(/[!.,;:+=-]/, '').gsub(/\W+/, '-')}.markdown"
23 File.open(file, 'wb') { |f| f.write(post) }
24 system "$EDITOR #{file}"
25 end
26 end
27
bf20a88 @rtomayko Use jekyll for layout / remove HAML stuff
rtomayko authored
28 # vim: ft=ruby
Something went wrong with that request. Please try again.