multi_mime 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +6 -14
- data/.gitignore +6 -7
- data/.rubocop.yml +24 -0
- data/.travis.yml +13 -11
- data/Gemfile +3 -30
- data/README.md +30 -23
- data/Rakefile +9 -19
- data/lib/multi_mime.rb +47 -32
- data/lib/multi_mime/adapter.rb +7 -12
- data/lib/multi_mime/adapters/mime_type.rb +7 -17
- data/lib/multi_mime/adapters/mime_types.rb +6 -16
- data/lib/multi_mime/adapters/mimemagic.rb +6 -16
- data/lib/multi_mime/adapters/rack_mime.rb +7 -17
- data/lib/multi_mime/null_type.rb +2 -6
- data/lib/multi_mime/version.rb +2 -2
- data/multi_mime.gemspec +36 -18
- data/spec/shared/adapter.rb +23 -30
- data/spec/spec_helper.rb +24 -23
- data/spec/support/fakefs.rb +5 -5
- data/spec/support/pry.rb +3 -3
- data/spec/support/timecop.rb +2 -0
- data/spec/unit/multi_mime_spec.rb +47 -47
- metadata +168 -14
- data/.rspec +0 -3
- data/spec/support/simplecov.rb +0 -15
data/spec/support/fakefs.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
1
|
+
require 'fakefs/spec_helpers'
|
2
|
+
require 'pathname'
|
3
|
+
require 'fileutils'
|
4
4
|
RSpec.configure do |config|
|
5
|
-
config.include FakeFS::SpecHelpers, :
|
6
|
-
end
|
5
|
+
config.include FakeFS::SpecHelpers, fakefs: true
|
6
|
+
end
|
data/spec/support/pry.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
if
|
2
|
-
require
|
3
|
-
end
|
1
|
+
if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'ruby'
|
2
|
+
require 'pry' unless ENV['CI']
|
3
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
3
|
describe MultiMime do
|
4
4
|
|
@@ -18,7 +18,7 @@ describe MultiMime do
|
|
18
18
|
|
19
19
|
describe :type_for_file do
|
20
20
|
specify { expect { MultiMime.type_for_file(nil) }.to raise_error(ArgumentError) }
|
21
|
-
specify { expect { MultiMime.type_for_file(
|
21
|
+
specify { expect { MultiMime.type_for_file('.html') }.to raise_error(ArgumentError) }
|
22
22
|
end
|
23
23
|
|
24
24
|
end
|
@@ -42,70 +42,70 @@ describe MultiMime do
|
|
42
42
|
|
43
43
|
end
|
44
44
|
|
45
|
-
|
45
|
+
context :defaults do
|
46
46
|
|
47
|
-
|
47
|
+
describe 'MIME::Types' do
|
48
48
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
# end
|
49
|
+
around do |example|
|
50
|
+
undefine_constants(:MimeMagic, :Mime, :Rack) { example.call }
|
51
|
+
MultiMime.reset_adapter
|
52
|
+
end
|
54
53
|
|
55
|
-
|
56
|
-
|
57
|
-
|
54
|
+
it 'should detect adapter' do
|
55
|
+
require 'mime/types'
|
56
|
+
expect(MultiMime.default_adapter).to eq :mime_types
|
57
|
+
end
|
58
58
|
|
59
|
-
|
59
|
+
end
|
60
60
|
|
61
|
-
|
61
|
+
describe 'MimeMagic' do
|
62
62
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
# end
|
63
|
+
around do |example|
|
64
|
+
undefine_constants(:MIME, :Mime, :Rack) { example.call }
|
65
|
+
MultiMime.reset_adapter
|
66
|
+
end
|
68
67
|
|
69
|
-
|
70
|
-
|
71
|
-
|
68
|
+
it 'should detect adapter' do
|
69
|
+
require 'mimemagic'
|
70
|
+
expect(MultiMime.default_adapter).to eq :mimemagic
|
71
|
+
end
|
72
72
|
|
73
|
-
|
73
|
+
end
|
74
74
|
|
75
|
-
|
75
|
+
describe 'Mime::Type' do
|
76
76
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
# end
|
77
|
+
around do |example|
|
78
|
+
undefine_constants(:MIME, :MimeMagic, :Rack) { example.call }
|
79
|
+
MultiMime.reset_adapter
|
80
|
+
end
|
82
81
|
|
83
|
-
|
84
|
-
|
85
|
-
|
82
|
+
it 'should detect adapter' do
|
83
|
+
require 'action_dispatch/http/mime_type'
|
84
|
+
expect(MultiMime.default_adapter).to eq :mime_type
|
85
|
+
end
|
86
86
|
|
87
|
-
|
87
|
+
end
|
88
88
|
|
89
|
-
|
89
|
+
describe 'Rack::Mime' do
|
90
90
|
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
# end
|
91
|
+
around do |example|
|
92
|
+
undefine_constants(:MIME, :Mime, :MimeMagic) { example.call }
|
93
|
+
MultiMime.reset_adapter
|
94
|
+
end
|
96
95
|
|
97
|
-
|
98
|
-
|
99
|
-
|
96
|
+
it 'should detect adapter' do
|
97
|
+
require 'rack/mime'
|
98
|
+
expect(MultiMime.default_adapter).to eq :rack_mime
|
99
|
+
end
|
100
100
|
|
101
|
-
|
101
|
+
end
|
102
102
|
|
103
|
-
|
103
|
+
end
|
104
104
|
|
105
|
-
|
105
|
+
MultiMime::REQUIREMENT_MAP.each do |adapter, library, clazz|
|
106
106
|
context adapter do
|
107
|
-
it_behaves_like
|
107
|
+
it_behaves_like 'an adapter', adapter
|
108
108
|
end
|
109
109
|
end
|
110
110
|
|
111
|
-
end
|
111
|
+
end
|
metadata
CHANGED
@@ -1,27 +1,83 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: multi_mime
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Karl Freeman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-03-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: fog
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.12'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.12'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: mime-types
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.5'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.5'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: actionpack
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.2'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.2'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rack
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
18
60
|
- !ruby/object:Gem::Version
|
19
61
|
version: '0'
|
20
62
|
type: :development
|
21
63
|
prerelease: false
|
22
64
|
version_requirements: !ruby/object:Gem::Requirement
|
23
65
|
requirements:
|
24
|
-
- -
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: mimemagic
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
25
81
|
- !ruby/object:Gem::Version
|
26
82
|
version: '0'
|
27
83
|
- !ruby/object:Gem::Dependency
|
@@ -30,14 +86,112 @@ dependencies:
|
|
30
86
|
requirements:
|
31
87
|
- - ~>
|
32
88
|
- !ruby/object:Gem::Version
|
33
|
-
version: '1.
|
89
|
+
version: '1.5'
|
34
90
|
type: :development
|
35
91
|
prerelease: false
|
36
92
|
version_requirements: !ruby/object:Gem::Requirement
|
37
93
|
requirements:
|
38
94
|
- - ~>
|
39
95
|
- !ruby/object:Gem::Version
|
40
|
-
version: '1.
|
96
|
+
version: '1.5'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rake
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ~>
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '10.0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ~>
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '10.0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: kramdown
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0.14'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - '>='
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0.14'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: rspec
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - '>='
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - '>='
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: rubocop
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - '>='
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - '>='
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: timecop
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - '>='
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - '>='
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0'
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: pry
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - '>='
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - '>='
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '0'
|
181
|
+
- !ruby/object:Gem::Dependency
|
182
|
+
name: yard
|
183
|
+
requirement: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - '>='
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: '0'
|
188
|
+
type: :development
|
189
|
+
prerelease: false
|
190
|
+
version_requirements: !ruby/object:Gem::Requirement
|
191
|
+
requirements:
|
192
|
+
- - '>='
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: '0'
|
41
195
|
description: A generic swappable back-end for Mime::Type detection
|
42
196
|
email:
|
43
197
|
- karlfreeman@gmail.com
|
@@ -47,7 +201,7 @@ extra_rdoc_files: []
|
|
47
201
|
files:
|
48
202
|
- .document
|
49
203
|
- .gitignore
|
50
|
-
- .
|
204
|
+
- .rubocop.yml
|
51
205
|
- .travis.yml
|
52
206
|
- .yardopts
|
53
207
|
- CHANGELOG.md
|
@@ -69,7 +223,7 @@ files:
|
|
69
223
|
- spec/spec_helper.rb
|
70
224
|
- spec/support/fakefs.rb
|
71
225
|
- spec/support/pry.rb
|
72
|
-
- spec/support/
|
226
|
+
- spec/support/timecop.rb
|
73
227
|
- spec/unit/multi_mime_spec.rb
|
74
228
|
homepage: https://github.com/karlfreeman/multi_mime
|
75
229
|
licenses:
|
@@ -81,17 +235,17 @@ require_paths:
|
|
81
235
|
- lib
|
82
236
|
required_ruby_version: !ruby/object:Gem::Requirement
|
83
237
|
requirements:
|
84
|
-
- -
|
238
|
+
- - '>='
|
85
239
|
- !ruby/object:Gem::Version
|
86
|
-
version: 1.9.
|
240
|
+
version: 1.9.3
|
87
241
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
88
242
|
requirements:
|
89
|
-
- -
|
243
|
+
- - '>='
|
90
244
|
- !ruby/object:Gem::Version
|
91
245
|
version: '0'
|
92
246
|
requirements: []
|
93
247
|
rubyforge_project:
|
94
|
-
rubygems_version: 2.0.
|
248
|
+
rubygems_version: 2.0.14
|
95
249
|
signing_key:
|
96
250
|
specification_version: 4
|
97
251
|
summary: A generic swappable back-end for Mime::Type detection
|
@@ -100,6 +254,6 @@ test_files:
|
|
100
254
|
- spec/spec_helper.rb
|
101
255
|
- spec/support/fakefs.rb
|
102
256
|
- spec/support/pry.rb
|
103
|
-
- spec/support/
|
257
|
+
- spec/support/timecop.rb
|
104
258
|
- spec/unit/multi_mime_spec.rb
|
105
259
|
has_rdoc:
|
data/.rspec
DELETED
data/spec/support/simplecov.rb
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
if defined?(RUBY_ENGINE) && RUBY_ENGINE == "ruby"
|
2
|
-
|
3
|
-
require "simplecov"
|
4
|
-
|
5
|
-
if ENV["CI"]
|
6
|
-
require "coveralls"
|
7
|
-
Coveralls.wear!
|
8
|
-
SimpleCov.formatter = Coveralls::SimpleCov::Formatter
|
9
|
-
end
|
10
|
-
|
11
|
-
SimpleCov.start do
|
12
|
-
add_filter "vendor"
|
13
|
-
end
|
14
|
-
|
15
|
-
end
|