kinetic_sdk 5.0.18 → 5.0.19

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +6 -1
  3. data/gems/{mime-types-3.1/Code-of-Conduct.rdoc → mime-types-3.3.1/Code-of-Conduct.md} +19 -20
  4. data/gems/{mime-types-3.1/Contributing.rdoc → mime-types-3.3.1/Contributing.md} +67 -54
  5. data/gems/mime-types-3.3.1/History.md +240 -0
  6. data/gems/{mime-types-data-3.2016.0521 → mime-types-3.3.1}/Licence.md +1 -1
  7. data/gems/{mime-types-3.1 → mime-types-3.3.1}/Manifest.txt +4 -4
  8. data/gems/{mime-types-3.1 → mime-types-3.3.1}/README.rdoc +5 -14
  9. data/gems/{mime-types-3.1 → mime-types-3.3.1}/Rakefile +43 -13
  10. data/gems/mime-types-3.3.1/lib/mime-types.rb +3 -0
  11. data/gems/{mime-types-3.1 → mime-types-3.3.1}/lib/mime/type.rb +60 -46
  12. data/gems/{mime-types-3.1 → mime-types-3.3.1}/lib/mime/type/columnar.rb +4 -2
  13. data/gems/{mime-types-3.1 → mime-types-3.3.1}/lib/mime/types.rb +11 -8
  14. data/gems/{mime-types-3.1 → mime-types-3.3.1}/lib/mime/types/_columnar.rb +10 -9
  15. data/gems/{mime-types-3.1 → mime-types-3.3.1}/lib/mime/types/cache.rb +7 -5
  16. data/gems/mime-types-3.3.1/lib/mime/types/columnar.rb +3 -0
  17. data/gems/mime-types-3.3.1/lib/mime/types/container.rb +96 -0
  18. data/gems/{mime-types-3.1 → mime-types-3.3.1}/lib/mime/types/deprecations.rb +3 -3
  19. data/gems/{mime-types-3.1 → mime-types-3.3.1}/lib/mime/types/full.rb +2 -0
  20. data/gems/{mime-types-3.1 → mime-types-3.3.1}/lib/mime/types/loader.rb +2 -4
  21. data/gems/{mime-types-3.1 → mime-types-3.3.1}/lib/mime/types/logger.rb +3 -1
  22. data/gems/{mime-types-3.1 → mime-types-3.3.1}/lib/mime/types/registry.rb +12 -3
  23. data/gems/{mime-types-3.1 → mime-types-3.3.1}/test/bad-fixtures/malformed +0 -0
  24. data/gems/{mime-types-3.1 → mime-types-3.3.1}/test/fixture/json.json +0 -0
  25. data/gems/{mime-types-3.1 → mime-types-3.3.1}/test/fixture/old-data +0 -0
  26. data/gems/{mime-types-3.1 → mime-types-3.3.1}/test/fixture/yaml.yaml +0 -0
  27. data/gems/{mime-types-3.1 → mime-types-3.3.1}/test/minitest_helper.rb +1 -1
  28. data/gems/{mime-types-3.1 → mime-types-3.3.1}/test/test_mime_type.rb +33 -26
  29. data/gems/{mime-types-3.1 → mime-types-3.3.1}/test/test_mime_types.rb +33 -25
  30. data/gems/{mime-types-3.1 → mime-types-3.3.1}/test/test_mime_types_cache.rb +15 -6
  31. data/gems/{mime-types-3.1 → mime-types-3.3.1}/test/test_mime_types_class.rb +18 -14
  32. data/gems/{mime-types-3.1 → mime-types-3.3.1}/test/test_mime_types_lazy.rb +10 -4
  33. data/gems/{mime-types-3.1 → mime-types-3.3.1}/test/test_mime_types_loader.rb +1 -1
  34. data/gems/{mime-types-data-3.2016.0521 → mime-types-data-3.2021.0225}/Code-of-Conduct.md +10 -10
  35. data/gems/mime-types-data-3.2021.0225/Contributing.md +224 -0
  36. data/gems/mime-types-data-3.2021.0225/History.md +468 -0
  37. data/gems/{mime-types-3.1/Licence.rdoc → mime-types-data-3.2021.0225/Licence.md} +3 -3
  38. data/gems/{mime-types-data-3.2016.0521 → mime-types-data-3.2021.0225}/Manifest.txt +13 -0
  39. data/gems/mime-types-data-3.2021.0225/README.md +63 -0
  40. data/gems/mime-types-data-3.2021.0225/Rakefile +159 -0
  41. data/gems/mime-types-data-3.2021.0225/data/mime-types.json +1 -0
  42. data/gems/{mime-types-data-3.2016.0521 → mime-types-data-3.2021.0225}/data/mime.content_type.column +364 -13
  43. data/gems/{mime-types-data-3.2016.0521 → mime-types-data-3.2021.0225}/data/mime.docs.column +351 -0
  44. data/gems/{mime-types-data-3.2016.0521 → mime-types-data-3.2021.0225}/data/mime.encoding.column +351 -0
  45. data/gems/{mime-types-data-3.2016.0521 → mime-types-data-3.2021.0225}/data/mime.flags.column +352 -1
  46. data/gems/{mime-types-data-3.2016.0521 → mime-types-data-3.2021.0225}/data/mime.friendly.column +351 -0
  47. data/gems/{mime-types-data-3.2016.0521 → mime-types-data-3.2021.0225}/data/mime.pext.column +351 -0
  48. data/gems/{mime-types-data-3.2016.0521 → mime-types-data-3.2021.0225}/data/mime.use_instead.column +351 -0
  49. data/gems/{mime-types-data-3.2016.0521 → mime-types-data-3.2021.0225}/data/mime.xrefs.column +480 -129
  50. data/gems/{mime-types-data-3.2016.0521 → mime-types-data-3.2021.0225}/lib/mime-types-data.rb +0 -0
  51. data/gems/{mime-types-data-3.2016.0521 → mime-types-data-3.2021.0225}/lib/mime/types/data.rb +1 -1
  52. data/gems/mime-types-data-3.2021.0225/types/application.yaml +16933 -0
  53. data/gems/mime-types-data-3.2021.0225/types/audio.yaml +1714 -0
  54. data/gems/mime-types-data-3.2021.0225/types/chemical.yaml +71 -0
  55. data/gems/mime-types-data-3.2021.0225/types/conference.yaml +9 -0
  56. data/gems/mime-types-data-3.2021.0225/types/drawing.yaml +15 -0
  57. data/gems/mime-types-data-3.2021.0225/types/font.yaml +65 -0
  58. data/gems/mime-types-data-3.2021.0225/types/image.yaml +1251 -0
  59. data/gems/mime-types-data-3.2021.0225/types/message.yaml +200 -0
  60. data/gems/mime-types-data-3.2021.0225/types/model.yaml +331 -0
  61. data/gems/mime-types-data-3.2021.0225/types/multipart.yaml +179 -0
  62. data/gems/mime-types-data-3.2021.0225/types/text.yaml +1145 -0
  63. data/gems/mime-types-data-3.2021.0225/types/video.yaml +1094 -0
  64. data/gems/mime-types-data-3.2021.0225/types/world.yaml +8 -0
  65. data/kinetic_sdk.gemspec +3 -3
  66. data/lib/kinetic_sdk.rb +2 -2
  67. data/lib/kinetic_sdk/version.rb +1 -1
  68. metadata +86 -73
  69. data/gems/mime-types-3.1/History.rdoc +0 -658
  70. data/gems/mime-types-3.1/lib/mime-types.rb +0 -1
  71. data/gems/mime-types-3.1/lib/mime/types/columnar.rb +0 -1
  72. data/gems/mime-types-3.1/lib/mime/types/container.rb +0 -30
  73. data/gems/mime-types-data-3.2016.0521/Contributing.md +0 -157
  74. data/gems/mime-types-data-3.2016.0521/History.md +0 -351
  75. data/gems/mime-types-data-3.2016.0521/README.md +0 -61
  76. data/gems/mime-types-data-3.2016.0521/Rakefile +0 -80
  77. data/gems/mime-types-data-3.2016.0521/data/mime-types.json +0 -1
