Class: Middleman::Cli::Entry

Inherits:
Thor::Group
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/middleman-journal/commands/entry.rb

Overview

This class provides an “entry” command for the middleman CLI.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootString

Template files are relative to this file

Returns:

  • (String)


23
24
25
# File 'lib/middleman-journal/commands/entry.rb', line 23

def self.source_root
  File.dirname(__FILE__)
end

Instance Method Details

#entryObject



31
32
33
34
35
36
37
# File 'lib/middleman-journal/commands/entry.rb', line 31

def entry
  @date = options[:date] ? Chronic.parse(options[:date]) : Date.today
  @title = @date.strftime('%F')
  @slug = @date.strftime('%F')

  template template_path, destination_path
end