blackwinter / ruby-filemagic

Ruby bindings to the magic(4) library, revised.
https://blackwinter.github.iom/ruby-filemagic
146 stars 34 forks source link

Put the runtime dependencies in the gemspec #28

Closed ghost closed 6 years ago

ghost commented 6 years ago

Using ruby-filemagic I will have to inform all my users, that they have to install a Rails-version prior 5.x and all the stuff that follows.

  1. PSE use the existing Ruby magic to do it for me.
  2. Make your gem compatible with later Rails-versions.
  3. There must be more and I do have seen it all. If the runtime-dependencies do not suffice to create a valid environment, PSE document it somewhere on your Web-site. I am giving up for now, as I am losing my time.
blackwinter commented 6 years ago

This gem doesn't have any runtime dependencies. Please give more details as to what kind of issues you are observing.

ghost commented 6 years ago

Good afternoon

and thank you for your swift reaction.

On Sat, Sep 09, 2017 at 10:42:41AM +0000, Jens Wille wrote:

This gem doesn't have any runtime dependencies. Please give more details as to what kind of issues you are observing.

Here is a function that I currently do not use:

require 'filemagic'

find the file-type for a given file name

def file_type(file) fm = FileMagic.fm file_magic = fm.file(file) fm.flags = [:mime_type] file_mime = fm.file(file) return file_magic, file_mime end

Calling the function with the name of an existing file gives me the following output:


Traceback (most recent call last): 11: from ../bin/html2index:24:in <main>' 10: from ../bin/html2index:24:inrequire_relative' 9: from /home/michael/prog/html2index/lib/html2index.rb:33:in <top (required)>' 8: from /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:39:inrequire' 7: from /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:131:in rescue in require' 6: from /usr/lib/ruby/2.5.0/rubygems.rb:213:intry_activate' 5: from /usr/lib/ruby/2.5.0/rubygems.rb:220:in rescue in try_activate' 4: from /usr/lib/ruby/2.5.0/rubygems/specification.rb:1416:inactivate' 3: from /usr/lib/ruby/2.5.0/rubygems/specification.rb:1434:in activate_dependencies' 2: from /usr/lib/ruby/2.5.0/rubygems/specification.rb:1434:ineach' 1: from /usr/lib/ruby/2.5.0/rubygems/specification.rb:1445:in block in activate_dependencies' /usr/lib/ruby/2.5.0/rubygems/dependency.rb:308:into_specs': Could not find 'rails' (< 5, >= 4.2.0) among 120 total gem(s) (Gem::MissingSpecError) Checked in 'GEM_PATH=/home/michael/.gem/ruby/2.5.0:/var/lib/gems/2.5.0:/usr/lib/x86_64-linux/rubygems-integration/2.5.0:/usr/share/rubygems-integration/2.5.0:/usr/share/rubygems-integration/all', execute gem env for more information

Installing rails and even with the latest 4.x version, gets me to the next error:


Traceback (most recent call last): 11: from ../bin/html2index:24:in <main>' 10: from ../bin/html2index:24:inrequire_relative' 9: from /home/michael/prog/html2index/lib/html2index.rb:33:in <top (required)>' 8: from /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:39:inrequire' 7: from /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:131:in rescue in require' 6: from /usr/lib/ruby/2.5.0/rubygems.rb:213:intry_activate' 5: from /usr/lib/ruby/2.5.0/rubygems.rb:220:in rescue in try_activate' 4: from /usr/lib/ruby/2.5.0/rubygems/specification.rb:1416:inactivate' 3: from /usr/lib/ruby/2.5.0/rubygems/specification.rb:1434:in activate_dependencies' 2: from /usr/lib/ruby/2.5.0/rubygems/specification.rb:1434:ineach' 1: from /usr/lib/ruby/2.5.0/rubygems/specification.rb:1445:in block in activate_dependencies' /usr/lib/ruby/2.5.0/rubygems/dependency.rb:308:into_specs': Could not find 'refile-mini_magick' (~> 0.2.0) among 121 total gem(s) (Gem::MissingSpecError) Checked in 'GEM_PATH=/home/michael/.gem/ruby/2.5.0:/var/lib/gems/2.5.0:/usr/lib/x86_64-linux/rubygems-integration/2.5.0:/usr/share/rubygems-integration/2.5.0:/usr/share/rubygems-integration/all', execute gem env for more information

So, now it is refile-mini_magick.

Anyway, I do not want to communicate all these dependencies to the user of my programs, if I could be done with one single gem, else I have to check back each time, if my list is still accurate!

If you have another hint for me...

For the time being I call popen(['file', filename]).read(), which works on Linux.

TIA,

Michael

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.*

-- J'accepte des messages PRIVÉS seulement signés ou chiffrés (content-type multipart/signed ou /encrypted obligatoires). Messages PUBLIQUES sont exempts de cette règle (listes etc.).
GnuPG brainpoolP512r1/5C2A258D 2015-10-02 [expires: 2017-10-01]

blackwinter commented 6 years ago

Anyway, I do not want to communicate all these dependencies to the user of my programs, if I could be done with one single gem, else I have to check back each time, if my list is still accurate!

First of all, this has nothing to do with ruby-filemagic. But if you're creating a program that depends on other gems, there's no way around specifying those dependencies somewhere. The most straightforward way would probably be to package your program itself as a gem and specify your dependencies in your gemspec.