Created
April 2, 2014 02:31
-
-
Save druttka/9927030 to your computer and use it in GitHub Desktop.
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
drafts_dir = "_drafts" # directory for blog draft files | |
desc "post drafts" | |
task :post_drafts do | |
Dir.foreach("#{source_dir}/#{drafts_dir}") do |item| | |
itemDate = /(\d{4}-\d{2}-\d{2})-.*.markdown/.match(item) | |
next unless itemDate | |
system "mv #{source_dir}/#{drafts_dir}/#{item} #{source_dir}/#{posts_dir}" if Date.strptime(itemDate[1],'%Y-%m-%d') <= Date.today | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment