mimemagic 0.3.10 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bea73bdcae338c252c11c8277843f7eb8dc44973bd5914d7196dba814c0bb857
4
- data.tar.gz: 6896a7a176e4adb7d4d27b8f99680176511d0c0db910fa339b20333adf394f78
3
+ metadata.gz: 0ad244513ca271eba15ef628d0eb5b3aa4f85c8a0a58762f60d84e9d53e3581a
4
+ data.tar.gz: aa54cf7d2a7989f8eb415a50426a78a6f5b0a24e0d4e9697da6b42f825262c3f
5
5
  SHA512:
6
- metadata.gz: d1a8cad78a3938f61c11e9e8f8ab751db7e02f6f778f4128a215b186f71836ecf2169e81133f1cd5f6171214108ca46526ab161edc618127983fe92c51847546
7
- data.tar.gz: 1e5bc77bb41ec5b3be0d19c7f1d8883e5e313df1b1035b6429c05eb7082f33323cdf48152be3f400853e3bbf0dc5b40c7ace4ffec50a39006d2494ea9835a10a
6
+ metadata.gz: dcbb0ec87d4c684068d327117b4c1b189cc41ae8814606b4d19c483abfa7996dd54f5249f9f3bea5114de01eeab7d7d9fd99efdb5289781fd08ded8168e6ac5d
7
+ data.tar.gz: 0e2dbd497c0ea86fde6a5900a5bdd04a39200295bcc693071624f92a29ba4e070792fbe0b694ad4d56d0d24b1b274ec5e3c3ae277e72e95303e16fb27ae03618
data/.gitignore CHANGED
@@ -2,12 +2,5 @@
2
2
  *.gem
3
3
  Gemfile.lock
4
4
  .bundle
5
-
6
- # doc
7
5
  .yardoc
8
- doc/
9
-
10
- vendor
11
-
12
- # don't include generated files
13
- lib/mimemagic/path.rb
6
+ vendor
data/.yardopts CHANGED
@@ -1,6 +1,2 @@
1
- --markup-provider=redcarpet
2
- --markup=markdown
3
1
  --no-private
4
- - README.md
5
- - LICENSE
6
- - CHANGELOG.md
2
+ - README.md
data/CHANGELOG.md CHANGED
@@ -4,6 +4,10 @@
4
4
 
5
5
  ### Breaking Changes
6
6
 
7
+ ## 0.4.1
8
+
9
+ Remove `mimemagic/overlay` as it contains outdated, little used, data.
10
+
7
11
  ## 0.3.7 (2021-03-25)
8
12
 
9
13
  You will now need to ensure you have a copy of the fd.o shared MIME
@@ -18,32 +22,12 @@ None
18
22
 
19
23
  None
20
24
 
21
- ## 0.3.10
22
-
23
- * Improve the development/test experience (@coldnebo, @kachick)
24
-
25
- * Ensure the gem works in environments with gem caching (@haines)
26
-
27
- * Add support for MacPorts installed dependencies (@brlanier)
28
-
29
- * Allow using a dummy XML file in cases where the gem is just a transient
30
- dependency. (@Scharrels)
31
-
32
- ## 0.3.9 (2021-03-25)
33
-
34
- * Resolve issues parsing the version of freedesktop.org.xml shipped with
35
- Ubuntu Trusty.
25
+ ## 0.4.1
36
26
 
37
- * Reintroduce overlays, since it seems at least some people were using
38
- them.
39
-
40
- * Make Rake a runtime dependency.
41
27
 
42
- * Fix the test suite.
43
- ## 0.3.8 (2021-03-25)
28
+ ## 0.4.0
44
29
 
45
- Relax the dependency on Nokogiri to something less specific in order
46
- to avoid conflicting with other dependencies in people's applications.
30
+ Yanked release.
47
31
 
48
32
  ## 0.3.7 (2021-03-25)
49
33
 
data/Gemfile CHANGED
@@ -1,6 +1,3 @@
1
1
  source 'https://rubygems.org/'
2
2
  gemspec
3
3
 
4
- gem 'yard'
5
- gem 'redcarpet'
6
- gem 'github-markup'
data/README.md CHANGED
@@ -46,10 +46,10 @@ http://www.rubydoc.info/github/mimemagicrb/mimemagic
46
46
  Tests
47
47
  =====
48
48
 
49
- ```console
50
- $ bundle install
49
+ ```
50
+ bundle install
51
51
 