@@ -1,30 +1,30 @@
1
- # -*- ruby encoding: utf-8 -*-
1
+ # frozen_string_literal: true
2
2
 
3
3
  require 'mime/types'
4
4
  require 'minitest_helper'
5
5
 
6
6
  describe MIME::Types do
7
7
  def mime_types
8
- @mime_types ||= MIME::Types.new.tap do |mt|
8
+ @mime_types ||= MIME::Types.new.tap { |mt|
9
9
  mt.add MIME::Type.new(['text/plain', %w(txt)]),
10
- MIME::Type.new(['image/jpeg', %w(jpg jpeg)]),
11
- MIME::Type.new('application/x-wordperfect6.1'),
12
- MIME::Type.new(
13
- 'content-type' => 'application/x-www-form-urlencoded',
14
- 'registered' => true
15
- ),
16
- MIME::Type.new(['application/x-gzip', %w(gz)]),
17
- MIME::Type.new(
18
- 'content-type' => 'application/gzip',
19
- 'extensions' => 'gz',
20
- 'registered' => true
21
- )
22
- end
10
+ MIME::Type.new(['image/jpeg', %w(jpg jpeg)]),
11
+ MIME::Type.new('application/x-wordperfect6.1'),
12
+ MIME::Type.new(
13
+ 'content-type' => 'application/x-www-form-urlencoded',
14
+ 'registered' => true
15
+ ),
16
+ MIME::Type.new(['application/x-gzip', %w(gz)]),
17
+ MIME::Type.new(
18
+ 'content-type' => 'application/gzip',
19
+ 'extensions' => 'gz',
20
+ 'registered' => true
21
+ )
22
+ }
23
23
  end
