myobie-mime-types 1.15.1 → 1.15.2

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.
@@ -39,19 +39,22 @@
39
39
 
40
40
  Gem::Specification.new do |s|
41
41
  s.name = "mime-types"
42
- s.version = "1.15.1"
42
+ s.version = "1.15.2"
43
43
  # s.date = "2008-11-07"
44
44
  s.summary = "Manages a MIME Content-Type that will return the Content-Type for a given filename."
45
45
  s.email = "austin@rubyforge.org"
46
46
  s.homepage = "http://mime-types.rubyforge.org/"
47
+ s.rubyforge_project = "mime-types"
47
48
  s.description = "See README"
48
- s.has_rdoc = true
49
+ s.has_rdoc = false
49
50
 
50
- s.authors = ["Austin Ziegler", "Nathan Herald"]
51
+ s.authors = ["Austin Ziegler"]
51
52
 
52
- s.files = ["bin/**/*",
53
- "lib/**/*",
54
- "tests/**/*",
53
+ s.files = ["lib/",
54
+ "lib/mime/types.rb",
55
+ "tests/tc_mime_type.rb",
56
+ "tests/tc_mime_type.rb",
57
+ "tests/testall.rb",
55
58
  "ChangeLog",
56
59
  "README",
57
60
  "LICENCE",
@@ -60,16 +63,16 @@ Gem::Specification.new do |s|
60
63
  "mime-types.gemspec",
61
64
  "pre-setup.rb"]
62
65
 
63
- s.test_files = ["test/tc_mime_type.rb",
64
- "test/tc_mime_type.rb",
65
- "text/testall.rb"]
66
+ s.test_files = ["tests/tc_mime_type.rb",
67
+ "tests/tc_mime_type.rb",
68
+ "tests/testall.rb"]
66
69
 
67
70
  s.require_paths = ["lib"]
68
71
 
69
- s.rdoc_options = %w(--title MIME::Types --main README --line-numbers)
72
+ # s.rdoc_options = %w(--title MIME::Types --main README --line-numbers)
70
73
  s.extra_rdoc_files = ["Install", "ChangeLog", "README"]
71
74
 
72
75
  s.add_dependency("diff-lcs", ["> 0.0.0"])
73
- s.add_dependency("mime-types", ["> 0.0.0"])
76
+ # s.add_dependency("mime-types", ["> 0.0.0"])
74
77
  s.add_dependency("open4", ["> 0.0.0"])
75
78
  end
@@ -0,0 +1,275 @@
1
+ #! /usr/bin/env ruby
2
+ #--
3
+ # MIME::Types for Ruby
4
+ # http://rubyforge.org/projects/mime-types/
5
+ # Copyright 2003 - 2005 Austin Ziegler.
6
+ # Licensed under a MIT-style licence.
7
+ #
8
+ # $Id$
9
+ #++
10
+ $LOAD_PATH.unshift("#{File.dirname(__FILE__)}/../lib") if __FILE__ == $0
11
+
12
+ require 'mime/types'
13
+ require 'test/unit'
14
+
15
+ class Test_MIME__Type < Test::Unit::TestCase #:nodoc:
16
+ def setup
17
+ @zip = MIME::Type.new('x-appl/x-zip') { |t| t.extensions = ['zip', 'zp'] }
18
+ end
19
+
20
+ def test_CMP # '<=>'
21
+ assert(MIME::Type.new('text/plain') == MIME::Type.new('text/plain'))
22
+ assert(MIME::Type.new('text/plain') != MIME::Type.new('image/jpeg'))
23
+ assert(MIME::Type.new('text/plain') == 'text/plain')
24
+ assert(MIME::Type.new('text/plain') != 'image/jpeg')
25
+ assert(MIME::Type.new('text/plain') > MIME::Type.new('text/html'))
26
+ assert(MIME::Type.new('text/plain') > 'text/html')
27
+ assert(MIME::Type.new('text/html') < MIME::Type.new('text/plain'))
28
+ assert(MIME::Type.new('text/html') < 'text/plain')
29
+ assert('text/html' == MIME::Type.new('text/html'))
30
+ assert('text/html' < MIME::Type.new('text/plain'))
31
+ assert('text/plain' > MIME::Type.new('text/html'))
32
+ end
33
+
34
+ def test_ascii?
35
+ assert(MIME::Type.new('text/plain').ascii?)
36
+ assert(!MIME::Type.new('image/jpeg').ascii?)
37
+ assert(!MIME::Type.new('application/x-msword').ascii?)
38
+ assert(MIME::Type.new('text/vCard').ascii?)
39
+ assert(!MIME::Type.new('application/pkcs7-mime').ascii?)
40
+ assert(!@zip.ascii?)
41
+ end
42
+
43
+ def test_binary?
44
+ assert(!MIME::Type.new('text/plain').binary?)
45
+ assert(MIME::Type.new('image/jpeg').binary?)
46
+ assert(MIME::Type.new('application/x-msword').binary?)
47
+ assert(!MIME::Type.new('text/vCard').binary?)
48
+ assert(MIME::Type.new('application/pkcs7-mime').binary?)
49
+ assert(@zip.binary?)
50
+ end
51
+
52
+ def test_complete?
53
+ assert_nothing_raised do
54
+ @yaml = MIME::Type.from_array('text/x-yaml', ['yaml', 'yml'], '8bit',
55
+ 'linux')
56
+ end
57
+ assert(@yaml.complete?)
58
+ assert_nothing_raised { @yaml.extensions = nil }
59
+ assert(!@yaml.complete?)
60
+ end
61
+
62
+ def test_content_type
63
+ assert_equal(MIME::Type.new('text/plain').content_type, 'text/plain')
64
+ assert_equal(MIME::Type.new('image/jpeg').content_type, 'image/jpeg')
65
+ assert_equal(MIME::Type.new('application/x-msword').content_type, 'application/x-msword')
66
+ assert_equal(MIME::Type.new('text/vCard').content_type, 'text/vCard')
67
+ assert_equal(MIME::Type.new('application/pkcs7-mime').content_type, 'application/pkcs7-mime')
68
+ assert_equal(@zip.content_type, 'x-appl/x-zip');
69
+ end
70
+
71
+ def test_encoding
72
+ assert_equal(MIME::Type.new('text/plain').encoding, 'quoted-printable')
73
+ assert_equal(MIME::Type.new('image/jpeg').encoding, 'base64')
74
+ assert_equal(MIME::Type.new('application/x-msword').encoding, 'base64')
75
+ assert_equal(MIME::Type.new('text/vCard').encoding, 'quoted-printable')
76
+ assert_equal(MIME::Type.new('application/pkcs7-mime').encoding, 'base64')
77
+ assert_nothing_raised do
78
+ @yaml = MIME::Type.from_array('text/x-yaml', ['yaml', 'yml'], '8bit',
79
+ 'linux')
80
+ end
81
+ assert_equal(@yaml.encoding, '8bit')
82
+ assert_nothing_raised { @yaml.encoding = 'base64' }
83
+ assert_equal(@yaml.encoding, 'base64')
84
+ assert_nothing_raised { @yaml.encoding = :default }
85
+ assert_equal(@yaml.encoding, 'quoted-printable')
86
+ assert_raises(ArgumentError) { @yaml.encoding = 'binary' }
87
+ assert_equal(@zip.encoding, 'base64')
88
+ end
89
+
90
+ def test_eql?
91
+ assert(MIME::Type.new('text/plain').eql?(MIME::Type.new('text/plain')))
92
+ assert(!MIME::Type.new('text/plain').eql?(MIME::Type.new('image/jpeg')))
93
+ assert(!MIME::Type.new('text/plain').eql?('text/plain'))
94
+ assert(!MIME::Type.new('text/plain').eql?('image/jpeg'))
95
+ end
96
+
97
+ def test_extensions
98
+ assert_nothing_raised do
99
+ @yaml = MIME::Type.from_array('text/x-yaml', ['yaml', 'yml'], '8bit',
100
+ 'linux')
101
+ end
102
+ assert_equal(@yaml.extensions, ['yaml', 'yml'])
103
+ assert_nothing_raised { @yaml.extensions = 'yaml' }
104
+ assert_equal(@yaml.extensions, ['yaml'])
105
+ assert_equal(@zip.extensions.size, 2)
106
+ assert_equal(@zip.extensions, ['zip', 'zp'])
107
+ end
108
+
109
+ def test_like?
110
+ assert(MIME::Type.new('text/plain').like?(MIME::Type.new('text/plain')))
111
+ assert(MIME::Type.new('text/plain').like?(MIME::Type.new('text/x-plain')))
112
+ assert(!MIME::Type.new('text/plain').like?(MIME::Type.new('image/jpeg')))
113
+ assert(MIME::Type.new('text/plain').like?('text/plain'))
114
+ assert(MIME::Type.new('text/plain').like?('text/x-plain'))
115
+ assert(!MIME::Type.new('text/plain').like?('image/jpeg'))
116
+ end
117
+
118
+ def test_media_type
119
+ assert_equal(MIME::Type.new('text/plain').media_type, 'text')
120
+ assert_equal(MIME::Type.new('image/jpeg').media_type, 'image')
121
+ assert_equal(MIME::Type.new('application/x-msword').media_type, 'application')
122
+ assert_equal(MIME::Type.new('text/vCard').media_type, 'text')
123
+ assert_equal(MIME::Type.new('application/pkcs7-mime').media_type, 'application')
124
+ assert_equal(MIME::Type.new('x-chemical/x-pdb').media_type, 'chemical')
125
+ assert_equal(@zip.media_type, 'appl')
126
+ end
127
+
128
+ def test_platform?
129
+ assert_nothing_raised do
130
+ @yaml = MIME::Type.from_array('text/x-yaml', ['yaml', 'yml'], '8bit',
131
+ 'oddbox')
132
+ end
133
+ assert(!@yaml.platform?)
134
+ assert_nothing_raised { @yaml.system = nil }
135
+ assert(!@yaml.platform?)
136
+ assert_nothing_raised { @yaml.system = /#{RUBY_PLATFORM}/ }
137
+ assert(@yaml.platform?)
138
+ end
139
+
140
+ def test_raw_media_type
141
+ assert_equal(MIME::Type.new('text/plain').raw_media_type, 'text')
142
+ assert_equal(MIME::Type.new('image/jpeg').raw_media_type, 'image')
143
+ assert_equal(MIME::Type.new('application/x-msword').raw_media_type, 'application')
144
+ assert_equal(MIME::Type.new('text/vCard').raw_media_type, 'text')
145
+ assert_equal(MIME::Type.new('application/pkcs7-mime').raw_media_type, 'application')
146
+
147
+ assert_equal(MIME::Type.new('x-chemical/x-pdb').raw_media_type, 'x-chemical')
148
+ assert_equal(@zip.raw_media_type, 'x-appl')
149
+ end
150
+
151
+ def test_raw_sub_type
152
+ assert_equal(MIME::Type.new('text/plain').raw_sub_type, 'plain')
153
+ assert_equal(MIME::Type.new('image/jpeg').raw_sub_type, 'jpeg')
154
+ assert_equal(MIME::Type.new('application/x-msword').raw_sub_type, 'x-msword')
155
+ assert_equal(MIME::Type.new('text/vCard').raw_sub_type, 'vCard')
156
+ assert_equal(MIME::Type.new('application/pkcs7-mime').raw_sub_type, 'pkcs7-mime')
157
+ assert_equal(@zip.raw_sub_type, 'x-zip')
158
+ end
159
+
160
+ def test_registered?
161
+ assert(MIME::Type.new('text/plain').registered?)
162
+ assert(MIME::Type.new('image/jpeg').registered?)
163
+ assert(!MIME::Type.new('application/x-msword').registered?)
164
+ assert(MIME::Type.new('text/vCard').registered?)
165
+ assert(MIME::Type.new('application/pkcs7-mime').registered?)
166
+ assert(!@zip.registered?)
167
+ end
168
+
169
+ def test_signature?
170
+ assert(!MIME::Type.new('text/plain').signature?)
171
+ assert(!MIME::Type.new('image/jpeg').signature?)
172
+ assert(!MIME::Type.new('application/x-msword').signature?)
173
+ assert(MIME::Type.new('text/vCard').signature?)
174
+ assert(MIME::Type.new('application/pkcs7-mime').signature?)
175
+ end
176
+
177
+ def test_simplified
178
+ assert_equal(MIME::Type.new('text/plain').simplified, 'text/plain')
179
+ assert_equal(MIME::Type.new('image/jpeg').simplified, 'image/jpeg')
180
+ assert_equal(MIME::Type.new('application/x-msword').simplified, 'application/msword')
181
+ assert_equal(MIME::Type.new('text/vCard').simplified, 'text/vcard')
182
+ assert_equal(MIME::Type.new('application/pkcs7-mime').simplified, 'application/pkcs7-mime')
183
+ assert_equal(MIME::Type.new('x-chemical/x-pdb').simplified, 'chemical/pdb')
184
+ end
185
+
186
+ def test_sub_type
187
+ assert_equal(MIME::Type.new('text/plain').sub_type, 'plain')
188
+ assert_equal(MIME::Type.new('image/jpeg').sub_type, 'jpeg')
189
+ assert_equal(MIME::Type.new('application/x-msword').sub_type, 'msword')
190
+ assert_equal(MIME::Type.new('text/vCard').sub_type, 'vcard')
191
+ assert_equal(MIME::Type.new('application/pkcs7-mime').sub_type, 'pkcs7-mime')
192
+ assert_equal(@zip.sub_type, 'zip')
193
+ end
194
+
195
+ def test_system
196
+ assert_nothing_raised do
197
+ @yaml = MIME::Type.from_array('text/x-yaml', ['yaml', 'yml'], '8bit',
198
+ 'linux')
199
+ end
200
+ assert_equal(@yaml.system, %r{linux})
201
+ assert_nothing_raised { @yaml.system = /win32/ }
202
+ assert_equal(@yaml.system, %r{win32})
203
+ assert_nothing_raised { @yaml.system = nil }
204
+ assert_nil(@yaml.system)
205
+ end
206
+
207
+ def test_system?
208
+ assert_nothing_raised do
209
+ @yaml = MIME::Type.from_array('text/x-yaml', ['yaml', 'yml'], '8bit',
210
+ 'linux')
211
+ end
212
+ assert(@yaml.system?)
213
+ assert_nothing_raised { @yaml.system = nil }
214
+ assert(!@yaml.system?)
215
+ end
216
+
217
+ def test_to_a
218
+ assert_nothing_raised do
219
+ @yaml = MIME::Type.from_array('text/x-yaml', ['yaml', 'yml'], '8bit',
220
+ 'linux')
221
+ end
222
+ assert_equal(@yaml.to_a, ['text/x-yaml', ['yaml', 'yml'], '8bit',
223
+ /linux/, nil, nil, nil, false])
224
+ end
225
+
226
+ def test_to_hash
227
+ assert_nothing_raised do
228
+ @yaml = MIME::Type.from_array('text/x-yaml', ['yaml', 'yml'], '8bit',
229
+ 'linux')
230
+ end
231
+ assert_equal(@yaml.to_hash,
232
+ { 'Content-Type' => 'text/x-yaml',
233
+ 'Content-Transfer-Encoding' => '8bit',
234
+ 'Extensions' => ['yaml', 'yml'],
235
+ 'System' => /linux/,
236
+ 'Registered' => false,
237
+ 'URL' => nil,
238
+ 'Obsolete' => nil,
239
+ 'Docs' => nil })
240
+ end
241
+
242
+ def test_to_s
243
+ assert_equal("#{MIME::Type.new('text/plain')}", 'text/plain')
244
+ end
245
+
246
+ def test_s_constructors
247
+ assert_not_nil(@zip)
248
+ yaml = MIME::Type.from_array('text/x-yaml', ['yaml', 'yml'], '8bit',
249
+ 'linux')
250
+ assert_instance_of(MIME::Type, yaml)
251
+ yaml = MIME::Type.from_hash('Content-Type' => 'text/x-yaml',
252
+ 'Content-Transfer-Encoding' => '8bit',
253
+ 'System' => 'linux',
254
+ 'Extensions' => ['yaml', 'yml'])
255
+ assert_instance_of(MIME::Type, yaml)
256
+ yaml = MIME::Type.new('text/x-yaml') do |y|
257
+ y.extensions = ['yaml', 'yml']
258
+ y.encoding = '8bit'
259
+ y.system = 'linux'
260
+ end
261
+ assert_instance_of(MIME::Type, yaml)
262
+ assert_raises(MIME::InvalidContentType) { MIME::Type.new('apps') }
263
+ assert_raises(MIME::InvalidContentType) { MIME::Type.new(nil) }
264
+ end
265
+
266
+ def test_s_simplified
267
+ assert_equal(MIME::Type.simplified('text/plain'), 'text/plain')
268
+ assert_equal(MIME::Type.simplified('image/jpeg'), 'image/jpeg')
269
+ assert_equal(MIME::Type.simplified('application/x-msword'), 'application/msword')
270
+ assert_equal(MIME::Type.simplified('text/vCard'), 'text/vcard')
271
+ assert_equal(MIME::Type.simplified('application/pkcs7-mime'), 'application/pkcs7-mime')
272
+ assert_equal(@zip.simplified, 'appl/zip')
273
+ assert_equal(MIME::Type.simplified('x-xyz/abc'), 'xyz/abc')
274
+ end
275
+ end
@@ -0,0 +1,18 @@
1
+ #! /usr/bin/env ruby
2
+ #--
3
+ # MIME::Types for Ruby
4
+ # http://rubyforge.org/projects/mime-types/
5
+ # Copyright 2003 - 2005 Austin Ziegler.
6
+ # Licensed under a MIT-style licence.
7
+ #
8
+ # $Id$
9
+ #++
10
+
11
+ $LOAD_PATH.unshift("#{File.dirname(__FILE__)}/../lib") if __FILE__ == $0
12
+
13
+ puts "Checking for test cases:"
14
+ Dir['tc_*.rb'].each do |testcase|
15
+ puts "\t#{testcase}"
16
+ require testcase
17
+ end
18
+ puts
metadata CHANGED
@@ -1,11 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: myobie-mime-types
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.15.1
4
+ version: 1.15.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Austin Ziegler
8
- - Nathan Herald
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
@@ -22,15 +21,6 @@ dependencies:
22
21
  - !ruby/object:Gem::Version
23
22
  version: 0.0.0
24
23
  version:
25
- - !ruby/object:Gem::Dependency
26
- name: mime-types
27
- version_requirement:
28
- version_requirements: !ruby/object:Gem::Requirement
29
- requirements:
30
- - - ">"
31
- - !ruby/object:Gem::Version
32
- version: 0.0.0
33
- version:
34
24
  - !ruby/object:Gem::Dependency
35
25
  name: open4
36
26
  version_requirement:
@@ -51,9 +41,10 @@ extra_rdoc_files:
51
41
  - ChangeLog
52
42
  - README
53
43
  files:
54
- - bin/**/*
55
- - lib/**/*
56
- - tests/**/*
44
+ - lib/
45
+ - lib/mime/types.rb
46
+ - tests/tc_mime_type.rb
47
+ - tests/testall.rb
57
48
  - ChangeLog
58
49
  - README
59
50
  - LICENCE
@@ -62,15 +53,11 @@ files:
62
53
  - mime-types.gemspec
63
54
  - pre-setup.rb
64
55
  - Install
65
- has_rdoc: true
56
+ has_rdoc: false
66
57
  homepage: http://mime-types.rubyforge.org/
67
58
  post_install_message:
68
- rdoc_options:
69
- - --title
70
- - MIME::Types
71
- - --main
72
- - README
73
- - --line-numbers
59
+ rdoc_options: []
60
+
74
61
  require_paths:
75
62
  - lib
76
63
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -87,12 +74,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
87
74
  version:
88
75
  requirements: []
89
76
 
90
- rubyforge_project:
77
+ rubyforge_project: mime-types
91
78
  rubygems_version: 1.2.0
92
79
  signing_key:
93
80
  specification_version: 2
94
81
  summary: Manages a MIME Content-Type that will return the Content-Type for a given filename.
95
82
  test_files:
96
- - test/tc_mime_type.rb
97
- - test/tc_mime_type.rb
98
- - text/testall.rb
83
+ - tests/tc_mime_type.rb
84
+ - tests/tc_mime_type.rb
85
+ - tests/testall.rb