mime-types-data 3.2016.0521 → 3.2022.0105

Sign up to get free protection for your applications and to get access to all the features.
data/Licence.md CHANGED
@@ -1,6 +1,6 @@
1
1
  ## Licence
2
2
 
3
- * Copyright 2003–2016 Austin Ziegler and other contributors.
3
+ - Copyright 2003–2021 Austin Ziegler and other contributors.
4
4
 
5
5
  The software in this repository is made available under the MIT license.
6
6
 
@@ -9,17 +9,16 @@ The software in this repository is made available under the MIT license.
9
9
  Permission is hereby granted, free of charge, to any person obtaining a copy of
10
10
  this software and associated documentation files (the "Software"), to deal in
11
11
  the Software without restriction, including without limitation the rights to
12
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
13
- of the Software, and to permit persons to whom the Software is furnished to do
14
- so, subject to the following conditions:
12
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
13
+ the Software, and to permit persons to whom the Software is furnished to do so,
14
+ subject to the following conditions:
15
15
 
16
16
  The above copyright notice and this permission notice shall be included in all
17
17
  copies or substantial portions of the Software.
18
18
 
19
19
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
- SOFTWARE.
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
21
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
22
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
23
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
24
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Manifest.txt CHANGED
@@ -5,6 +5,8 @@ Licence.md
5
5
  Manifest.txt
6
6
  README.md
7
7
  Rakefile
8
+ data/content_type_mime.db
9
+ data/ext_mime.db
8
10
  data/mime-types.json
9
11
  data/mime.content_type.column
10
12
  data/mime.docs.column
@@ -16,3 +18,17 @@ data/mime.use_instead.column
16
18
  data/mime.xrefs.column
17
19
  lib/mime-types-data.rb
18
20
  lib/mime/types/data.rb
21
+ types/application.yaml
22
+ types/audio.yaml
23
+ types/chemical.yaml
24
+ types/conference.yaml
25
+ types/drawing.yaml
26
+ types/font.yaml
27
+ types/image.yaml
28
+ types/message.yaml
29
+ types/model.yaml
30
+ types/multipart.yaml
31
+ types/provisional-standard-types.yaml
32
+ types/text.yaml
33
+ types/video.yaml
34
+ types/world.yaml
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # mime-types-data
2
2
 
3
- * home :: https://github.com/mime-types/mime-types-data/
4
- * code :: https://github.com/mime-types/mime-types-data/
5
- * issues :: https://github.com/mime-types/mime-types-data/issues
3
+ - home :: https://github.com/mime-types/mime-types-data/
4
+ - code :: https://github.com/mime-types/mime-types-data/
5
+ - issues :: https://github.com/mime-types/mime-types-data/issues
6
6
 
7
7
  ## Description
8
8
 
@@ -24,18 +24,29 @@ contributions. It conforms to RFCs 2045 and 2231.
24
24
 
25
25
  ### Data Formats Supported in this Registry
26
26
 
27
- This registry contains the MIME media types in three formats:
27
+ This registry contains the MIME media types in four formats:
28
28
 