24
24
 
25
25
  describe 'is enumerable' do
26
26
  it 'correctly uses an Enumerable method like #any?' do
27
- assert mime_types.any? { |type| type.content_type == 'text/plain' }
27
+ assert(mime_types.any? { |type| type.content_type == 'text/plain' })
28
28
  end
29
29
 
30
30
  it 'implements each with no parameters to return an Enumerator' do
@@ -83,15 +83,21 @@ describe MIME::Types do
83
83
  refute_empty mime_types[/gzip/, registered: true]
84
84
  refute_equal mime_types[/gzip/], mime_types[/gzip/, registered: true]
85
85
  end
86
+
87
+ it 'properly returns an empty result on a regular expression miss' do
88
+ assert_empty mime_types[/^foo/]
89
+ assert_empty mime_types[/^foo/, registered: true]
90
+ assert_empty mime_types[/^foo/, complete: true]
91
+ end
86
92
  end
87
93
 
88
94
  describe '#add' do
89
95
  let(:eruby) { MIME::Type.new('application/x-eruby') }
90
- let(:jinja) { MIME::Type.new('application/jinja2' )}
96
+ let(:jinja) { MIME::Type.new('application/jinja2') }
91
97
 
92
98
  it 'successfully adds a new type' do
93
99
  mime_types.add(eruby)
94
- assert_equal mime_types['application/x-eruby'], [ eruby ]
100
+ assert_equal mime_types['application/x-eruby'], [eruby]
95
101
  end
96
102
 
97
103
  it 'complains about adding a duplicate type' do
@@ -107,13 +113,13 @@ describe MIME::Types do
107
113
  assert_output '', '' do
108
114
  mime_types.add(eruby, :silent)
109
115
  end
110
- assert_equal mime_types['application/x-eruby'], [ eruby ]
116
+ assert_equal mime_types['application/x-eruby'], [eruby]
111
117
  end
112
118
 
113
119
  it 'successfully adds from an array' do
114
- mime_types.add([ eruby, jinja ])
115
- assert_equal mime_types['application/x-eruby'], [ eruby ]
116
- assert_equal mime_types['application/jinja2'], [ jinja ]
120
+ mime_types.add([eruby, jinja])
121
+ assert_equal mime_types['application/x-eruby'], [eruby]
122
+ assert_equal mime_types['application/jinja2'], [jinja]
117
123
  end
118
124
 
119
125
  it 'successfully adds from another MIME::Types' do
@@ -122,7 +128,7 @@ describe MIME::Types do
122
128
  assert_equal mime_types.count, mt.count
123
129
 
