Can no longer bundle install all of my applications on Rails that require Paperclip due to MimeMagic gem no longer existing?

Viewed 649

I had a program that worked a few weeks ago and I wiped it out and had to re-install my ruby and rails enviornment and now I can not bundle install the same program because Paperclip requires Mimemagic and apparently the working versions of the gems no longer exist. Any versions of the gem that remain require this freedesktop.org.xml thing which I went to their site and downloaded but I do not understand on a windows machine how to install the freedesktop.org.xml package so that I can use Ruby on Rails again.

Does anyone know how to install the freedesktop.org.xml package/script/whatever it is so that rails will work properly again? If ANY of our apps break now we are going to be a HORRIBLE place due to this. I have been searching for hours and everything references a MAC or Linux, I am on a PC and I can find NOPLACE that has understandable instructions for how to do this on a Windows 10 PC.

Please HELP!

Thank You, Scott

Update: I tried the suggestion to add:

gem 'mimemagic', git: 'git@github.com:mimemagicrb/mimemagic.git', tag: "v#{[0.3.0]}"

into the gemfile and this is the results I get.

[!] There was an error parsing `Gemfile`: unexpected fraction part after numeric literal - . Bundler cannot continue.

 #  from D:/rails/ctrlpanel/Gemfile:22
 #  -------------------------------------------
 #  # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
 >  gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
 #  source 'https://rubygems.org'
 #  -------------------------------------------

I don't understand what this means? I also don't understand this entire issue? Is there no way that the freedesktop.org.xml thing can be installed on a Windows PC? This seems like this officially kills Ruby on Rails on a Windows PC?

2 Answers

The old versions of mimemagic were, annoyingly, hard-deleted from rubygems.org because the author became aware that the library was incorrectly licensed as MIT rather than GPLv2.

More recent versions (v0.3.7+) of the library are correctly licensed as MIT.

I tried the suggestion to add:

gem 'mimemagic', git: 'git@github.com:mimemagicrb/mimemagic.git', tag: "v#{[0.3.0]}"

That won't work on two accounts: Firstly you misunderstood the proposition - just writing tag: 'v0.3.0' was all that's needed, but additionally, it appears the mimemagic author has also tried to cover their backs (legally) by untagging the old library versions in github!!!

...But mimemagic still has full source control! So if you want to explicitly install an old version, it's still pretty easy to pin it directly to a git commit!!

For example, look here at the project history.

If you want to install version 0.3.5 of the gem, you can add this to your Gemfile:

gem 'mimemagic', git: 'https://github.com/mimemagicrb/mimemagic', ref: '01f92d86d15d85cfd0f20dabd025dcbd36a8a60f'

It should be pretty easy to find the reference commit for other versions, using the above link to the project's history.

However as noted above, old versions of this project were incorrectly licensed as MIT. If you are unable to include a GPLv2 licensed library in your project (I am not a lawyer, and this is not legal advice...), you should not be using this approach.

For more information on how to specify git branches/tags/commits in a Gemfile, see the documentation: https://bundler.io/guides/git.html

This issue can be solved by setting FREEDESKTOP_MIME_TYPES_PATH to point to freedesktop.org.xml before installing the gem or running Bundler.

Example:

Step 1:
Right click and save this file as freedesktop.org.xml to C:\.

Step 2:
Set FREEDESKTOP_MIME_TYPES_PATH in the current command prompt (not permanently stored):

> set FREEDESKTOP_MIME_TYPES_PATH=C:\freedesktop.org.xml

Step 3:
Install the gem (or run bundle install) from the same prompt as in step 2:

> gem install mimemagic
Temporarily enhancing PATH for MSYS/MINGW...
Building native extensions. This could take a while...
Successfully installed mimemagic-0.4.3
1 gem installed
Related