29
- * A YAML format matching the Ruby mime-types library objects (MIME::Type).
30
- This is the primary user-editable format.
31
- * A JSON format converted from the YAML format. Prior to Ruby mime-types 3.0,
32
- this was the main consumption format and is still recommended for any
33
- implementation that does not wish to implement the columnar format.
34
- * An encoded text format splitting the data for each MIME type across
35
- multiple files. This columnar data format reduces the minimal data load
36
- substantially, resulting in a performance improvement at the cost of more
37
- complex code for loading the data on-demand. This is the default format for
38
- Ruby mime-types 3.0.
29
+ - A YAML format matching the Ruby mime-types library objects (MIME::Type).
30
+ This is the primary user-editable format for developers. It is _not_
31
+ shipped with the gem due to size considerations.
32
+ - A JSON format converted from the YAML format. Prior to Ruby mime-types 3.0,
33
+ this was the main consumption format and is still recommended for any
34
+ implementation that does not wish to implement the columnar format, which
35
+ has a significant implementation effort cost.
36
+ - An encoded text format splitting the data for each MIME type across
37
+ multiple files. This columnar data format reduces the minimal data load
38
+ substantially, resulting in a performance improvement at the cost of more
39
+ complex code for loading the data on-demand. This is the default format for
40
+ Ruby mime-types 3.0.
41
+ - An encoded text format for use with [`mini_mime`][] (as of 3.2021.1108). This
42
+ can be enabled with:
43
+
44
+ ```ruby
45
+ MiniMime::Configuration.ext_db_path =
46
+ File.join(MIME::Types::Data::PATH, "ext_mime.db")
47
+ MiniMime::Configuration.content_type_db_path =
48
+ File.join(MIME::Types::Data::PATH, "content_type_mime.db")
49
+ ```
39
50
 
40
51
  ## mime-types-data Modified Semantic Versioning
41
52
 
@@ -43,19 +54,20 @@ mime-types-data uses a heavily modified [Semantic Versioning][] scheme to
43
54
  indicate that the data formats compatibility based on a `SCHEMA` version and
44
55
  the date of the data update: `SCHEMA.YEAR.MONTHDAY`.
45
56
 
46
- 1. If an incompatible data format change is made to any of the supported
47
- formts, `SCHEMA` will be incremented. The current `SCHEMA` is 3, supporting
48
- the YAML, JSON, and columnar formats required for Ruby mime-types 3.0.
57
+ 1. If an incompatible data format change is made to any of the supported
58
+ formts, `SCHEMA` will be incremented. The current `SCHEMA` is 3, supporting
59
+ the YAML, JSON, and columnar formats required for Ruby mime-types 3.0.
49
60
 
50
- 2. When the data is updated, the `YEAR.MONTHDAY` combination will be updated.
51
- An update on the last day of October 2015 would be written as `2015.1031`,
52
- resulting in the full version of `3.2015.1031`.
61
+ 2. When the data is updated, the `YEAR.MONTHDAY` combination will be updated.
62
+ An update on the last day of October 2015 would be written as `2015.1031`,
63
+ resulting in the full version of `3.2015.1031`.
53
64
 
54
- 3. If multiple versions of the data need to be released on the same day due to
55
- error, there will be an additional `REVISION` field incremented on the end
56
- of the version. Thus, if three revisions need to be published on October
57
- 31st, 2015, the last release would be `3.2015.1031.2` (remember that the
58
- first release has an implied `0`.)
65
+ 3. If multiple versions of the data need to be released on the same day due to
66
+ error, there will be an additional `REVISION` field incremented on the end
67
+ of the version. Thus, if three revisions need to be published on October
68
+ 31st, 2015, the last release would be `3.2015.1031.2` (remember that the
69
+ first release has an implied `0`.)
59
70
 
60
71
  [registry]: https://www.iana.org/assignments/media-types/media-types.xhtml
61
- [Semantic Versioning]: http://semver.org/
72
+ [semantic versioning]: http://semver.org/
73
+ [`mini_mime`]: https://github.com/discourse/mini_mime
data/Rakefile CHANGED
@@ -1,80 +1,155 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'rubygems'
4
- require 'hoe'
5
- require 'rake/clean'
3
+ require "rubygems"
4
+ require "hoe"
5
+ require "rake/clean"
6
6
 
7
7
  Hoe.plugin :doofus
8
8
  Hoe.plugin :gemspec2
9
9
  Hoe.plugin :git
10
10
  Hoe.plugin :travis
11
- Hoe.plugin :email unless ENV['CI'] or ENV['TRAVIS']
11
+ Hoe.plugin :email unless ENV["CI"] || ENV["TRAVIS"]
12
12
 
13
- Hoe.spec 'mime-types-data' do
14
- developer('Austin Ziegler', 'halostatue@gmail.com')
13
+ Hoe.spec "mime-types-data" do
14
+ developer("Austin Ziegler", "halostatue@gmail.com")
15
15
 
