lib/logi/command/list.rb in logi-0.1.0 vs lib/logi/command/list.rb in logi-0.1.1
- old
+ new
@@ -1,19 +1,27 @@
+require 'logi/command'
+
require 'tilt'
class Logi ; end
module Logi::Command; end
module Logi::Command::List
- Post = Struct.new(:link, :title)
+ extend Logi::Command
+ class Post < Struct.new(:link, :title)
+ def <=> that
+ link <=> that.link
+ end
+ end
+
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)
+ }.sort
+ puts Tilt.new(check_layout(layout)).render(self)
end
end