124
130
  mime_types.each do |type|
125
- assert_equal mt[type.content_type], [ type ]
131
+ assert_equal mt[type.content_type], [type]
126
132
  end
127
133
  end
128
134
  end
@@ -130,7 +136,7 @@ describe MIME::Types do
130
136
  describe '#type_for' do
131
137
  it 'finds all types for a given extension' do
132
138
  assert_equal %w(application/gzip application/x-gzip),
133
- mime_types.type_for('gz')
139
+ mime_types.type_for('gz')
134
140
  end
135
141
 
136
142
  it 'separates the extension from filenames' do
@@ -139,11 +145,13 @@ describe MIME::Types do
139
145
 
140
146
  it 'finds multiple extensions' do
141
147
  assert_equal %w(image/jpeg text/plain),
142
- mime_types.type_for(%w(foo.txt foo.jpeg))
148
+ mime_types.type_for(%w(foo.txt foo.jpeg))
143
149
  end
144
150
 
145
151
  it 'does not find unknown extensions' do
152
+ keys = mime_types.instance_variable_get(:@extension_index).keys
146
153
  assert_empty mime_types.type_for('zzz')
154
+ assert_equal keys, mime_types.instance_variable_get(:@extension_index).keys
147
155
  end
148
156
 
149
157
  it 'modifying type extensions causes reindexing' do
@@ -1,4 +1,4 @@
1
- # -*- ruby encoding: utf-8 -*-
1
+ # frozen_string_literal: true
2
2
 
3
3
  require 'mime/types'
4
4
  require 'minitest_helper'
@@ -35,11 +35,20 @@ describe MIME::Types::Cache do
35
35
  describe '.load' do
36
36
  it 'does not use cache when RUBY_MIME_TYPES_CACHE is unset' do
37
37
  ENV.delete('RUBY_MIME_TYPES_CACHE')
38
- assert_equal(nil, MIME::Types::Cache.load)
38
+ assert_nil MIME::Types::Cache.load
39
39
  end
40
40
 
41
41
  it 'does not use cache when missing' do
42
- assert_equal(nil, MIME::Types::Cache.load)
42
+ assert_nil MIME::Types::Cache.load
43
+ end
44
+
45
+ it 'registers the data to be updated by #add_extensions' do
46
+ MIME::Types::Cache.save
47
+ reset_mime_types
48
+ assert_equal([], MIME::Types.type_for('foo.additional'))
49
+ html = MIME::Types['text/html'][0]
50
+ html.add_extensions('additional')
51
+ assert_equal([html], MIME::Types.type_for('foo.additional'))
43
52
  end
44
53
 
45
54
  it 'outputs an error when there is an invalid version' do
@@ -58,7 +67,7 @@ describe MIME::Types::Cache do
58
67
  it 'outputs an error when there is a marshal file incompatibility' do
59
68
  MIME::Types::Cache.save
60
69
  data = File.binread(@cache_file).reverse
61
- File.open(@cache_file, 'wb') { |f| f.write(data) }
70
+ File.open(@cache_file, 'wb') do |f| f.write(data) end
62
71
  MIME::Types.instance_variable_set(:@__types__, nil)
63
72
  assert_output '', /incompatible marshal file format/ do
64
73
  MIME::Types['text/html']
@@ -69,7 +78,7 @@ describe MIME::Types::Cache do
69
78
  describe '.save' do
70
79
  it 'does not create cache when RUBY_MIME_TYPES_CACHE is unset' do
71
80
  ENV.delete('RUBY_MIME_TYPES_CACHE')
72
- assert_equal(nil, MIME::Types::Cache.save)
81
+ assert_nil MIME::Types::Cache.save
73
82
  end
74
83
 
75
84
  it 'creates the cache ' do
@@ -93,7 +102,7 @@ end
93
102
  describe MIME::Types::Container do
94
103
  it 'marshals and unmarshals correctly' do
95
104
  container = MIME::Types::Container.new
96
- container['xyz'] << 'abc'
105
+ container.add('xyz', 'abc')
97
106
 
98
107
  # default proc should return Set[]
99
108
  assert_equal(Set[], container['abc'])
