[DRE-commits] r3405 - in packages-wip: . libole-ruby libole-ruby/branches libole-ruby/branches/upstream libole-ruby/branches/upstream/current libole-ruby/branches/upstream/current/bin

Gunnar Wolf gwolf at alioth.debian.org
Tue Apr 21 18:29:19 UTC 2009


Author: gwolf
Date: 2009-04-21 18:29:19 +0000 (Tue, 21 Apr 2009)
New Revision: 3405

Added:
   packages-wip/libole-ruby/
   packages-wip/libole-ruby/branches/
   packages-wip/libole-ruby/branches/upstream/
   packages-wip/libole-ruby/branches/upstream/current/
   packages-wip/libole-ruby/branches/upstream/current/bin/
   packages-wip/libole-ruby/branches/upstream/current/bin/oletool
Log:
[svn-inject] Installing original source of libole-ruby

Added: packages-wip/libole-ruby/branches/upstream/current/bin/oletool
===================================================================
--- packages-wip/libole-ruby/branches/upstream/current/bin/oletool	                        (rev 0)
+++ packages-wip/libole-ruby/branches/upstream/current/bin/oletool	2009-04-21 18:29:19 UTC (rev 3405)
@@ -0,0 +1,41 @@
+#! /usr/bin/ruby
+
+require 'optparse'
+require 'rubygems'
+require 'ole/storage'
+
+def oletool
+	opts = {:verbose => false, :action => :tree}
+	op = OptionParser.new do |op|
+		op.banner = "Usage: oletool [options] [files]"
+		op.separator ''
+		op.on('-t', '--tree', 'Dump ole trees for files (default)') { opts[:action] = :tree }
+		op.on('-r', '--repack', 'Repack the ole files in canonical form') { opts[:action] = :repack }
+		op.on('-m', '--mimetype', 'Print the guessed mime types') { opts[:action] = :mimetype }
+		op.on('-y', '--metadata', 'Dump the internal meta data as YAML') { opts[:action] = :metadata }
+		op.separator ''
+		op.on('-v', '--[no-]verbose', 'Run verbosely') { |v| opts[:verbose] = v }
+		op.on_tail('-h', '--help', 'Show this message') { puts op; exit }
+	end
+	files = op.parse ARGV
+	if files.empty?
+		puts 'Must specify 1 or more msg files.'
+		puts op
+		exit 1
+	end
+	Ole::Log.level = opts[:verbose] ? Logger::WARN : Logger::FATAL
+	files.each do |file|
+		case opts[:action]
+		when :tree
+			Ole::Storage.open(file) { |ole| puts ole.root.to_tree }
+		when :repack
+			Ole::Storage.open file, 'rb+', &:repack
+		when :metadata
+			Ole::Storage.open(file) { |ole| y ole.meta_data.to_h }
+		when :mimetype
+			puts Ole::Storage.open(file) { |ole| ole.meta_data.mime_type }
+		end
+	end
+end
+
+oletool


Property changes on: packages-wip/libole-ruby/branches/upstream/current/bin/oletool
___________________________________________________________________
Added: svn:executable
   + 




More information about the Pkg-ruby-extras-commits mailing list