Permalink
Browse files

Update stuff to use directories.

  • Loading branch information...
blatyo committed Jun 24, 2012
1 parent 189cdc3 commit c94f10a7de9dec76a1fda21b38b35c29c4890f61
Showing with 5 additions and 7 deletions.
  1. +5 −7 Rakefile
  2. 0 draft/.gitkeep
  3. 0 published/.gitkeep
View
@@ -3,22 +3,20 @@ require 'date'
desc "Create a new file with title as file name"
task :draft do
title = ENV['title']
- system %Q[touch "#{title}.md"]
+ system %Q[touch "draft/#{title}.md"]
end
desc "Add date stamp to file name so that it will be picked up as published"
task :publish do
old_file_name = ENV['article']
- category = ENV['category'] ? "[#{ENV['category']}]" : ""
- tags = ENV['tags'] ? "[#{ENV['tags']}]" : ""
- if old_file_name =~ /^(.+\/)?(.+)(\.md)$/
+ if old_file_name =~ /\Adraft\/(.+)(\.md)$/
date = Date.today.strftime("%Y-%m-%d")
- new_file_name = %Q|#{$1}#{date} #{$2}#{category}#{tags}#{$3}|
+ new_file_name = "published/#{date} #{$1}#{$2}"
- system %Q[git mv "#{old_file_name}" "#{new_file_name}"]
- system %Q[git commit -m "Publish #{$2}"]
+ system 'git mv "#{old_file_name}" "#{new_file_name}"'
+ system %(git commit -m "Published #{$1}")
else
raise "That's not an article!"
end
View
No changes.
View
No changes.

0 comments on commit c94f10a

Please sign in to comment.