Skip to content

Commit 3c405b3

Browse files
committed
feat: Priority Sorting
For most of its existence, MIME::Types has supported a fairly complex sorting algorithm that does not perform well at runtime especially with a growing dataset of MIME types. This branch is based on the idea that we can quantize the sorting of similar types into a byte-packed bucket. For full details of the sort mechanism, see Ruby MIME::Types 3.7.0. The changes here provide the necessary updates to support the new field (sort priority) and to do an in-place update of the data.
1 parent 21a8f9b commit 3c405b3

26 files changed

+2721
-71
lines changed

Manifest.txt

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ data/mime.encoding.column
1616
data/mime.flags.column
1717
data/mime.friendly.column
1818
data/mime.pext.column
19+
data/mime.spri.column
1920
data/mime.use_instead.column
2021
data/mime.xrefs.column
2122
lib/mime-types-data.rb

Rakefile

+8-4
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ require "rubygems"
44
require "hoe"
55
require "rake/clean"
66

7-
$LOAD_PATH.unshift("lib")
8-
$LOAD_PATH.unshift("support")
7+
$LOAD_PATH.unshift("lib", "support")
98

109
Hoe.plugin :halostatue
1110

@@ -29,7 +28,7 @@ Hoe.spec "mime-types-data" do
2928

3029
extra_dev_deps << ["hoe", "~> 4.0"]
3130
extra_dev_deps << ["hoe-halostatue", "~> 2.0"]
32-
extra_dev_deps << ["mime-types", ">= 3.4.0", "< 4"]
31+
extra_dev_deps << ["mime-types", ">= 3.7.0.pre2", "< 4"]
3332
extra_dev_deps << ["nokogiri", "~> 1.6"]
3433
extra_dev_deps << ["rake", ">= 10.0", "< 14"]
3534
extra_dev_deps << ["standard", "~> 1.0"]
@@ -81,13 +80,18 @@ namespace :release do
8180
end
8281
end
8382

84-
desc "Default conversion from YAML to JSON and Columnar"
83+
desc "Full data conversion for release"
8584
task :convert do
8685
require "prepare_release"
8786

8887
PrepareRelease.new.convert_types
8988
end
9089

90+
task "convert:upgrade" do
91+
require "convert"
92+
Convert.from_yaml_to_yaml
93+
end
94+
9195
Rake::Task["gem"].prerequisites.unshift("convert")
9296
Rake::Task["gem"].prerequisites.unshift("git:manifest")
9397
Rake::Task["gem"].prerequisites.unshift("gemspec")

data/content_type_mime.db

+3-15
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)