Skip to content

Commit

Permalink
Replace mimemagic with mini_magic
Browse files Browse the repository at this point in the history
  • Loading branch information
gabifija committed May 5, 2021
1 parent 9660dea commit 58b9e9e
Show file tree
Hide file tree
Showing 8 changed files with 498 additions and 514 deletions.
3 changes: 0 additions & 3 deletions .travis.yml
Expand Up @@ -9,9 +9,6 @@ rvm:
before_install:
- gem uninstall -v '>= 2' -i $(rvm gemdir)@global -ax bundler || true
- gem install bundler -v '< 2'
- sudo apt-get update -y
- sudo apt-get install -y shared-mime-info
- mkdir -p ./usr/share/mime/packages && cp -a /usr/share/mime/packages/freedesktop.org.xml ./usr/share/mime/packages/

after_success:
- coveralls
13 changes: 0 additions & 13 deletions README.md
Expand Up @@ -37,19 +37,6 @@ Or install it yourself as:

$ gem install filestack

## Dependencies

We use the gem `mimemagic` which requires a copy of the Freedesktop.org shared-mime-info database.

macOS users can install the database via Homebrew with `brew install shared-mime-info`.

If you are unable to use a package manager, you can obtain a copy of the needed file by extracting it from the Debian package. This process will also work on a Windows machine.

1. Download the package from https://packages.debian.org/sid/amd64/shared-mime-info/download
2. Ensure the command line version of 7-Zip is installed
3. `7z x -so shared-mime-info_2.0-1_amd64.deb data.tar | 7z e -sidata.tar "./usr/share/mime/packages/freedesktop.org.xml"`
4. Place the file `freedesktop.org.xml` in an appropriate location, and then set the environment variable `FREEDESKTOP_MIME_TYPES_PATH` to that path. Once that has been done the gem should install successfully. Please note that the gem will depend upon the file remaining in that location at run time.

## Usage

### Import
Expand Down
2 changes: 1 addition & 1 deletion docs/FilestackCommon.html
Expand Up @@ -730,7 +730,7 @@ <h3 class="signature " id="send_overwrite-instance_method">
<span class='kw'>return</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>Overwrite requires security</span><span class='tstring_end'>&#39;</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_security'>security</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>

<span class='id identifier rubyid_file'>file</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_open'>open</span><span class='lparen'>(</span><span class='id identifier rubyid_filepath'>filepath</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>r</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
<span class='id identifier rubyid_mimetype'>mimetype</span> <span class='op'>=</span> <span class='const'>MimeMagic</span><span class='period'>.</span><span class='id identifier rubyid_by_magic'>by_magic</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='rparen'>)</span>
<span class='id identifier rubyid_mimetype'>mimetype</span> <span class='op'>=</span> <span class='const'>MiniMime</span><span class='period'>.</span><span class='id identifier rubyid_lookup_by_filename'>lookup_by_filename</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_content_type'>content_type</span>
<span class='id identifier rubyid_content'>content</span> <span class='op'>=</span> <span class='id identifier rubyid_file'>file</span><span class='period'>.</span><span class='id identifier rubyid_read'>read</span>

<span class='id identifier rubyid_signature'>signature</span> <span class='op'>=</span> <span class='id identifier rubyid_security'>security</span><span class='period'>.</span><span class='id identifier rubyid_signature'>signature</span>
Expand Down

0 comments on commit 58b9e9e

Please sign in to comment.