Simpler logic to category patch

Replace single line with cleaner, more readable Ruby.
This commit is contained in:
Matthew Parnell 2014-01-01 23:41:04 +00:00
parent 2fc2e068e6
commit a53b4a95dc

View file

@ -47,7 +47,7 @@ task :post do
title = ENV["title"] || "new-post"
tags = ENV["tags"] || "[]"
category = ENV["category"] || ""
category = category.empty? ? "" : "\"#{category.gsub(/-/,' ')}\""
category = "\"#{category.gsub(/-/,' ')}\"" if !category.empty?
slug = title.downcase.strip.gsub(' ', '-').gsub(/[^\w-]/, '')
begin
date = (ENV['date'] ? Time.parse(ENV['date']) : Time.now).strftime('%Y-%m-%d')