Sha256: c47cd6e3d5fc21327ddd1f6b3d6c622e4358ff6e19934a0ab38ca9e01e93a5ca

Contents?: true

Size: 422 Bytes

Versions: 1

Compression:

Stored size: 422 Bytes

Contents

require 'tilt'

class  Logi         ; end
module Logi::Command; end
module Logi::Command::List
  Post = Struct.new(:link, :title)

  module_function
  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(/\..+$/, ''))
    }
    puts Tilt.new(layout).render(self)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
logi-0.1.0 lib/logi/command/list.rb