@@ -1,4 +1,4 @@
1
- # -*- ruby encoding: utf-8 -*-
1
+ # frozen_string_literal: true
2
2
 
3
3
  require 'mime/types'
4
4
  require 'minitest_helper'
@@ -10,7 +10,7 @@ describe MIME::Types, 'registry' do
10
10
 
11
11
  describe 'is enumerable' do
12
12
  it 'correctly uses an Enumerable method like #any?' do
13
- assert MIME::Types.any? { |type| type.content_type == 'text/plain' }
13
+ assert(MIME::Types.any? { |type| type.content_type == 'text/plain' })
14
14
  end
15
15
 
16
16
  it 'implements each with no parameters to return an Enumerator' do
@@ -42,9 +42,13 @@ describe MIME::Types, 'registry' do
42
42
  end
43
43
 
44
44
  it 'sorts by priority with multiple matches' do
45
- assert_equal %w(application/gzip application/x-gzip multipart/x-gzip),
46
- MIME::Types[/gzip$/]
47
- assert_equal 3, MIME::Types[/gzip$/].size
45
+ types = MIME::Types[/gzip$/].select { |t|
46
+ %w(application/gzip application/x-gzip multipart/x-gzip).include?(t)
47
+ }
48
+ # This is this way because of a new type ending with gzip that only
49
+ # appears in some data files.
50
+ assert_equal %w(application/gzip application/x-gzip multipart/x-gzip), types
51
+ assert_equal 3, types.size
48
52
  end
49
53
 
50
54
  it 'can be searched with a string' do
@@ -75,7 +79,7 @@ describe MIME::Types, 'registry' do
75
79
  describe '.type_for' do
76
80
  it 'finds all types for a given extension' do
77
81
  assert_equal %w(application/gzip application/x-gzip),
78
- MIME::Types.type_for('gz')
82
+ MIME::Types.type_for('gz')
79
83
  end
80
84
 
81
85
  it 'separates the extension from filenames' do
@@ -84,7 +88,7 @@ describe MIME::Types, 'registry' do
84
88
 
85
89
  it 'finds multiple extensions' do
86
90
  assert_equal %w(image/jpeg text/plain),
87
- MIME::Types.type_for(%w(foo.txt foo.jpeg))
91
+ MIME::Types.type_for(%w(foo.txt foo.jpeg))
88
92
  end
89
93
 
90
94
  it 'does not find unknown extensions' do
@@ -111,11 +115,11 @@ describe MIME::Types, 'registry' do
111
115
  end
112
116
 
113
117
  let(:eruby) { MIME::Type.new('application/x-eruby') }
114
- let(:jinja) { MIME::Type.new('application/jinja2' )}
118
+ let(:jinja) { MIME::Type.new('application/jinja2') }
115
119
 
116
120
  it 'successfully adds a new type' do
117
121
  MIME::Types.add(eruby)
118
- assert_equal MIME::Types['application/x-eruby'], [ eruby ]
122
+ assert_equal MIME::Types['application/x-eruby'], [eruby]
119
123
  end
120
124
 
121
125
  it 'complains about adding a duplicate type' do
@@ -131,13 +135,13 @@ describe MIME::Types, 'registry' do
131
135
  assert_silent do
132
136
  MIME::Types.add(eruby, :silent)
133
137
  end
134
- assert_equal MIME::Types['application/x-eruby'], [ eruby ]
138
+ assert_equal MIME::Types['application/x-eruby'], [eruby]
135
139
  end
136
140
 
137
141
  it 'successfully adds from an array' do
138
- MIME::Types.add([ eruby, jinja ])
139
- assert_equal MIME::Types['application/x-eruby'], [ eruby ]
140
- assert_equal MIME::Types['application/jinja2'], [ jinja ]
142
+ MIME::Types.add([eruby, jinja])
143
+ assert_equal MIME::Types['application/x-eruby'], [eruby]
144
+ assert_equal MIME::Types['application/jinja2'], [jinja]
141
145
  end
142
146
 
143
147
  it 'successfully adds from another MIME::Types' do
@@ -149,7 +153,7 @@ describe MIME::Types, 'registry' do
149
153
  MIME::Types.add(mt)
