17 lines
384 B
Ruby
Executable File
17 lines
384 B
Ruby
Executable File
#!/usr/bin/env rake
|
|
|
|
desc 'Create new post: rake new [article-name]'
|
|
task :new do
|
|
# calculate post md file name:
|
|
day = Time.now
|
|
title = ARGV.last.downcase
|
|
|
|
postname = "#{day.year}-#{day.strftime("%m")}-#{day.strftime("%d")}-#{title}.md"
|
|
|
|
# generate the post md file:
|
|
sh "hugo new #{postname}"
|
|
|
|
# workaround
|
|
ARGV.slice(1, ARGV.size).each{|v| task v.to_sym do; end}
|
|
end
|