Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mimemagic
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ikcrm_common
mimemagic
Commits
9140f64e
Commit
9140f64e
authored
Mar 24, 2021
by
Jon Wood
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove the C extension, using a Rakefile also works
parent
f007b382
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
18 deletions
+16
-18
ext/mimemagic/Rakefile
+14
-6
ext/mimemagic/mimemagic.c
+0
-10
lib/mimemagic/tables.rb
+1
-1
mimemagic.gemspec
+1
-1
No files found.
ext/mimemagic/
extconf.rb
→
ext/mimemagic/
Rakefile
View file @
9140f64e
require
"mkmf"
require
"rubygems"
require
"rake/clean"
def
locate_mime_database
# User provided path.
...
...
@@ -16,7 +17,14 @@ def locate_mime_database
raise
"No database of MIME types could be found. Ensure you have either installed the shared-mime-types package for your distribution, or obtain a version of freedesktop.org.xml, and set FREEDESKTOP_MIME_TYPES_PATH to the location of that file."
end
mime_database_path
=
locate_mime_database
$defs
.
push
(
"-DMIMEDB_PATH=
\\\"
#{
mime_database_path
}
\\\"
"
)
create_header
create_makefile
(
"mimemagic/mimemagic"
)
\ No newline at end of file
desc
"Build a file pointing at the database"
task
:default
do
mime_database_path
=
locate_mime_database
open
(
"../../lib/mimemagic/path.rb"
,
"w"
)
do
|
f
|
f
.
print
(
%Q{
module MimeMagic
DATABASE_PATH="
#{
mime_database_path
}
"
end
}
)
end
end
\ No newline at end of file
ext/mimemagic/mimemagic.c
deleted
100644 → 0
View file @
f007b382
#include <ruby.h>
#include "extconf.h"
void
Init_mimemagic
(
void
)
{
VALUE
cMimeMagic
;
cMimeMagic
=
rb_const_get
(
rb_cObject
,
rb_intern
(
"MimeMagic"
));
rb_define_const
(
cMimeMagic
,
"DATABASE_PATH"
,
rb_str_new
(
MIMEDB_PATH
,
strlen
(
MIMEDB_PATH
)));
}
lib/mimemagic/tables.rb
View file @
9140f64e
...
...
@@ -2,6 +2,7 @@
# frozen_string_literal: true
# Generated from script/freedesktop.org.xml
require
'nokogiri'
require
'mimemagic/path'
class
MimeMagic
EXTENSIONS
=
{}
...
...
@@ -55,7 +56,6 @@ class MimeMagic
end
def
self
.
open_mime_database
require
"mimemagic/mimemagic"
path
=
MimeMagic
::
DATABASE_PATH
File
.
open
(
path
)
end
...
...
mimemagic.gemspec
View file @
9140f64e
...
...
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
s
.
files
=
`git ls-files`
.
split
(
"
\n
"
).
reject
{
|
f
|
f
.
match
(
%r{^(test|script)/}
)
}
s
.
require_paths
=
%w(lib)
s
.
extensions
=
%w(ext/mimemagic/
extconf.rb
)
s
.
extensions
=
%w(ext/mimemagic/
Rakefile
)
s
.
summary
=
'Fast mime detection by extension or content'
s
.
description
=
'Fast mime detection by extension or content in pure ruby (Uses freedesktop.org.xml shared-mime-info database)'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment