Changeset 201
- Timestamp:
- 05/23/05 13:30:25 (4 years ago)
- Files:
-
- 1 modified
-
branches/simplest-thing/tools/convertWikiPage.rb (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/simplest-thing/tools/convertWikiPage.rb
r200 r201 1 1 #!/usr/bin/ruby 2 # 3 # A quick hack of a program to convert TWiki-ish formatted pages from the 4 # docs.FaerieMUD.org site into Trac-style pages. 5 # 6 # $Id$ 7 # 8 # = Usage 9 # 10 # convertWikiPage.rb [OPTIONS] <Project> <PageFile> [<PageFile>+] 11 # 12 # Run with '--help' for a list of options. 13 # 2 14 3 15 require 'optparse' 4 16 require 'tempfile' 5 6 #7 # A quick hack of a program to convert TWiki-ish formatted pages from the8 # docs.FaerieMUD.org site into Trac-style pages.9 #10 17 require 'pathname' 11 18 require 'diff/lcs' 12 19 require 'pp' 20 13 21 14 22 TracAdmin = '/usr/local/bin/trac-admin' … … 63 71 project = args.shift or raise "No project specified" 64 72 73 project = File::join( ProjectRoot, project ) unless 74 File::directory?( project ) 75 projectPath = Pathname::new( project ) 76 raise "No such project '%s'" % [projectPath] unless 77 projectPath.exist? 78 debugMsg "Targetting project at %s" % [projectPath] 79 80 raise "No pages to convert" if args.empty? 81 debugMsg "%d pages to convert" % [args.nitems] 82 65 83 args.collect {|arg| Pathname::new(arg) }.each do |path| 66 84 … … 87 105 $deferr.puts "OK" 88 106 end 107 rescue RuntimeError => err 108 $deferr.puts "Error: %s" % err.message 109 exit!( 1 ) 89 110 end 90 111 … … 285 306 ### Invoked trac-admin to import the transformed page +content+ with the 286 307 ### specified +pageName+. 287 def importWikiPage( project, pageName, content, dryrun ) 288 projectPath = File::join( ProjectRoot, project ) 289 308 def importWikiPage( projectPath, pageName, content, dryrun ) 290 309 if dryrun 291 310 debugMsg "Would have imported new content to %s: %s:" %
