mime-types 2.99.3 → 3.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/{Code-of-Conduct.rdoc → Code-of-Conduct.md} +19 -20
- data/Contributing.md +143 -0
- data/History.md +240 -0
- data/{Licence.rdoc → Licence.md} +4 -18
- data/Manifest.txt +8 -25
- data/README.rdoc +62 -73
- data/Rakefile +175 -58
- data/lib/mime-types.rb +1 -1
- data/lib/mime/type.rb +213 -424
- data/lib/mime/type/columnar.rb +29 -62
- data/lib/mime/types.rb +46 -141
- data/lib/mime/types/_columnar.rb +136 -0
- data/lib/mime/types/cache.rb +51 -73
- data/lib/mime/types/columnar.rb +2 -147
- data/lib/mime/types/container.rb +96 -0
- data/lib/mime/types/deprecations.rb +4 -25
- data/lib/mime/types/full.rb +19 -0
- data/lib/mime/types/loader.rb +12 -141
- data/lib/mime/types/logger.rb +5 -1
- data/lib/mime/types/registry.rb +90 -0
- data/test/minitest_helper.rb +5 -13
- data/test/test_mime_type.rb +470 -456
- data/test/test_mime_types.rb +135 -87
- data/test/test_mime_types_cache.rb +82 -54
- data/test/test_mime_types_class.rb +118 -98
- data/test/test_mime_types_lazy.rb +26 -24
- data/test/test_mime_types_loader.rb +6 -33
- metadata +107 -64
- data/Contributing.rdoc +0 -170
- data/History-Types.rdoc +0 -454
- data/History.rdoc +0 -590
- data/data/mime-types.json +0 -1
- data/data/mime.content_type.column +0 -1980
- data/data/mime.docs.column +0 -1980
- data/data/mime.encoding.column +0 -1980
- data/data/mime.friendly.column +0 -1980
- data/data/mime.obsolete.column +0 -1980
- data/data/mime.registered.column +0 -1980
- data/data/mime.signature.column +0 -1980
- data/data/mime.use_instead.column +0 -1980
- data/data/mime.xrefs.column +0 -1980
- data/docs/COPYING.txt +0 -339
- data/docs/artistic.txt +0 -127
- data/lib/mime/types/loader_path.rb +0 -15
- data/support/apache_mime_types.rb +0 -108
- data/support/benchmarks/load.rb +0 -64
- data/support/benchmarks/load_allocations.rb +0 -83
- data/support/benchmarks/object_counts.rb +0 -41
- data/support/convert.rb +0 -158
- data/support/convert/columnar.rb +0 -88
- data/support/iana_registry.rb +0 -172
@@ -1,47 +1,49 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'mime/types'
|
4
4
|
require 'minitest_helper'
|
5
5
|
|
6
|
-
|
6
|
+
describe MIME::Types, 'lazy loading' do
|
7
7
|
def setup
|
8
|
-
@cache_file = File.expand_path('../cache.tst', __FILE__)
|
9
8
|
ENV['RUBY_MIME_TYPES_LAZY_LOAD'] = 'true'
|
10
|
-
ENV['RUBY_MIME_TYPES_CACHE'] = @cache_file
|
11
|
-
MIME::Types::Cache.save
|
12
9
|
end
|
13
10
|
|
14
11
|
def teardown
|
15
|
-
clear_cache_file
|
16
12
|
reset_mime_types
|
17
|
-
if File.exist? ENV['RUBY_MIME_TYPES_CACHE']
|
18
|
-
FileUtils.rm ENV['RUBY_MIME_TYPES_CACHE']
|
19
|
-
ENV.delete('RUBY_MIME_TYPES_CACHE')
|
20
|
-
end
|
21
13
|
ENV.delete('RUBY_MIME_TYPES_LAZY_LOAD')
|
22
14
|
end
|
23
15
|
|
24
|
-
def clear_cache_file
|
25
|
-
FileUtils.rm @cache_file if File.exist? @cache_file
|
26
|
-
end
|
27
|
-
|
28
16
|
def reset_mime_types
|
29
17
|
MIME::Types.instance_variable_set(:@__types__, nil)
|
30
18
|
MIME::Types.send(:load_default_mime_types)
|
31
19
|
end
|
32
20
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
21
|
+
describe '.lazy_load?' do
|
22
|
+
it 'is true when RUBY_MIME_TYPES_LAZY_LOAD is set' do
|
23
|
+
assert_output '', /RUBY_MIME_TYPES_LAZY_LOAD/ do
|
24
|
+
assert_equal true, MIME::Types.send(:lazy_load?)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'is nil when RUBY_MIME_TYPES_LAZY_LOAD is unset' do
|
29
|
+
ENV['RUBY_MIME_TYPES_LAZY_LOAD'] = nil
|
30
|
+
assert_output '', '' do
|
31
|
+
assert_nil MIME::Types.send(:lazy_load?)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'is false when RUBY_MIME_TYPES_LAZY_LOAD is false' do
|
36
|
+
ENV['RUBY_MIME_TYPES_LAZY_LOAD'] = 'false'
|
37
|
+
assert_output '', /RUBY_MIME_TYPES_LAZY_LOAD/ do
|
38
|
+
assert_equal false, MIME::Types.send(:lazy_load?)
|
39
|
+
end
|
40
|
+
end
|
39
41
|
end
|
40
42
|
|
41
|
-
|
43
|
+
it 'loads lazily when RUBY_MIME_TYPES_LAZY_LOAD is set' do
|
42
44
|
MIME::Types.instance_variable_set(:@__types__, nil)
|
43
|
-
assert_nil
|
44
|
-
refute_nil
|
45
|
-
refute_nil
|
45
|
+
assert_nil MIME::Types.instance_variable_get(:@__types__)
|
46
|
+
refute_nil MIME::Types['text/html'].first
|
47
|
+
refute_nil MIME::Types.instance_variable_get(:@__types__)
|
46
48
|
end
|
47
49
|
end
|
@@ -1,9 +1,9 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'mime/types'
|
4
4
|
require 'minitest_helper'
|
5
5
|
|
6
|
-
|
6
|
+
describe MIME::Types::Loader do
|
7
7
|
def setup
|
8
8
|
@path = File.expand_path('../fixture', __FILE__)
|
9
9
|
@loader = MIME::Types::Loader.new(@path)
|
@@ -12,48 +12,21 @@ class TestMIMETypesLoader < Minitest::Test
|
|
12
12
|
|
13
13
|
def assert_correctly_loaded(types)
|
14
14
|
assert_includes(types, 'application/1d-interleaved-parityfec')
|
15
|
-
assert_deprecated('MIME::Type#references') do
|
16
|
-
assert_empty types['application/acad'].first.references
|
17
|
-
end
|
18
|
-
assert_deprecated('MIME::Type#urls') do
|
19
|
-
assert_empty types['audio/webm'].first.urls
|
20
|
-
end
|
21
15
|
assert_equal(%w(webm), types['audio/webm'].first.extensions)
|
22
16
|
refute(types['audio/webm'].first.registered?)
|
23
17
|
|
24
18
|
assert_equal('Fixes a bug with IE6 and progressive JPEGs',
|
25
19
|
types['image/pjpeg'].first.docs)
|
26
20
|
|
27
|
-
assert_deprecated('MIME::Type#system?') do
|
28
|
-
refute types['application/x-apple-diskimage'].first.system?
|
29
|
-
end
|
30
|
-
assert_deprecated('MIME::Type#system') do
|
31
|
-
assert_nil types['application/x-apple-diskimage'].first.system
|
32
|
-
end
|
33
|
-
|
34
21
|
assert(types['audio/vnd.qcelp'].first.obsolete?)
|
35
22
|
assert_equal('audio/QCELP', types['audio/vnd.qcelp'].first.use_instead)
|
36
23
|
end
|
37
24
|
|
38
|
-
|
39
|
-
assert_correctly_loaded
|
40
|
-
end
|
41
|
-
|
42
|
-
def test_load_json
|
43
|
-
assert_correctly_loaded(@loader.load_json)
|
44
|
-
end
|
45
|
-
|
46
|
-
def test_load_v1
|
47
|
-
assert_deprecated('MIME::Types::Loader.load_v1') do
|
48
|
-
assert_correctly_loaded(@loader.load_v1)
|
49
|
-
end
|
25
|
+
it 'loads YAML files correctly' do
|
26
|
+
assert_correctly_loaded @loader.load_yaml
|
50
27
|
end
|
51
28
|
|
52
|
-
|
53
|
-
|
54
|
-
assert_raises(MIME::Types::Loader::BadV1Format) {
|
55
|
-
MIME::Types::Loader.load_from_v1(File.join(@bad_path, 'malformed'))
|
56
|
-
}
|
57
|
-
}
|
29
|
+
it 'loads JSON files correctly' do
|
30
|
+
assert_correctly_loaded @loader.load_json
|
58
31
|
end
|
59
32
|
end
|
metadata
CHANGED
@@ -1,43 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mime-types
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Austin Ziegler
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-12-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: mime-types-data
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
20
|
-
type: :
|
19
|
+
version: '3.2015'
|
20
|
+
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '3.2015'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: minitest
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '5.13'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '5.13'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: hoe-doofus
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -137,19 +137,53 @@ dependencies:
|
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '1.0'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
|
-
name:
|
140
|
+
name: minitest-bonus-assertions
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
143
|
- - "~>"
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version: '
|
145
|
+
version: '3.0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '3.0'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: minitest-hooks
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - "~>"
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '1.4'
|
146
160
|
type: :development
|
147
161
|
prerelease: false
|
148
162
|
version_requirements: !ruby/object:Gem::Requirement
|
149
163
|
requirements:
|
150
164
|
- - "~>"
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '1.4'
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: rake
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - ">="
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '10.0'
|
174
|
+
- - "<"
|
175
|
+
- !ruby/object:Gem::Version
|
176
|
+
version: '13.0'
|
177
|
+
type: :development
|
178
|
+
prerelease: false
|
179
|
+
version_requirements: !ruby/object:Gem::Requirement
|
180
|
+
requirements:
|
181
|
+
- - ">="
|
151
182
|
- !ruby/object:Gem::Version
|
152
183
|
version: '10.0'
|
184
|
+
- - "<"
|
185
|
+
- !ruby/object:Gem::Version
|
186
|
+
version: '13.0'
|
153
187
|
- !ruby/object:Gem::Dependency
|
154
188
|
name: fivemat
|
155
189
|
requirement: !ruby/object:Gem::Requirement
|
@@ -178,91 +212,99 @@ dependencies:
|
|
178
212
|
- - "~>"
|
179
213
|
- !ruby/object:Gem::Version
|
180
214
|
version: '5.2'
|
215
|
+
- !ruby/object:Gem::Dependency
|
216
|
+
name: simplecov
|
217
|
+
requirement: !ruby/object:Gem::Requirement
|
218
|
+
requirements:
|
219
|
+
- - "~>"
|
220
|
+
- !ruby/object:Gem::Version
|
221
|
+
version: '0.7'
|
222
|
+
type: :development
|
223
|
+
prerelease: false
|
224
|
+
version_requirements: !ruby/object:Gem::Requirement
|
225
|
+
requirements:
|
226
|
+
- - "~>"
|
227
|
+
- !ruby/object:Gem::Version
|
228
|
+
version: '0.7'
|
229
|
+
- !ruby/object:Gem::Dependency
|
230
|
+
name: rdoc
|
231
|
+
requirement: !ruby/object:Gem::Requirement
|
232
|
+
requirements:
|
233
|
+
- - ">="
|
234
|
+
- !ruby/object:Gem::Version
|
235
|
+
version: '4.0'
|
236
|
+
- - "<"
|
237
|
+
- !ruby/object:Gem::Version
|
238
|
+
version: '7'
|
239
|
+
type: :development
|
240
|
+
prerelease: false
|
241
|
+
version_requirements: !ruby/object:Gem::Requirement
|
242
|
+
requirements:
|
243
|
+
- - ">="
|
244
|
+
- !ruby/object:Gem::Version
|
245
|
+
version: '4.0'
|
246
|
+
- - "<"
|
247
|
+
- !ruby/object:Gem::Version
|
248
|
+
version: '7'
|
181
249
|
- !ruby/object:Gem::Dependency
|
182
250
|
name: hoe
|
183
251
|
requirement: !ruby/object:Gem::Requirement
|
184
252
|
requirements:
|
185
253
|
- - "~>"
|
186
254
|
- !ruby/object:Gem::Version
|
187
|
-
version: '3.
|
255
|
+
version: '3.20'
|
188
256
|
type: :development
|
189
257
|
prerelease: false
|
190
258
|
version_requirements: !ruby/object:Gem::Requirement
|
191
259
|
requirements:
|
192
260
|
- - "~>"
|
193
261
|
- !ruby/object:Gem::Version
|
194
|
-
version: '3.
|
262
|
+
version: '3.20'
|
195
263
|
description: |-
|
196
264
|
The mime-types library provides a library and registry for information about
|
197
265
|
MIME content type definitions. It can be used to determine defined filename
|
198
266
|
extensions for MIME types, or to use filename extensions to look up the likely
|
199
267
|
MIME type definitions.
|
200
268
|
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
registered MIME media types plus any security updates that may be required.
|
209
|
-
|
210
|
-
If the loss of the deprecated data matters, be sure to set your dependency
|
211
|
-
appropriately:
|
212
|
-
|
213
|
-
gem 'mime-types', '~> 2.6, < 2.99'
|
269
|
+
Version 3.0 is a major release that requires Ruby 2.0 compatibility and removes
|
270
|
+
deprecated functions. The columnar registry format introduced in 2.6 has been
|
271
|
+
made the primary format; the registry data has been extracted from this library
|
272
|
+
and put into {mime-types-data}[https://github.com/mime-types/mime-types-data].
|
273
|
+
Additionally, mime-types is now licensed exclusively under the MIT licence and
|
274
|
+
there is a code of conduct in effect. There are a number of other smaller
|
275
|
+
changes described in the History file.
|
214
276
|
email:
|
215
277
|
- halostatue@gmail.com
|
216
278
|
executables: []
|
217
279
|
extensions: []
|
218
280
|
extra_rdoc_files:
|
219
|
-
- Code-of-Conduct.
|
220
|
-
- Contributing.
|
221
|
-
- History
|
222
|
-
-
|
223
|
-
- Licence.rdoc
|
281
|
+
- Code-of-Conduct.md
|
282
|
+
- Contributing.md
|
283
|
+
- History.md
|
284
|
+
- Licence.md
|
224
285
|
- Manifest.txt
|
225
286
|
- README.rdoc
|
226
|
-
- docs/COPYING.txt
|
227
|
-
- docs/artistic.txt
|
228
287
|
files:
|
229
|
-
- Code-of-Conduct.
|
230
|
-
- Contributing.
|
231
|
-
- History
|
232
|
-
-
|
233
|
-
- Licence.rdoc
|
288
|
+
- Code-of-Conduct.md
|
289
|
+
- Contributing.md
|
290
|
+
- History.md
|
291
|
+
- Licence.md
|
234
292
|
- Manifest.txt
|
235
293
|
- README.rdoc
|
236
294
|
- Rakefile
|
237
|
-
- data/mime-types.json
|
238
|
-
- data/mime.content_type.column
|
239
|
-
- data/mime.docs.column
|
240
|
-
- data/mime.encoding.column
|
241
|
-
- data/mime.friendly.column
|
242
|
-
- data/mime.obsolete.column
|
243
|
-
- data/mime.registered.column
|
244
|
-
- data/mime.signature.column
|
245
|
-
- data/mime.use_instead.column
|
246
|
-
- data/mime.xrefs.column
|
247
|
-
- docs/COPYING.txt
|
248
|
-
- docs/artistic.txt
|
249
295
|
- lib/mime-types.rb
|
250
296
|
- lib/mime/type.rb
|
251
297
|
- lib/mime/type/columnar.rb
|
252
298
|
- lib/mime/types.rb
|
299
|
+
- lib/mime/types/_columnar.rb
|
253
300
|
- lib/mime/types/cache.rb
|
254
301
|
- lib/mime/types/columnar.rb
|
302
|
+
- lib/mime/types/container.rb
|
255
303
|
- lib/mime/types/deprecations.rb
|
304
|
+
- lib/mime/types/full.rb
|
256
305
|
- lib/mime/types/loader.rb
|
257
|
-
- lib/mime/types/loader_path.rb
|
258
306
|
- lib/mime/types/logger.rb
|
259
|
-
-
|
260
|
-
- support/benchmarks/load.rb
|
261
|
-
- support/benchmarks/load_allocations.rb
|
262
|
-
- support/benchmarks/object_counts.rb
|
263
|
-
- support/convert.rb
|
264
|
-
- support/convert/columnar.rb
|
265
|
-
- support/iana_registry.rb
|
307
|
+
- lib/mime/types/registry.rb
|
266
308
|
- test/bad-fixtures/malformed
|
267
309
|
- test/fixture/json.json
|
268
310
|
- test/fixture/old-data
|
@@ -277,9 +319,11 @@ files:
|
|
277
319
|
homepage: https://github.com/mime-types/ruby-mime-types/
|
278
320
|
licenses:
|
279
321
|
- MIT
|
280
|
-
|
281
|
-
|
282
|
-
|
322
|
+
metadata:
|
323
|
+
homepage_uri: https://github.com/mime-types/ruby-mime-types/
|
324
|
+
source_code_uri: https://github.com/mime-types/ruby-mime-types/
|
325
|
+
bug_tracker_uri: https://github.com/mime-types/ruby-mime-types/issues
|
326
|
+
changelog_uri: https://github.com/mime-types/ruby-mime-types/blob/master/History.md
|
283
327
|
post_install_message:
|
284
328
|
rdoc_options:
|
285
329
|
- "--main"
|
@@ -290,15 +334,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
290
334
|
requirements:
|
291
335
|
- - ">="
|
292
336
|
- !ruby/object:Gem::Version
|
293
|
-
version:
|
337
|
+
version: '2.0'
|
294
338
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
295
339
|
requirements:
|
296
340
|
- - ">="
|
297
341
|
- !ruby/object:Gem::Version
|
298
342
|
version: '0'
|
299
343
|
requirements: []
|
300
|
-
|
301
|
-
rubygems_version: 2.5.1
|
344
|
+
rubygems_version: 3.0.3
|
302
345
|
signing_key:
|
303
346
|
specification_version: 4
|
304
347
|
summary: The mime-types library provides a library and registry for information about
|
data/Contributing.rdoc
DELETED
@@ -1,170 +0,0 @@
|
|
1
|
-
== Contributing
|
2
|
-
|
3
|
-
I value any contribution to mime-types you can provide: a bug report, a feature
|
4
|
-
request, or code contributions.
|
5
|
-
|
6
|
-
There are a few guidelines for contributing to mime-types:
|
7
|
-
|
8
|
-
* Code changes *will* *not* be accepted without tests. The test suite is
|
9
|
-
written with {Minitest}[https://github.com/seattlerb/minitest].
|
10
|
-
* Match my coding style.
|
11
|
-
* Use a thoughtfully-named topic branch that contains your change. Rebase your
|
12
|
-
commits into logical chunks as necessary.
|
13
|
-
* Use {quality commit messages}[http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html].
|
14
|
-
* Do not change the version number; when your patch is accepted and a release
|
15
|
-
is made, the version will be updated at that point.
|
16
|
-
* Submit a GitHub pull request with your changes.
|
17
|
-
* New or changed behaviours require new or updated documentation.
|
18
|
-
|
19
|
-
=== Adding or Modifying MIME Types
|
20
|
-
|
21
|
-
The mime-types registry is loaded from encoded files in +data+. These are not
|
22
|
-
editable and cannot be compared meaningfully in a pull request; pull requests
|
23
|
-
that include changes to these files will require amendment to revert these
|
24
|
-
files.
|
25
|
-
|
26
|
-
New or modified MIME types should be edited in the appropriate YAML file under
|
27
|
-
+type-lists+. The format is as shown below for the +application/xml+ MIME type
|
28
|
-
in +type-lists/application.yml+.
|
29
|
-
|
30
|
-
- !ruby/object:MIME::Type
|
31
|
-
content-type: application/xml
|
32
|
-
encoding: 8bit
|
33
|
-
extensions:
|
34
|
-
- xml
|
35
|
-
- xsl
|
36
|
-
xrefs: !ruby/hash:MIME::Types::Container
|
37
|
-
rfc:
|
38
|
-
- rfc3023
|
39
|
-
registered: true
|
40
|
-
|
41
|
-
There are other fields that can be added, matching the fields discussed in the
|
42
|
-
documentation for MIME::Type. Pull requests for MIME types should just contain
|
43
|
-
the changes to the YAML files for the new or modified MIME types; I will
|
44
|
-
convert the YAML files to JSON prior to a new release. I would rather not have
|
45
|
-
to verify that the JSON matches the YAML changes, which is why it is not
|
46
|
-
necessary to convert for the pull request.
|
47
|
-
|
48
|
-
If you are making a change for a private fork, use <tt>rake
|
49
|
-
convert:yaml:json</tt> to convert the YAML to JSON, or <tt>rake
|
50
|
-
convert:yaml:columnar</tt> to convert it to the new columnar format.
|
51
|
-
|
52
|
-
==== Updating Types from the IANA or Apache Lists
|
53
|
-
|
54
|
-
If you are maintaining a private fork and wish to update your copy of the MIME
|
55
|
-
types registry used by this gem, you can do this with the rake tasks:
|
56
|
-
|
57
|
-
$ rake mime:iana
|
58
|
-
$ rake mime:apache
|
59
|
-
|
60
|
-
Both of these require
|
61
|
-
{Nokogiri}[http://www.nokogiri.org/tutorials/installing_nokogiri.html], which
|
62
|
-
is not installed by default. Install it in the usual way for your Ruby.
|
63
|
-
|
64
|
-
=== Test Dependencies
|
65
|
-
|
66
|
-
mime-types uses Ryan Davis’s {Hoe}[https://github.com/seattlerb/hoe] to manage
|
67
|
-
the release process, and it adds a number of rake tasks. You will mostly be
|
68
|
-
interested in:
|
69
|
-
|
70
|
-
$ rake
|
71
|
-
|
72
|
-
which runs the tests the same way that:
|
73
|
-
|
74
|
-
$ rake test
|
75
|
-
$ rake travis
|
76
|
-
|
77
|
-
will do.
|
78
|
-
|
79
|
-
To assist with the installation of the development dependencies for mime-types,
|
80
|
-
I have provided the simplest possible Gemfile pointing to the (generated)
|
81
|
-
+mime-types.gemspec+ file. This will permit you to do:
|
82
|
-
|
83
|
-
$ bundle install
|
84
|
-
|
85
|
-
to get the development dependencies. If you aleady have +hoe+ installed, you
|
86
|
-
can accomplish the same thing with:
|
87
|
-
|
88
|
-
$ rake newb
|
89
|
-
|
90
|
-
This task will install any missing dependencies, run the tests/specs, and
|
91
|
-
generate the RDoc.
|
92
|
-
|
93
|
-
You can run tests with code coverage analysis by running:
|
94
|
-
|
95
|
-
$ rake test:coverage
|
96
|
-
|
97
|
-
=== Benchmarks
|
98
|
-
|
99
|
-
mime-types offers several benchmark tasks to measure different measures of
|
100
|
-
performance.
|
101
|
-
|
102
|
-
There is a repeated load test, measuring how long it takes to start and load
|
103
|
-
mime-types with its full registry. By default, it runs fifty loops and uses the
|
104
|
-
built-in benchmark library.
|
105
|
-
|
106
|
-
$ rake benchmark:load
|
107
|
-
|
108
|
-
There are two allocation tracing benchmarks (for normal and columnar loads).
|
109
|
-
These can only be run on Ruby 2.1 or better and requires the
|
110
|
-
{allocation_tracer}[https://github.com/ko1/allocation_tracer] gem (not
|
111
|
-
installed by default).
|
112
|
-
|
113
|
-
$ rake benchmark:allocations
|
114
|
-
$ rake benchmark:allocations:columnar
|
115
|
-
|
116
|
-
There are two loaded object count benchmarks (for normal and columnar loads).
|
117
|
-
These use <tt>ObjectSpace.count_objects</tt>.
|
118
|
-
|
119
|
-
$ rake benchmark:objects
|
120
|
-
$ rake benchmark:objects:columnar
|
121
|
-
|
122
|
-
=== Workflow
|
123
|
-
|
124
|
-
Here's the most direct way to get your work merged into the project:
|
125
|
-
|
126
|
-
* Fork the project.
|
127
|
-
* Clone down your fork (<tt>git clone git://github.com/<username>/ruby-mime-types.git</tt>).
|
128
|
-
* Create a topic branch to contain your change (<tt>git checkout -b my\_awesome\_feature</tt>).
|
129
|
-
* Hack away, add tests. Not necessarily in that order.
|
130
|
-
* Make sure everything still passes by running +rake+.
|
131
|
-
* If necessary, rebase your commits into logical chunks, without errors.
|
132
|
-
* Push the branch up (<tt>git push origin my\_awesome\_feature</tt>).
|
133
|
-
* Create a pull request against mime-types/ruby-mime-types and describe what
|
134
|
-
your change does and the why you think it should be merged.
|
135
|
-
|
136
|
-
=== Contributors
|
137
|
-
|
138
|
-
* Austin Ziegler created mime-types.
|
139
|
-
|
140
|
-
Thanks to everyone else who has contributed to mime-types:
|
141
|
-
|
142
|
-
* Aaron Patterson
|
143
|
-
* Aggelos Avgerinos
|
144
|
-
* Andre Pankratz
|
145
|
-
* Andy Brody
|
146
|
-
* Arnaud Meuret
|
147
|
-
* Brandon Galbraith
|
148
|
-
* Chris Gat
|
149
|
-
* David Genord
|
150
|
-
* Eric Marden
|
151
|
-
* Garret Alfert
|
152
|
-
* Godfrey Chan
|
153
|
-
* Greg Brockman
|
154
|
-
* Hans de Graaff
|
155
|
-
* Henrik Hodne
|
156
|
-
* Jeremy Evans
|
157
|
-
* Juanito Fatas
|
158
|
-
* Łukasz Śliwa
|
159
|
-
* Keerthi Siva
|
160
|
-
* Ken Ip
|
161
|
-
* Martin d'Allens
|
162
|
-
* Mauricio Linhares
|
163
|
-
* nycvotes-dev
|
164
|
-
* Postmodern
|
165
|
-
* Richard Hirner
|
166
|
-
* Richard Hurt
|
167
|
-
* Richard Schneeman
|
168
|
-
* Tao Guo
|
169
|
-
* Tibor Szolár
|
170
|
-
* Todd Carrico
|