16
- require_ruby_version '>= 2.0'
16
+ require_ruby_version ">= 2.0"
17
17
 
18
- self.history_file = 'History.md'
19
- self.readme_file = 'README.md'
18
+ self.history_file = "History.md"
19
+ self.readme_file = "README.md"
20
20
 
21
- license 'MIT'
21
+ license "MIT"
22
22
 
23
- extra_dev_deps << ['nokogiri', '~> 1.6']
24
- extra_dev_deps << ['hoe-doofus', '~> 1.0']
25
- extra_dev_deps << ['hoe-gemspec2', '~> 1.1']
26
- extra_dev_deps << ['hoe-git', '~> 1.6']
27
- extra_dev_deps << ['hoe-rubygems', '~> 1.0']
28
- extra_dev_deps << ['rake', '~> 10.0']
29
- extra_dev_deps << ['mime-types', '~> 3.0']
23
+ extra_dev_deps << ["nokogiri", "~> 1.6"]
24
+ extra_dev_deps << ["hoe-doofus", "~> 1.0"]
25
+ extra_dev_deps << ["hoe-gemspec2", "~> 1.1"]
26
+ extra_dev_deps << ["hoe-git", "~> 1.6"]
27
+ extra_dev_deps << ["hoe-rubygems", "~> 1.0"]
28
+ extra_dev_deps << ["rake", ">= 10.0", "< 14"]
29
+ extra_dev_deps << ["mime-types", ">= 3.4.0", "< 4"]
30
+ extra_dev_deps << ["standardrb", "~> 1.0"]
31
+ extra_dev_deps << ["psych", "~> 3.0"]
30
32
  end
31
33
 
