2012-05-26 20:21:02 +02:00
|
|
|
usage 'log'
|
2012-04-22 00:11:05 +02:00
|
|
|
summary 'create new log entry'
|
|
|
|
description 'Opens new log entry in Emacs.'
|
|
|
|
|
|
|
|
module Nanoc::CLI::Commands
|
|
|
|
class CreateLog < ::Nanoc::CLI::CommandRunner
|
|
|
|
def run
|
2012-06-05 01:31:17 +02:00
|
|
|
site = load_site "daily"
|
|
|
|
|
|
|
|
logs = site.items_by_date.select do |i|
|
|
|
|
i.reps.any? {|r| r.name == :wordcount}
|
|
|
|
end
|
|
|
|
|
2012-06-05 08:05:58 +02:00
|
|
|
page = "content_daily" + logs.last.identifier.gsub(/(\d+)/){|s| s.to_i + 1}.chop + ".mkd"
|
2012-04-22 00:11:05 +02:00
|
|
|
puts "editing: #{page}..."
|
2012-06-05 02:49:47 +02:00
|
|
|
system "emacs-gui #{page}"
|
2012-04-22 00:11:05 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
runner Nanoc::CLI::Commands::CreateLog
|
|
|
|
|
|
|
|
|