Class: Juli::Command::RecentUpdate
- Inherits:
-
Object
- Object
- Juli::Command::RecentUpdate
- Includes:
- Util, Visitor::Html::TagHelper
- Defined in:
- lib/juli/command/recent_update.rb
Overview
generate recent_updates.shtml which lists recent updated entries. The file is for server-side-include(SSI).
Constant Summary collapse
- FILE_LIMIT =
define maximum file limit in order to reduce process time.
20
Instance Method Summary collapse
-
#initialize ⇒ RecentUpdate
constructor
cache recent_update.
- #run(opts) ⇒ Object
Methods included from Visitor::Html::TagHelper
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
#initialize ⇒ RecentUpdate
cache recent_update
12 13 14 15 16 17 18 19 20 |
# File 'lib/juli/command/recent_update.rb', line 12 def initialize @file = [] Dir.chdir(juli_repo){ Dir.glob('**/*.txt'){|f| @file << FileEntry.new(f, File.stat(f).mtime) } @file.sort!{|a,b| b.mtime <=> a.mtime} } end |
Instance Method Details
#run(opts) ⇒ Object
22 23 24 25 26 |
# File 'lib/juli/command/recent_update.rb', line 22 def run(opts) File.open(File.join(conf['output_top'], 'recent_update.shtml'), 'w') do |f| f.write(gen(opts)) end end |