Class: Juli::Command::Sitemap

Inherits:
Object
  • Object
show all
Includes:
Util, Visitor::Html::TagHelper
Defined in:
lib/juli/command/sitemap.rb

Overview

generate sitemap.html and sitemap_order_by_mtime_DESC.html under $JULI_REPO

Instance Method Summary collapse

Methods included from Visitor::Html::TagHelper

#content_tag, #tag

Methods included from Util

#camelize, conf, find_template, in_filename, juli_repo, mkdir, out_filename, str_limit, str_trim, to_wikiname, underscore, usage, visitor, visitor_list

Constructor Details

#initializeSitemap

cache File info



9
10
11
12
13
14
15
16
# File 'lib/juli/command/sitemap.rb', line 9

def initialize
  @file = []
  Dir.chdir(juli_repo){
    Dir.glob('**/*.txt'){|f|
      @file << FileEntry.new(f, File.stat(f).mtime)
    }
  }
end

Instance Method Details

#run(opts) ⇒ Object



18
19
20
21
22
23
# File 'lib/juli/command/sitemap.rb', line 18

def run(opts)
  sitemap_sub('sitemap.html'){|files| files.sort}
  sitemap_sub('sitemap_order_by_mtime_DESC.html'){|files|
    files.sort{|a,b| File.stat(a).mtime <=> File.stat(b).mtime}.reverse
  }
end