mime-types 1.16 → 1.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gemtest +0 -0
- data/.hoerc +12 -0
- data/{History.txt → History.rdoc} +17 -0
- data/Licence.rdoc +10 -0
- data/Manifest.txt +36 -6
- data/README.rdoc +19 -0
- data/Rakefile +138 -255
- data/lib/mime/types.rb +117 -25
- data/lib/mime/{types.rb.data → types/application} +306 -690
- data/lib/mime/types/application.mac +2 -0
- data/lib/mime/types/application.nonstandard +114 -0
- data/lib/mime/types/application.obsolete +40 -0
- data/lib/mime/types/audio +131 -0
- data/lib/mime/types/audio.nonstandard +10 -0
- data/lib/mime/types/audio.obsolete +1 -0
- data/lib/mime/types/image +43 -0
- data/lib/mime/types/image.nonstandard +17 -0
- data/lib/mime/types/image.obsolete +5 -0
- data/lib/mime/types/message +19 -0
- data/lib/mime/types/message.obsolete +1 -0
- data/lib/mime/types/model +15 -0
- data/lib/mime/types/multipart +14 -0
- data/lib/mime/types/multipart.nonstandard +1 -0
- data/lib/mime/types/multipart.obsolete +7 -0
- data/lib/mime/types/other.nonstandard +8 -0
- data/lib/mime/types/text +54 -0
- data/lib/mime/types/text.nonstandard +5 -0
- data/lib/mime/types/text.obsolete +7 -0
- data/lib/mime/types/text.vms +1 -0
- data/lib/mime/types/video +68 -0
- data/lib/mime/types/video.nonstandard +11 -0
- data/lib/mime/types/video.obsolete +3 -0
- data/mime-types.gemspec +40 -26
- data/test/test_mime_type.rb +262 -300
- data/test/test_mime_types.rb +74 -97
- data/type-lists/application.txt +951 -0
- data/type-lists/audio.txt +132 -0
- data/type-lists/image.txt +43 -0
- data/type-lists/message.txt +20 -0
- data/type-lists/model.txt +15 -0
- data/type-lists/multipart.txt +14 -0
- data/type-lists/text.txt +57 -0
- data/type-lists/video.txt +67 -0
- metadata +205 -64
- data.tar.gz.sig +0 -2
- data/Install.txt +0 -17
- data/Licence.txt +0 -15
- data/README.txt +0 -28
- data/setup.rb +0 -1585
- metadata.gz.sig +0 -0
data/.gemtest
ADDED
File without changes
|
data/.hoerc
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
---
|
2
|
+
publish_on_announce: false
|
3
|
+
exclude: !ruby/regexp /\.(?:svn|git)|(?:\.(?:swp|hoerc|DS_Store)|~|email.txt)$|(?:coverage|type-lists)\//
|
4
|
+
signing_key_file: ~/.gem/gem-private_key.pem
|
5
|
+
signing_cert_file: ~/.gem/gem-public_cert.pem
|
6
|
+
blogs:
|
7
|
+
- user: user
|
8
|
+
url: url
|
9
|
+
extra_headers:
|
10
|
+
mt_convert_breaks: markdown
|
11
|
+
blog_id: blog_id
|
12
|
+
password: password
|
@@ -1,3 +1,20 @@
|
|
1
|
+
== MIME::Types 1.17 / 2011-MM-DD
|
2
|
+
* Minor Enhancements:
|
3
|
+
* Implemented modern 'hoe' semantics.
|
4
|
+
* Switched to minitest instead of test/unit.
|
5
|
+
* Converted documentation from .txt to .rdoc.
|
6
|
+
* Removed setup.rb. (Issue #3:
|
7
|
+
https://github.com/halostatue/mime-types/issues/3).
|
8
|
+
* Should no longer complain about missing RubyGems keys (Issue #2:
|
9
|
+
https://github.com/halostatue/mime-types/issues/2).
|
10
|
+
* Added .mp4 and .mpg4 as recognized extensions for
|
11
|
+
{application,audio,video}/mp4 per RFC4337. (Issue #1:
|
12
|
+
https://github.com/halostatue/mime-types/issues/1).
|
13
|
+
* Added audio/x-aac and .aac per RubyForge issue #28054
|
14
|
+
(http://rubyforge.org/tracker/index.php?func=detail&aid=28054&group_id=293&atid=1194).
|
15
|
+
* Made it much easier to update MIME types from this point forward.
|
16
|
+
* Updated MIME types from IANA.
|
17
|
+
|
1
18
|
== MIME::Types 1.16
|
2
19
|
* Made compatible with Ruby 1.8.6, 1.8.7, and 1.9.1.
|
3
20
|
* Switched to the 'hoe' gem system and added a lot of build-time tools.
|
data/Licence.rdoc
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
== License
|
2
|
+
|
3
|
+
This software is available under a triple disjunctive license:
|
4
|
+
{Ruby's license}[http://www.ruby-lang.org/en/LICENSE.txt],
|
5
|
+
the
|
6
|
+
{Perl Artistic license}[http://www.perl.com/pub/a/language/misc/Artistic.html],
|
7
|
+
or the {GNU GPL version 2}[http://www.gnu.org/licenses/old-licenses/gpl-2.0.html]
|
8
|
+
(or at your option, any later verison).
|
9
|
+
|
10
|
+
If you do not accept one of these licences, you may not use this software.
|
data/Manifest.txt
CHANGED
@@ -1,12 +1,42 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
Licence.
|
1
|
+
.hoerc
|
2
|
+
History.rdoc
|
3
|
+
Licence.rdoc
|
4
4
|
Manifest.txt
|
5
|
-
README.
|
5
|
+
README.rdoc
|
6
6
|
Rakefile
|
7
7
|
lib/mime/types.rb
|
8
|
-
lib/mime/types
|
8
|
+
lib/mime/types/application
|
9
|
+
lib/mime/types/application.mac
|
10
|
+
lib/mime/types/application.nonstandard
|
11
|
+
lib/mime/types/application.obsolete
|
12
|
+
lib/mime/types/audio
|
13
|
+
lib/mime/types/audio.nonstandard
|
14
|
+
lib/mime/types/audio.obsolete
|
15
|
+
lib/mime/types/image
|
16
|
+
lib/mime/types/image.nonstandard
|
17
|
+
lib/mime/types/image.obsolete
|
18
|
+
lib/mime/types/message
|
19
|
+
lib/mime/types/message.obsolete
|
20
|
+
lib/mime/types/model
|
21
|
+
lib/mime/types/multipart
|
22
|
+
lib/mime/types/multipart.nonstandard
|
23
|
+
lib/mime/types/multipart.obsolete
|
24
|
+
lib/mime/types/other.nonstandard
|
25
|
+
lib/mime/types/text
|
26
|
+
lib/mime/types/text.nonstandard
|
27
|
+
lib/mime/types/text.obsolete
|
28
|
+
lib/mime/types/text.vms
|
29
|
+
lib/mime/types/video
|
30
|
+
lib/mime/types/video.nonstandard
|
31
|
+
lib/mime/types/video.obsolete
|
9
32
|
mime-types.gemspec
|
10
|
-
setup.rb
|
11
33
|
test/test_mime_type.rb
|
12
34
|
test/test_mime_types.rb
|
35
|
+
type-lists/application.txt
|
36
|
+
type-lists/audio.txt
|
37
|
+
type-lists/image.txt
|
38
|
+
type-lists/message.txt
|
39
|
+
type-lists/model.txt
|
40
|
+
type-lists/multipart.txt
|
41
|
+
type-lists/text.txt
|
42
|
+
type-lists/video.txt
|
data/README.rdoc
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
= MIME::Types for Ruby
|
2
|
+
|
3
|
+
== Description
|
4
|
+
|
5
|
+
This library allows for the identification of a file's likely MIME content
|
6
|
+
type. This is release 1.17. The identification of MIME content type is based
|
7
|
+
on a file's filename extensions.
|
8
|
+
|
9
|
+
MIME::Types for Ruby originally based on and synchronized with MIME::Types for
|
10
|
+
Perl by Mark Overmeer, copyright 2001 - 2009. As of version 1.15, the data
|
11
|
+
format for the MIME::Type list has changed and the synchronization will no
|
12
|
+
longer happen.
|
13
|
+
|
14
|
+
Homepage:: http://mime-types.rubyforge.org/
|
15
|
+
GitHub:: http://github.com/halostatue/mime-types/
|
16
|
+
Copyright:: 2002 - 2011, Austin Ziegler
|
17
|
+
Based in part on prior work copyright Mark Overmeer
|
18
|
+
|
19
|
+
:include: License.rdoc
|
data/Rakefile
CHANGED
@@ -1,289 +1,191 @@
|
|
1
|
-
|
2
|
-
#--
|
3
|
-
# MIME::Types
|
4
|
-
# A Ruby implementation of a MIME Types information library. Based in spirit
|
5
|
-
# on the Perl MIME::Types information library by Mark Overmeer.
|
6
|
-
# http://rubyforge.org/projects/mime-types/
|
7
|
-
#
|
8
|
-
# Licensed under the Ruby disjunctive licence with the GNU GPL or the Perl
|
9
|
-
# Artistic licence. See Licence.txt for more information.
|
10
|
-
#
|
11
|
-
# Copyright 2003 - 2009 Austin Ziegler
|
12
|
-
#++
|
1
|
+
# -*- ruby encoding: utf-8 -*-
|
13
2
|
|
14
3
|
require 'rubygems'
|
15
4
|
require 'hoe'
|
16
5
|
|
17
|
-
|
6
|
+
Hoe.plugin :doofus
|
7
|
+
Hoe.plugin :gemspec
|
8
|
+
Hoe.plugin :rubyforge
|
9
|
+
Hoe.plugin :git
|
10
|
+
Hoe.plugin :minitest
|
18
11
|
|
19
|
-
|
12
|
+
spec = Hoe.spec 'mime-types' do
|
13
|
+
self.rubyforge_name = self.name
|
20
14
|
|
21
|
-
|
22
|
-
PKG_VERSION = MIME::Types::VERSION
|
23
|
-
PKG_DIST = "#{PKG_NAME}-#{PKG_VERSION}"
|
24
|
-
PKG_TAR = "pkg/#{PKG_DIST}.tar.gz"
|
25
|
-
MANIFEST = File.read("Manifest.txt").split
|
15
|
+
developer('Austin Ziegler', 'austin@rubyforge.org')
|
26
16
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
p.need_tar = false
|
31
|
-
# need_zip - Should package create a zipfile? [default: false]
|
17
|
+
self.url = "http://mime-types.rubyforge.org/"
|
18
|
+
self.remote_rdoc_dir = 'rdoc'
|
19
|
+
self.rsync_args << ' --exclude=statsvn/'
|
32
20
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
p.summary = %q{Manages a MIME Content-Type database that will return the Content-Type for a given filename.}
|
37
|
-
p.changes = p.paragraphs_of("History.txt", 0..0).join("\n\n")
|
38
|
-
p.description = p.paragraphs_of("README.txt", 1..1).join("\n\n")
|
21
|
+
self.history_file = 'History.rdoc'
|
22
|
+
self.readme_file = 'README.rdoc'
|
23
|
+
self.extra_rdoc_files = FileList["*.rdoc"].to_a
|
39
24
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
p.spec_extras[:extra_rdoc_files] = MANIFEST.grep(/txt$/) - ["Manifest.txt"]
|
25
|
+
self.extra_dev_deps << ['nokogiri', '~> 1.5']
|
26
|
+
self.extra_dev_deps << ['minitest', '~> 2.0']
|
27
|
+
self.extra_dev_deps << ['hoe-doofus', '~> 1.0']
|
28
|
+
self.extra_dev_deps << ['hoe-gemspec', '~> 1.0']
|
29
|
+
self.extra_dev_deps << ['hoe-git', '~> 1.0']
|
30
|
+
self.extra_dev_deps << ['hoe-seattlerb', '~> 1.0']
|
47
31
|
end
|
48
32
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
t.test_files = hoe.test_files
|
54
|
-
t.verbose = true
|
55
|
-
end
|
56
|
-
rescue LoadError
|
57
|
-
puts "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
58
|
-
end
|
33
|
+
namespace :mime do
|
34
|
+
desc "Download the current MIME type registrations from IANA."
|
35
|
+
task :iana, :save, :destination do |t, args|
|
36
|
+
save_type = (args.save || :text).to_sym
|
59
37
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
rescue LoadError
|
64
|
-
puts "Cucumber is not available. In order to run features, you must: sudo gem install cucumber"
|
65
|
-
=end
|
66
|
-
|
67
|
-
desc "Build a MIME::Types .tar.gz distribution."
|
68
|
-
task :tar => [ PKG_TAR ]
|
69
|
-
file PKG_TAR => [ :test ] do |t|
|
70
|
-
require 'archive/tar/minitar'
|
71
|
-
require 'zlib'
|
72
|
-
files = MANIFEST.map { |f|
|
73
|
-
fn = File.join(PKG_DIST, f)
|
74
|
-
tm = File.stat(f).mtime
|
75
|
-
|
76
|
-
if File.directory?(f)
|
77
|
-
{ :name => fn, :mode => 0755, :dir => true, :mtime => tm }
|
38
|
+
case save_type
|
39
|
+
when :text, :both, :html
|
40
|
+
nil
|
78
41
|
else
|
79
|
-
|
80
|
-
0755
|
81
|
-
else
|
82
|
-
0644
|
83
|
-
end
|
84
|
-
data = File.read(f)
|
85
|
-
{ :name => fn, :mode => mode, :data => data, :size => data.size,
|
86
|
-
:mtime => tm }
|
87
|
-
end
|
88
|
-
}
|
89
|
-
|
90
|
-
begin
|
91
|
-
unless File.directory?(File.dirname(t.name))
|
92
|
-
require 'fileutils'
|
93
|
-
FileUtils.mkdir_p File.dirname(t.name)
|
94
|
-
end
|
95
|
-
tf = File.open(t.name, 'wb')
|
96
|
-
gz = Zlib::GzipWriter.new(tf)
|
97
|
-
tw = Archive::Tar::Minitar::Writer.new(gz)
|
98
|
-
|
99
|
-
files.each do |entry|
|
100
|
-
if entry[:dir]
|
101
|
-
tw.mkdir(entry[:name], entry)
|
102
|
-
else
|
103
|
-
tw.add_file_simple(entry[:name], entry) { |os|
|
104
|
-
os.write(entry[:data])
|
105
|
-
}
|
106
|
-
end
|
42
|
+
raise "Unknown save type provided. Must be one of text, both, or html."
|
107
43
|
end
|
108
|
-
ensure
|
109
|
-
tw.close if tw
|
110
|
-
gz.close if gz
|
111
|
-
end
|
112
|
-
end
|
113
|
-
task :package => [ PKG_TAR ]
|
114
44
|
|
115
|
-
|
116
|
-
task :build_manifest do |t|
|
117
|
-
require 'find'
|
45
|
+
destination = args.destination || "type-lists"
|
118
46
|
|
119
|
-
|
120
|
-
|
121
|
-
|
47
|
+
require 'open-uri'
|
48
|
+
require 'nokogiri'
|
49
|
+
require 'cgi'
|
122
50
|
|
123
|
-
|
124
|
-
|
125
|
-
next if File.directory?(path) || path =~ hoerc["exclude"]
|
126
|
-
paths << path.sub(%r{^\./}, '')
|
127
|
-
end
|
51
|
+
class IANAParser
|
52
|
+
include Comparable
|
128
53
|
|
129
|
-
|
54
|
+
INDEX = %q(http://www.iana.org/assignments/media-types/)
|
55
|
+
CONTACT_PEOPLE = %r{http://www.iana.org/assignments/contact-people.html?#(.*)}
|
56
|
+
RFC_EDITOR = %r{http://www.rfc-editor.org/rfc/rfc(\d+).txt}
|
57
|
+
IETF_RFC = %r{http://www.ietf.org/rfc/rfc(\d+).txt}
|
58
|
+
IETF_RFC_TOOLS = %r{http://tools.ietf.org/html/rfc(\d+)}
|
130
59
|
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
puts paths
|
136
|
-
end
|
60
|
+
class << self
|
61
|
+
def load_index
|
62
|
+
@types ||= {}
|
137
63
|
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
nil
|
146
|
-
else
|
147
|
-
raise "Unknown save type provided. Must be one of text, both, or html."
|
148
|
-
end
|
149
|
-
|
150
|
-
destination = args.destination || "type-lists"
|
64
|
+
Nokogiri::HTML(open(INDEX) { |f| f.read }).xpath('//p/a').each do |tag|
|
65
|
+
href_match = %r{^/assignments/media-types/(.+)/$}.match(tag['href'])
|
66
|
+
next if href_match.nil?
|
67
|
+
type = href_match.captures[0]
|
68
|
+
@types[tag.content] = IANAParser.new(tag.content, type)
|
69
|
+
end
|
70
|
+
end
|
151
71
|
|
152
|
-
|
153
|
-
|
154
|
-
require 'cgi'
|
72
|
+
attr_reader :types
|
73
|
+
end
|
155
74
|
|
156
|
-
|
157
|
-
|
75
|
+
def initialize(name, type)
|
76
|
+
@name = name
|
77
|
+
@type = type
|
78
|
+
@url = File.join(INDEX, @type)
|
79
|
+
end
|
158
80
|
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
IETF_RFC_TOOLS = %r{http://tools.ietf.org/html/rfc(\d+)}
|
81
|
+
attr_reader :name
|
82
|
+
attr_reader :type
|
83
|
+
attr_reader :url
|
84
|
+
attr_reader :html
|
164
85
|
|
165
|
-
|
166
|
-
|
167
|
-
|
86
|
+
def download(name = nil)
|
87
|
+
@html = Nokogiri::HTML(open(name || @url) { |f| f.read })
|
88
|
+
end
|
168
89
|
|
169
|
-
|
170
|
-
|
171
|
-
next if href_match.nil?
|
172
|
-
type = href_match.captures[0]
|
173
|
-
@types[tag.content] = IANAParser.new(tag.content, type)
|
174
|
-
end
|
90
|
+
def save_html
|
91
|
+
File.open("#@name.html", "wb") { |w| w.write @html }
|
175
92
|
end
|
176
93
|
|
177
|
-
|
178
|
-
|
94
|
+
def <=>(o)
|
95
|
+
self.name <=> o.name
|
96
|
+
end
|
179
97
|
|
180
|
-
|
181
|
-
|
182
|
-
@type = type
|
183
|
-
@url = File.join(INDEX, @type)
|
184
|
-
end
|
98
|
+
def parse
|
99
|
+
nodes = html.xpath("//table//table//tr")
|
185
100
|
|
186
|
-
|
187
|
-
|
188
|
-
attr_reader :url
|
189
|
-
attr_reader :html
|
101
|
+
# How many <td> children does the first node have?
|
102
|
+
node_count = nodes.first.children.select { |n| n.elem? }.size
|
190
103
|
|
191
|
-
|
192
|
-
|
193
|
-
|
104
|
+
if node_count == 1
|
105
|
+
# The title node doesn't have what we expect. Let's try it based
|
106
|
+
# on the first real node.
|
107
|
+
node_count = nodes.first.next.children.select { |n| n.elem? }.size
|
108
|
+
end
|
194
109
|
|
195
|
-
|
196
|
-
|
197
|
-
|
110
|
+
@mime_types = nodes.map do |node|
|
111
|
+
next if node == nodes.first
|
112
|
+
elems = node.children.select { |n| n.elem? }
|
113
|
+
next if elems.size.zero?
|
198
114
|
|
199
|
-
|
200
|
-
self.name <=> o.name
|
201
|
-
end
|
115
|
+
raise "size mismatch #{elems.size} != #{node_count}" if node_count != elems.size
|
202
116
|
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
raise "size mismatch #{elems.size} != #{node_count}" if node_count != elems.size
|
214
|
-
|
215
|
-
case elems.size
|
216
|
-
when 3
|
217
|
-
subtype_index = 1
|
218
|
-
refnode_index = 2
|
219
|
-
when 4
|
220
|
-
subtype_index = 1
|
221
|
-
refnode_index = 3
|
222
|
-
else
|
223
|
-
raise "Unknown element size."
|
224
|
-
end
|
117
|
+
case elems.size
|
118
|
+
when 3
|
119
|
+
subtype_index = 1
|
120
|
+
refnode_index = 2
|
121
|
+
when 4
|
122
|
+
subtype_index = 1
|
123
|
+
refnode_index = 3
|
124
|
+
else
|
125
|
+
raise "Unknown element size."
|
126
|
+
end
|
225
127
|
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
128
|
+
subtype = elems[subtype_index].content.chomp.strip
|
129
|
+
refnodes = elems[refnode_index].children.select { |n| n.elem? }.map { |ref|
|
130
|
+
case ref['href']
|
131
|
+
when CONTACT_PEOPLE
|
132
|
+
tag = CGI::unescape($1).chomp.strip
|
133
|
+
if tag == ref.content
|
232
134
|
"[#{ref.content}]"
|
233
|
-
|
135
|
+
else
|
234
136
|
"[#{ref.content}=#{tag}]"
|
235
|
-
|
236
|
-
|
137
|
+
end
|
138
|
+
when RFC_EDITOR, IETF_RFC, IETF_RFC_TOOLS
|
237
139
|
"RFC#$1"
|
238
|
-
|
140
|
+
when %r{(https?://.*)}
|
239
141
|
"{#{ref.content}=#$1}"
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
142
|
+
else
|
143
|
+
ref
|
144
|
+
end
|
145
|
+
}
|
146
|
+
refs = refnodes.join(',')
|
245
147
|
|
246
148
|
"#@type/#{subtype} 'IANA,#{refs}"
|
247
|
-
|
149
|
+
end.compact
|
248
150
|
|
249
|
-
|
250
|
-
|
151
|
+
@mime_types
|
152
|
+
end
|
251
153
|
|
252
|
-
|
253
|
-
|
154
|
+
def save_text
|
155
|
+
File.open("#@name.txt", "wb") { |w| w.write @mime_types.join("\n") }
|
156
|
+
end
|
254
157
|
end
|
255
|
-
end
|
256
158
|
|
257
|
-
|
258
|
-
|
159
|
+
puts "Downloading index of MIME types from #{IANAParser::INDEX}."
|
160
|
+
IANAParser.load_index
|
259
161
|
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
162
|
+
require 'fileutils'
|
163
|
+
FileUtils.mkdir_p destination
|
164
|
+
Dir.chdir destination do
|
165
|
+
IANAParser.types.values.sort.each do |parser|
|
166
|
+
next if parser.name == "example" or parser.name == "mime"
|
167
|
+
puts "Downloading #{parser.name} from #{parser.url}"
|
168
|
+
parser.download
|
267
169
|
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
170
|
+
if :html == save_type || :both == save_type
|
171
|
+
puts "Saving #{parser.name}.html"
|
172
|
+
parser.save_html
|
173
|
+
end
|
272
174
|
|
273
|
-
|
274
|
-
|
175
|
+
puts "Parsing #{parser.name} HTML"
|
176
|
+
parser.parse
|
275
177
|
|
276
|
-
|
277
|
-
|
278
|
-
|
178
|
+
if :text == save_type || :both == save_type
|
179
|
+
puts "Saving #{parser.name}.txt"
|
180
|
+
parser.save_text
|
181
|
+
end
|
279
182
|
end
|
280
183
|
end
|
281
184
|
end
|
282
|
-
end
|
283
185
|
|
284
|
-
desc "Shows known MIME type sources."
|
285
|
-
task :mime_type_sources do
|
286
|
-
|
186
|
+
desc "Shows known MIME type sources."
|
187
|
+
task :mime_type_sources do
|
188
|
+
puts <<-EOS
|
287
189
|
http://www.ltsw.se/knbase/internet/mime.htp
|
288
190
|
http://www.webmaster-toolkit.com/mime-types.shtml
|
289
191
|
http://plugindoc.mozdev.org/winmime.php
|
@@ -291,26 +193,7 @@ http://standards.freedesktop.org/shared-mime-info-spec/shared-mime-info-spec-lat
|
|
291
193
|
http://www.feedforall.com/mime-types.htm
|
292
194
|
http://www.iana.org/assignments/media-types/
|
293
195
|
EOS
|
294
|
-
end
|
295
|
-
|
296
|
-
desc "Validate the RubyGem spec for GitHub."
|
297
|
-
task :github_validate_spec do |t|
|
298
|
-
require 'yaml'
|
299
|
-
|
300
|
-
require 'rubygems/specification'
|
301
|
-
data = File.read("#{PKG_NAME}.gemspec")
|
302
|
-
spec = nil
|
303
|
-
|
304
|
-
if data !~ %r{!ruby/object:Gem::Specification}
|
305
|
-
code = "$SAFE = 3\n#{data}"
|
306
|
-
p code.split($/)[44]
|
307
|
-
Thread.new { spec = eval("$SAFE = 3\n#{data}") }.join
|
308
|
-
else
|
309
|
-
spec = YAML.load(data)
|
310
196
|
end
|
311
|
-
|
312
|
-
spec.validate
|
313
|
-
|
314
|
-
puts spec
|
315
|
-
puts "OK"
|
316
197
|
end
|
198
|
+
|
199
|
+
# vim: syntax=ruby
|