Module: Logi::Command::List

Extended by:
Logi::Command
Defined in:
lib/logi/command/list.rb

Defined Under Namespace

Classes: Post

Class Method Summary collapse

Methods included from Logi::Command

check_argv, check_layout, check_path, options, tribool

Class Method Details

.run(argv) ⇒ Object



18
19
20
21
22
23
24
25
26
# File 'lib/logi/command/list.rb', line 18

def run argv
  path, layout = argv
  dir = File.dirname(path)
  @posts = Dir["#{dir}/**/*.*"].map{ |post|
    name = post.sub("#{dir}/", '')
    Post.new(name.sub(/\..+$/, '.html'), name.sub(/\..+$/, ''))
  }.sort
  puts Tilt.new(check_layout(layout)).render(self)
end