32
- $LOAD_PATH.unshift 'lib'
33
- $LOAD_PATH.unshift 'support'
34
+ $LOAD_PATH.unshift "lib"
35
+ $LOAD_PATH.unshift "support"
36
+
37
+ def new_version
38
+ version =
39
+ IO.read("lib/mime/types/data.rb").scan(/VERSION = ['"](\d\.\d{4}\.\d{4})['"]/).flatten.first
40
+
41
+ major = Gem::Version.new(version).canonical_segments.first
42
+ minor = Date.today.strftime("%Y.%m%d")
43
+
44
+ "#{major}.#{minor}"
45
+ end
46
+
47
+ def release_header
48
+ "#{new_version} / #{Date.today.strftime("%Y-%m-%d")}"
49
+ end
34
50
 
35
51
  namespace :mime do
36
- desc 'Download the current MIME type registrations from IANA.'
37
- task :iana, [ :destination ] do |_, args|
38
- require 'iana_registry'
52
+ desc "Download the current MIME type registrations from IANA."
53
+ task :iana, [:destination] do |_, args|
54
+ require "iana_registry"
39
55
  IANARegistry.download(to: args.destination)
40
56
  end
41
57
 
42
- desc 'Download the current MIME type configuration from Apache.'
43
- task :apache, [ :destination ] do |_, args|
44
- require 'apache_mime_types'
58
+ desc "Download the current MIME type configuration from Apache."
59
+ task :apache, [:destination] do |_, args|
60
+ require "apache_mime_types"
45
61
  ApacheMIMETypes.download(to: args.destination)
46
62
  end
47
63
  end
48
64
 
65
+ namespace :release do
66
+ task __pull: %w[mime:apache mime:iana convert]
67
+ task __prepare: %w[update:version update:history git:manifest]
68
+ task :__commit do
69
+ history = IO.read("History.md")
70
+ message = history.scan(%r{## (#{release_header}.+?)## \d\.\d{4}\.\d{4} /}m).flatten.first
71
+
72
+ IO.popen("git commit -a -F -", "w") { |commit|
73
+ commit.puts message
74
+ }
75
+ end
76
+
77
+ desc "Prepare a new automatic release"
78
+ task automatic: :__pull do
79
+ if system("git diff --quiet --exit-code") == false
80
+ Rake::Task["release:__prepare"].invoke
81
+ Rake::Task["gemspec"].invoke
82
+ Rake::Task["release:__commit"].invoke
83
+ else
84
+ warn "No changes detected."
85
+ end
86
+ end
87
+ end
88
+
49
89
  namespace :convert do
50
90
  namespace :yaml do
51
- desc 'Convert from YAML to JSON'
52
- task :json, [ :source, :destination, :multiple_files ] => :support do |_, args|
53
- require 'convert'
91
+ desc "Convert from YAML to JSON"
92
+ task :json, [:source, :destination, :multiple_files] => :support do |_, args|
93
+ require "convert"
54
94
  Convert.from_yaml_to_json(args)
55
95
  end
56
96
 
57
- desc 'Convert from YAML to Columnar'
58
- task :columnar, [ :source, :destination ] => :support do |_, args|
59
- require 'convert/columnar'
97
+ desc "Convert from YAML to Columnar"
98
+ task :columnar, [:source, :destination] => :support do |_, args|
99
+ require "convert/columnar"
60
100
  Convert::Columnar.from_yaml_to_columnar(args)
61
101
  end
102
+
103
+ desc "Convert from YAML to mini_mime db format"
104
+ task :mini_mime, [:source, :destination] => :support do |_, args|
105
+ require "convert/mini_mime_db"
106
+ Convert::MiniMimeDb.from_yaml_to_mini_mime(args)
107
+ end
62
108
  end
63
109
 
64
110
  namespace :json do
65
- desc 'Convert from JSON to YAML'
66
- task :yaml, [ :source, :destination, :multiple_files ] => :support do |_, args|
67
- require 'convert'
111
+ desc "Convert from JSON to YAML"
112
+ task :yaml, [:source, :destination, :multiple_files] => :support do |_, args|
113
+ require "convert"
68
114
  Convert.from_json_to_yaml(args)
69
115
  end
70
116
  end
71
117
  end
72
118
 
73
- desc 'Default conversion from YAML to JSON and Columnar'
74
- task convert: [ 'convert:yaml:json', 'convert:yaml:columnar' ]
119
+ namespace :update do
120
+ desc "Update the release version"
121
+ task :version do
122
+ file = IO.read("lib/mime/types/data.rb")
123
+ updated = file.sub(/VERSION = ['"][.0-9]+['"]/, %Q(VERSION = "#{new_version}"))
124
+
125
+ IO.write("lib/mime/types/data.rb", updated)
126
+ end
127
+
128
+ desc "Update the history file with automatic release notes"
129
+ task :history do
130
+ history = IO.read("History.md")
131
+
132
+ if !/^## #{release_header}$/.match?(history)
133
+ note = <<-NOTE
134
+ <!-- automatic-release -->
135
+
136
+ ## #{release_header}
137
+
138
+ - Updated the Apache and IANA media registry entries as of release date.
139
+ NOTE
140
+
141
+ updated = history.sub(/<!-- automatic-release -->\n/, note)
142
+
143
+ IO.write("History.md", updated)
144
+ end
145
+ end
146
+ end
147
+
148
+ desc "Default conversion from YAML to JSON and Columnar"
149
+ task convert: ["convert:yaml:json", "convert:yaml:columnar", "convert:yaml:mini_mime"]
75
150
 
76
- Rake::Task['gem'].prerequisites.unshift('convert')
77
- Rake::Task['gem'].prerequisites.unshift('git:manifest')
78
- Rake::Task['gem'].prerequisites.unshift('gemspec')
151
+ Rake::Task["gem"].prerequisites.unshift("convert")
152
+ Rake::Task["gem"].prerequisites.unshift("git:manifest")
153
+ Rake::Task["gem"].prerequisites.unshift("gemspec")
79
154
 
80
155
  # vim: syntax=ruby