150
154
  assert_equal old_count + 1, MIME::Types.count
151
155
 
152
- assert_equal MIME::Types[eruby.content_type], [ eruby ]
156
+ assert_equal MIME::Types[eruby.content_type], [eruby]
153
157
  end
154
158
  end
155
159
  end
@@ -1,4 +1,4 @@
1
- # -*- ruby encoding: utf-8 -*-
1
+ # frozen_string_literal: true
2
2
 
3
3
  require 'mime/types'
4
4
  require 'minitest_helper'
@@ -20,17 +20,23 @@ describe MIME::Types, 'lazy loading' do
20
20
 
21
21
  describe '.lazy_load?' do
22
22
  it 'is true when RUBY_MIME_TYPES_LAZY_LOAD is set' do
23
- assert_equal true, MIME::Types.send(:lazy_load?)
23
+ assert_output '', /RUBY_MIME_TYPES_LAZY_LOAD/ do
24
+ assert_equal true, MIME::Types.send(:lazy_load?)
25
+ end
24
26
  end
25
27
 
26
28
  it 'is nil when RUBY_MIME_TYPES_LAZY_LOAD is unset' do
27
29
  ENV['RUBY_MIME_TYPES_LAZY_LOAD'] = nil
28
- assert_equal nil, MIME::Types.send(:lazy_load?)
30
+ assert_output '', '' do
31
+ assert_nil MIME::Types.send(:lazy_load?)
32
+ end
29
33
  end
30
34
 
31
35
  it 'is false when RUBY_MIME_TYPES_LAZY_LOAD is false' do
32
36
  ENV['RUBY_MIME_TYPES_LAZY_LOAD'] = 'false'
33
- assert_equal false, MIME::Types.send(:lazy_load?)
37
+ assert_output '', /RUBY_MIME_TYPES_LAZY_LOAD/ do
38
+ assert_equal false, MIME::Types.send(:lazy_load?)
39
+ end
34
40
  end
35
41
  end
36
42
 
@@ -1,4 +1,4 @@
1
- # -*- ruby encoding: utf-8 -*-
1
+ # frozen_string_literal: true
2
2
 
3
3
  require 'mime/types'
4
4
  require 'minitest_helper'
@@ -14,21 +14,21 @@ identity and orientation.
14
14
  Examples of behavior that contributes to creating a positive environment
15
15
  include:
16
16
 
17
- * Using welcoming and inclusive language
18
- * Being respectful of differing viewpoints and experiences
19
- * Gracefully accepting constructive criticism
20
- * Focusing on what is best for the community
21
- * Showing empathy towards other community members
17
+ - Using welcoming and inclusive language
18
+ - Being respectful of differing viewpoints and experiences
19
+ - Gracefully accepting constructive criticism
20
+ - Focusing on what is best for the community
21
+ - Showing empathy towards other community members
22
22
 
23
23
  Examples of unacceptable behavior by participants include:
24
24
 
25
- * The use of sexualized language or imagery and unwelcome sexual attention or
25
+ - The use of sexualized language or imagery and unwelcome sexual attention or
26
26
  advances
27
- * Trolling, insulting/derogatory comments, and personal or political attacks
28
- * Public or private harassment
29
- * Publishing others' private information, such as a physical or electronic
27
+ - Trolling, insulting/derogatory comments, and personal or political attacks
28
+ - Public or private harassment
29
+ - Publishing others' private information, such as a physical or electronic
30
30
  address, without explicit permission
31
- * Other conduct which could reasonably be considered inappropriate in a
31
+ - Other conduct which could reasonably be considered inappropriate in a
32
32
  professional setting
33
33
 
34
34
  ## Our Responsibilities
