diff options
author | B Mathis <brandon@imathis.com> | 2009-12-07 10:55:13 -0600 |
---|---|---|
committer | B Mathis <brandon@imathis.com> | 2009-12-07 10:55:13 -0600 |
commit | a6262dcbff3901135f0941e1f5f03be0db196874 (patch) | |
tree | 8285e93ce9f7a37d883b7d6b9698e9887494ad58 /Rakefile | |
parent | af719fb4dd94444837e4cb114968af1ba9987b58 (diff) | |
download | my_new_personal_website-a6262dcbff3901135f0941e1f5f03be0db196874.tar.xz my_new_personal_website-a6262dcbff3901135f0941e1f5f03be0db196874.zip |
added a rake task for creating a new post
Diffstat (limited to 'Rakefile')
-rw-r--r-- | Rakefile | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -35,6 +35,18 @@ task :default => [:generate_site, :generate_style] do puts ">>> Site Generating Complete! <<<\n\n" end +# usage rake post[my-new-post] or rake post['my new post'] or rake post (defaults to "new-post") +desc "Begin a new post in #{source}/_posts" +task :post, :filename do |t, args| + args.with_defaults(:filename => 'new-post') + #system "touch #{source}/_posts/#{Time.now.strftime('%Y-%m-%d_%H-%M')}-#{args.filename}.markdown" + open("#{source}/_posts/#{Time.now.strftime('%Y-%m-%d_%H-%M')}-#{args.filename.gsub(/[ _]/, '-')}.markdown", 'w') do |post| + post.puts "---" + post.puts "title: \"#{args.filename.gsub(/[-_]/, ' ').titlecase}\"" + post.puts "---" + end +end + desc "list tasks" task :list do puts "Tasks: #{(Rake::Task.tasks - [Rake::Task[:list]]).to_sentence}" |