summary refs log tree commit diff stats
path: root/data/generate.rb
diff options
context:
space:
mode:
Diffstat (limited to 'data/generate.rb')
-rwxr-xr-xdata/generate.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/data/generate.rb b/data/generate.rb
new file mode 100755
index 00000000..52a4c8e4
--- /dev/null
+++ b/data/generate.rb
@@ -0,0 +1,21 @@
+#!/usr/bin/ruby
+## Parses mime.types and creates mime.dat
+
+file = File.read(ARGV.first || "mime.types")
+
+table = {}
+for line in file.lines
+	next if line[0] == ?# or
+		line.size <= 3 or
+		!line.include?( ?\t )
+
+	name, *extensions = line.split(/\s+/)
+	for ext in extensions
+		table[ext] = name
+	end
+end
+
+File.open( 'mime.dat', 'w' ) do |f|
+	f.write Marshal.dump( table )
+end
+
gt; 2012-07-08 23:40:15 +0100 committer James Booth <boothj5@gmail.com> 2012-07-08 23:40:15 +0100 Added headunit to autotools files' href='/danisanti/profani-tty/commit/Makefile.am?id=c588a1188315019cf01233a7da7960b7e69716a3'>c588a118 ^
2655d9e8 ^
3e92c60e ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18