Permalink
Browse files

Added a Rakefile task to show outdated translations of pages

  • Loading branch information...
1 parent 9615064 commit f1851260d9fc44a6a2515ab6991d5e86e0ac403a @gettalong committed Feb 19, 2010
Showing with 27 additions and 2 deletions.
  1. +27 −2 data/webgen/website_skeleton/Rakefile
@@ -9,13 +9,38 @@
#
require 'webgen/webgentask'
+require 'webgen/website'
task :default => :webgen
+webgen_config = lambda do |config|
+ # you can set configuration options here
+end
+
Webgen::WebgenTask.new do |website|
website.clobber_outdir = true
- website.config_block = lambda do |config|
- # you can set configuration options here
+ website.config_block = webgen_config
+end
+
+desc "Show outdated translations"
+task :outdated do
+ puts "Listing outdated translations"
+ puts
+ puts "(Note: Information is taken from the last webgen run. To get the"
+ puts " useful information, run webgen once before this task!)"
+ puts
+
+ website = Webgen::Website.new(Dir.pwd, Webgen::Logger.new($stdout), &webgen_config)
+ website.execute_in_env do
+ website.init
+ website.tree.node_access[:acn].each do |acn, versions|
+ main = versions.find {|v| v.lang == website.config['website.lang']}
+ next unless main
+ outdated = versions.select do |v|
+ main != v && main['modified_at'] > v['modified_at']
+ end.map {|v| v.lang}.join(', ')
+ puts "ACN #{acn}: #{outdated}" if outdated.length > 0
+ end
end
end

0 comments on commit f185126

Please sign in to comment.