52
- $ bundle exec rake test
52
+ rake test
53
53
  ```
54
54
 
55
55
  Authors
@@ -62,4 +62,4 @@ Authors
62
62
  LICENSE
63
63
  =======
64
64
 
65
- {file:LICENSE MIT}
65
+ MIT
data/Rakefile CHANGED
@@ -1,15 +1,9 @@
1
1
  require 'rake/testtask'
2
- require 'rake/clean'
3
-
4
- namespace :ext do
5
- load 'ext/mimemagic/Rakefile'
6
- end
7
- CLOBBER.include("lib/mimemagic/path.rb")
8
2
 
9
3
  task :default => %w(test)
10
4
 
11
5
  desc 'Run tests with minitest'
12
- Rake::TestTask.new("test" => "ext:default") do |t|
6
+ Rake::TestTask.new do |t|
13
7
  t.libs << 'test'
14
8
  t.pattern = 'test/*_test.rb'
15
9
  end
@@ -6,48 +6,28 @@ def locate_mime_database
6
6
  (File.expand_path(ENV["FREEDESKTOP_MIME_TYPES_PATH"]) if ENV["FREEDESKTOP_MIME_TYPES_PATH"]),
7
7
  "/usr/local/share/mime/packages/freedesktop.org.xml",
8
8
  "/opt/homebrew/share/mime/packages/freedesktop.org.xml",
9
- "/opt/local/share/mime/packages/freedesktop.org.xml",
10
9
  "/usr/share/mime/packages/freedesktop.org.xml"
11
10
  ].compact
12
11
  path = possible_paths.find { |candidate| File.exist?(candidate) }
13
-
12
+
14
13
  return path unless path.nil?
15
- raise(<<-ERROR.gsub(/^ {3}/, ""))
14
+ raise(<<~ERROR)
16
15
  Could not find MIME type database in the following locations: #{possible_paths}
17
-
18
- Ensure you have either installed the shared-mime-info package for your distribution, or
19
- obtain a version of freedesktop.org.xml and set FREEDESKTOP_MIME_TYPES_PATH to the location
16
+
17
+ Ensure you have either installed the shared-mime-types package for your distribution, or
18
+ obtain a version of freedesktop.org.xml and set FREEDESKTOP_MIME_TYPES_PATH to the location
20
19
  of that file.
21
-
22
- This gem might be installed as a dependency of some bigger package, such as rails, activestorage,
23
- axlsx or cucumber. While most of these packages use the functionality of this gem, some gems have
24
- included this gem by accident. Set USE_FREEDESKTOP_PLACEHOLDER=true if you are certain that you
25
- do not need this gem, and wish to skip the inclusion of freedesktop.org.xml.
26
-
27
- The FREEDESKTOP_PLACEHOLDER option is meant as a transitional feature, and will be deprecated in
28
- the next release.
29
20
  ERROR
30
21
  end
31
22
 
32
23
  desc "Build a file pointing at the database"
33
24
  task :default do
34
- mime_database_path = nil
35
- if ENV["USE_FREEDESKTOP_PLACEHOLDER"] == "true"
36
- File.write("../../dummy.xml", "")
37
- mime_database_path = File.expand_path("../../dummy.xml")
38
- else
39
- mime_database_path = locate_mime_database
40
- end
41
-
42
- target_dir = "#{ENV.fetch("RUBYARCHDIR", "../lib")}/mimemagic"
43
- mkdir_p target_dir
44
-
45
- open("#{target_dir}/path.rb", "w") do |f|
46
- f.print(<<~SOURCE
25
+ mime_database_path = locate_mime_database
26
+ open("../../lib/mimemagic/path.rb", "w") do |f|
27
+ f.print(%Q{
47
28
  class MimeMagic
48
29
  DATABASE_PATH="#{mime_database_path}"
49
30
  end
50
- SOURCE
51
- )
31
+ })
52
32
  end
53
- end
33
+ end
@@ -26,16 +26,7 @@ class MimeMagic
26
26
  offset = offset.size == 2 ? offset[0]..offset[1] : offset[0]
27
27
  case type
28
28
  when 'string'
29
- # This *one* pattern match, in the entirety of fd.o's mime types blows up the parser
30
- # because of the escape character \c, so right here we have a hideous hack to
31
- # accommodate that.
32
- if value == '\chapter'
33
- '\chapter'
34
- else
35
- value.gsub!(/\\(x[\dA-Fa-f]{1,2}|0\d{1,3}|\d{1,3}|.)/) {
36
- eval("\"\\#{$1}\"")
37
- }
38
- end
29
+ value.gsub!(/\\(x[\dA-Fa-f]{1,2}|0\d{1,3}|\d{1,3}|.)/) { eval("\"\\#{$1}\"") }
39
30
  when 'big16'
40
31
  value = str2int(value)
41
32
  value = ((value >> 8).chr + (value & 0xFF).chr)
@@ -1,5 +1,5 @@
1
1
  class MimeMagic
2
2
  # MimeMagic version string
3
3
  # @api public
4
- VERSION = '0.3.10'
4
+ VERSION = '0.4.1'
5
5
  end
data/mimemagic.gemspec CHANGED
@@ -15,14 +15,14 @@ Gem::Specification.new do |s|
15
15
  s.extensions = %w(ext/mimemagic/Rakefile)
16
16
 
17
17
  s.summary = 'Fast mime detection by extension or content'
18
- s.description = 'Fast mime detection by extension or content (Uses freedesktop.org.xml shared-mime-info database)'
18
+ s.description = 'Fast mime detection by extension or content in pure ruby (Uses freedesktop.org.xml shared-mime-info database)'
19
19
  s.homepage = 'https://github.com/mimemagicrb/mimemagic'
20
20
  s.license = 'MIT'
21
21
 
22
- s.add_dependency('nokogiri', '~> 1')
23
- s.add_dependency('rake')
22
+ s.add_dependency('nokogiri', '~> 1.11.2')
24
23
 
25
24
  s.add_development_dependency('minitest', '~> 5.14')
25
+ s.add_development_dependency('rake', '~> 13.0')
26
26
 
27
27
  if s.respond_to?(:metadata)
28
28
  s.metadata['changelog_uri'] = "https://github.com/mimemagicrb/mimemagic/blob/master/CHANGELOG.md"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mimemagic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.10
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Mendler
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-03-26 00:00:00.000000000 Z
12
+ date: 2021-03-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri
@@ -17,43 +17,43 @@ dependencies:
17
17
  requirements:
18
18
  - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: '1'
20
+ version: 1.11.2
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: '1'
27
+ version: 1.11.2
28
28
  - !ruby/object:Gem::Dependency
29
- name: rake
29
+ name: minitest
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - ">="
32
+ - - "~>"
33
33
  - !ruby/object:Gem::Version
34
- version: '0'
35
- type: :runtime
34
+ version: '5.14'
35
+ type: :development
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - ">="
39
+ - - "~>"
40
40
  - !ruby/object:Gem::Version
41
- version: '0'
41
+ version: '5.14'
42
42
  - !ruby/object:Gem::Dependency
43
- name: minitest
43
+ name: rake
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
46
  - - "~>"
47
47
  - !ruby/object:Gem::Version
48
- version: '5.14'
48
+ version: '13.0'
49
49
  type: :development
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
53
  - - "~>"
54
54
  - !ruby/object:Gem::Version
55
- version: '5.14'
56
- description: Fast mime detection by extension or content (Uses freedesktop.org.xml
55
+ version: '13.0'
56
+ description: Fast mime detection by extension or content in pure ruby (Uses freedesktop.org.xml
57
57
  shared-mime-info database)
58
58
  email:
59
59
  - mail@daniel-mendler.de
@@ -73,7 +73,6 @@ files:
73
73
  - Rakefile
74
74
  - ext/mimemagic/Rakefile
75
75
  - lib/mimemagic.rb
76
- - lib/mimemagic/overlay.rb
77
76
  - lib/mimemagic/tables.rb
78
77
  - lib/mimemagic/version.rb
79
78
  - mimemagic.gemspec
@@ -1,8 +0,0 @@
1
- # frozen_string_literal: true
2
- # Extra magic
3
-
4
- [['application/vnd.openxmlformats-officedocument.presentationml.presentation', [[0, "PK\003\004", [[0..5000, '[Content_Types].xml', [[0..5000, 'ppt/']]]]]]],
5
- ['application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', [[0, "PK\003\004", [[0..5000, '[Content_Types].xml', [[0..5000, 'xl/']]]]]]],
6
- ['application/vnd.openxmlformats-officedocument.wordprocessingml.document', [[0, "PK\003\004", [[0..5000, '[Content_Types].xml', [[0..5000, 'word/']]]]]]]].each do |magic|
7
- MimeMagic.add(magic[0], magic: magic[1])
8
- end