Sha256: 6d6e02e2c8196ea78df51fff5a361676a881a5102a345da767346fc76a36cb68
Contents?: true
Size: 597 Bytes
Versions: 21
Compression:
Stored size: 597 Bytes
Contents
# frozen_string_literal: true def pct_done(done, total) pct = (done.fdiv(total) * 100).to_i pct.to_s.rjust(3) + '%' end desc 'Reindex the wiki pages.' task reindex: :environment do indexer = ClWiki::MemoryIndexer.instance entries = Dir[File.join($wiki_conf.wiki_path, "*#{ClWiki::FILE_EXT}")] entries.each_with_index.map do |fn, idx| if idx.divmod(100)[1].zero? puts print "#{pct_done(idx, entries.length)}: " end page_name = File.basename(fn, ClWiki::FILE_EXT) indexer.reindex_page(page_name) print '.' end puts puts '100%' indexer.save end
Version data entries
21 entries across 21 versions & 1 rubygems