Permalink
Browse files

Add wiki maintenance scripts.

  • Loading branch information...
1 parent 564a43a commit 93492bf6c2df47ce5df8288fdb34f8ac891994a4 @SaberUK SaberUK committed May 28, 2012
Showing with 27 additions and 0 deletions.
  1. +12 −0 Wiki-Scripts/find-missing-pages
  2. +15 −0 Wiki-Scripts/find-orphaned-pages
@@ -0,0 +1,12 @@
+#!/usr/bin/env ruby
+require 'uri'
+available_files = Dir.glob("**/*.md")
+available_files.each do |file|
+ uris = URI.extract(File.read(file))
+ uris.each do |uri|
+ next unless uri[0..44] == 'https://github.com/inspircd/wiki/blob/master/'
+ path = uri[45..-1].split(')')[0]
+ next if File.exists?(path)
+ puts "MISSING PAGE: #{path} (linked from #{file})"
+ end
+end
@@ -0,0 +1,15 @@
+#!/usr/bin/env ruby
+require 'uri'
+available_files = Dir.glob("**/*.md")
+linked_files = []
+available_files.each do |file|
+ uris = URI.extract(File.read(file))
+ uris.each do |uri|
+ next unless uri[0..44] == 'https://github.com/inspircd/wiki/blob/master/'
+ linked_files << uri[45..-1].split(')')[0]
+ end
+end
+available_files.each do |file|
+ next if linked_files.include?(file)
+ puts "ORPHANED PAGE: #{file}"
+end

0 comments on commit 93492bf

Please sign in to comment.