@@ -0,0 +1,224 @@
1
+ ## Contributing
2
+
3
+ Contributions to mime-types-data is encouraged in any form: a bug report, new
4
+ MIME type defintions, or additional code to help manage the MIME types. As with
5
+ many of my projects, I have a few suggestions for improving the chance of
6
+ acceptance of your code contributions:
7
+
8
+ - The support files are written in Ruby and should remain in the coding style
9
+ that already exists, and I use hoe for releasing the mime-types-data RubyGem.
10
+ - Use a thoughtfully-named topic branch that contains your change. Rebase your
11
+ commits into logical chunks as necessary.
12
+ - Use [quality commit messages][qcm].
13
+ - Do not change the version number; when your patch is accepted and a release
14
+ is made, the version will be updated at that point.
15
+ - Submit a GitHub pull request with your changes.
16
+ - New or changed behaviours require new or updated documentation.
17
+
18
+ Although mime-types-data was extracted from the [Ruby mime-types][rmt] gem and
19
+ the support files are written in Ruby, the _target_ of mime-types-data is any
20
+ implementation that wishes to use the data as a MIME types registry, so I am
21
+ particularly interested in tools that will create a mime-types-data package for
22
+ other languages.
23
+
24
+ ### Adding or Modifying MIME Types
25
+
26
+ The Ruby mime-types gem loads its data from files encoded in the `data`
27
+ directory in this gem by loading `mime-types-data` and reading
28
+ MIME::Types::Data::PATH. These files are compiled files from the collection of
29
+ data in the `types` directory. Pull requests that include changes to these
30
+ files will require amendment to revert these files.
31
+
32
+ New or modified MIME types should be edited in the appropriate YAML file under
33
+ `types`. The format is as shown below for the `application/xml` MIME type
34
+ in `types/application.yml`.
35
+
36
+ ```yaml
37
+ - !ruby/object:MIME::Type
38
+ content-type: application/xml
39
+ encoding: 8bit
40
+ extensions:
41
+ - xml
42
+ - xsl
43
+ references:
44
+ - IANA
45
+ - RFC3023
46
+ xrefs: !ruby/hash:MIME::Types::Container
47
+ rfc:
48
+ - rfc3023
49
+ registered: true
50
+ ```
51
+
52
+ There are other fields that can be added, matching the fields discussed in the
53
+ documentation for MIME::Type. Pull requests for MIME types should just contain
54
+ the changes to the YAML files for the new or modified MIME types; I will
55
+ convert the YAML files to JSON prior to a new release. I would rather not have
56
+ to verify that the JSON matches the YAML changes, which is why it is not
57
+ necessary to convert for the pull request.
58
+
59
+ If you are making a change for a private fork, use `rake convert:yaml:json` to
60
+ convert the YAML to JSON, or `rake convert:yaml:columnar` to convert it to the
61
+ new columnar format.
62
+
63
+ #### Updating Types from the IANA or Apache Lists
64
+
65
+ If you are maintaining a private fork and wish to update your copy of the MIME
66
+ types registry used by this gem, you can do this with the rake tasks:
67
+
68
+ ```sh
69
+ $ rake mime:iana
70
+ $ rake mime:apache
71
+ ```
72
+
73
+ ### Development Dependencies
74
+
75
+ mime-types-data uses Ryan Davis’s {Hoe}[https://github.com/seattlerb/hoe] to
76
+ manage the release process, and it adds a number of rake tasks. You will mostly
77
+ be interested in:
78
+
79
+ ```sh
80
+ $ rake
81
+ ```
82
+
83
+ which runs the tests the same way that:
84
+
85
+ ```sh
86
+ $ rake test
87
+ $ rake travis
88
+ ```
89
+
90
+ will do.
91
+
92
+ To assist with the installation of the development dependencies for
93
+ mime-types-data, I have provided the simplest possible Gemfile pointing to the
94
+ (generated) `mime-types-data.gemspec` file. This will permit you to do:
95
+
96
+ ```sh
97
+ $ bundle install
98
+ ```
99
+
100
+ to get the development dependencies. If you aleady have `hoe` installed, you
101
+ can accomplish the same thing with:
102
+
103
+ ```sh
104
+ $ rake newb
105
+ ```
106
+
107
+ This task will install any missing dependencies, run the tests/specs, and
108
+ generate the RDoc.
109
+
110
+ You can run tests with code coverage analysis by running:
111
+
112
+ ```sh
113
+ $ rake test:coverage
114
+ ```
115
+
116
+ ### Workflow
117
+
118
+ Here's the most direct way to get your work merged into the project:
119
+
120
+ - Fork the project.
121
+ - Clone down your fork (`git clone git://github.com/<username>/mime-types-data.git`).
122
+ - Create a topic branch to contain your change (`git checkout -b my\_awesome\_feature`).
123
+ - Hack away, add tests. Not necessarily in that order.
124
+ - Make sure everything still passes by running `rake`.
125
+ - If necessary, rebase your commits into logical chunks, without errors.
126
+ - Push the branch up (`git push origin my\_awesome\_feature`).
127
+ - Create a pull request against mime-types/mime-types-data and describe what
128
+ your change does and the why you think it should be merged.
129
+
130
+ ### The Release Process
131
+
132
+ The release process needs automation; as it includes generating code and
133
+ committing to the repository, it is not clear how this will happen safely.
134
+
135
+ 1. Review any outstanding issues or pull requests to see if anything needs to
136
+ be addressed. This is necessary because there is currently no automated
137
+ source for extensions for the thousands of MIME entries. (Suggestions and/or
138
+ pull requests for same would be deeply appreciated.)
139
+ 2. `bundle install`
140
+ 3. `bundle exec rake mime:apache`
141
+ 4. `bundle exec rake mime:iana`
142
+ 5. Review the changes to make sure that the changes are sane. The IANA data
143
+ source changes from time to time, resulting in big changes or even a broken
144
+ step 4. (The most recent change was the addition of the font/\* top-level
145
+ category.)
146
+ 6. `bundle exec rake convert`
147
+ 7. `bundle exec rake update:version`
148
+ 8. Write up the changes in History.md. If any PRs have been merged, these
149
+ should be noted specifically.
150
+ 9. Commit the changes and push to GitHub.
151
+ 10. `bundle exec rake release VERSION=newversion`
152
+
153
+ ### Automating the Release
154
+
155
+ If anyone wishes to provide suggestions on automation, this would be a
156
+ two-phase process:
157
+
158
+ 1. A system would need to periodically create PRs to the GitHub repository
159
+ with the output of the following commands (steps 2, 3, and 4):
160
+
161
+ ```sh
162
+ bundle install
163
+ bundle exec rake mime:apache
164
+ bundle exec rake mime:iana
165
+ git add .
166
+ git commit -m "[Automated] MIME Type update for $(date)"
167
+ # Somehow make the PR from here.
168
+ ```
169
+
170
+ 2. Once this PR is approved and merged, the next steps would be conversion,
171
+ version update, automatic update of History.md, and release (steps 6–10).
172
+
173
+ This is based on an issue [#18][].
174
+
175
+ ### Contributors
176
+
177
+ - Austin Ziegler created mime-types.
178
+
179
+ Thanks to everyone else who has contributed to mime-types:
180
+
181
+ - Aaron Patterson
182
+ - Aggelos Avgerinos
183
+ - Alessio Parma
184
+ - Alex Balhatchet
185
+ - Andre Pankratz
186
+ - Andrey Eremin
187
+ - Andy Brody
188
+ - Arnaud Meuret
189
+ - Bradley Meck
190
+ - Brandon Galbraith
191
+ - Chris Gat
192
+ - David Genord
193
+ - Eric Marden
194
+ - Garret Alfert
195
+ - Godfrey Chan
196
+ - Greg Brockman
197
+ - Hans de Graaff
198
+ - Henrik Hodne
199
+ - Jeremy Evans
200
+ - John Gardner
201
+ - Juanito Fatas
202
+ - Keerthi Siva
203
+ - Ken Ip
204
+ - Łukasz Śliwa
205
+ - Lucia
206
+ - Martin d'Allens
207
+ - Mauricio Linhares
208
+ - Myk Klemme
209
+ - nycvotes-dev
210
+ - Postmodern
211
+ - Richard Hirner
212
+ - Richard Hurt
213
+ - Richard Schneeman
214
+ - Robert Buchberger
215
+ - Sergio Baptista
216
+ - Tao Guo
217
+ - Thomas Leese
218
+ - Tibor Szolár
219
+ - Todd Carrico
220
+ - Yoran Brondsema
221
+
222
+ [qcm]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
223
+ [rmt]: https://github.com/mime-types/ruby-mime-types/
224
+ [#18]: https://github.com/mime-types/mime-types-data/issues/18