11

I am trying to upgrade a gem (hydra-derivatives) to version 3.3.2 to see if it solves a bug we are having.

hydra-derivatives is not a Gemfile gem; it's bundled as a dependency of another gem, called hydra-works.

What I've Tried

  1. bundle update --conservative hydra-derivatives but that only upgraded hydra-derivatives to 3.2.2 (& we want 3.3.2) and its dependency mini_magick from 4.5.1 to 4.8.0
  2. adding gem 'hydra-derivatives', '~> 3.3.2' but that gave me:

    You have requested:
      hydra-derivatives ~> 3.3.2
    
    The bundle currently has hydra-derivatives locked at 3.2.1.
    Try running `bundle update hydra-derivatives`
    
    If you are updating multiple gems in your Gemfile at once,
    try passing them all to `bundle update`
    
  3. I don't want to run bundle update hydra-derivatives because I don't want it to update a bunch of unnecessary gems and cause problems, hence why I read about --conservative

    a. I ran this anyway to test it, and it upgraded target gem to only 3.2.2 and 15 gems in total!

RudyOnRails
  • 1,819
  • 3
  • 17
  • 26
  • Did you look at this https://stackoverflow.com/questions/7434263/can-i-force-a-gems-dependencies-in-gemfile ? – Preston Oct 11 '17 at 22:35
  • @Preston no I didn't come across that one. I'll study it now and see if it helps, then report back here. – RudyOnRails Oct 11 '17 at 22:43
  • @Preston thanks for giving me more info! Unfortunately, I just think that answer is what I did here in "try #2" above. "You'll need to explicitly specify the B gem in your Gemfile to use a git repository or another version. " – RudyOnRails Oct 11 '17 at 23:11
  • @Preston it does make me think though. The parent gem of hydra-derivatives, hydra-works, lists a pessimistic version of ~> 3.0, so that means anything up to 4.0. Weird, since it says it's locked at 3.2.1. – RudyOnRails Oct 11 '17 at 23:14
  • Try forking the hydra-works gem and setting the dependencies yourself – Preston Oct 11 '17 at 23:23
  • @Preson that's what I was thinking of doing, but look at what they have it set at already: https://github.com/samvera/hydra-works/blob/master/hydra-works.gemspec#L23 It should be able to go up to < 4.0. – RudyOnRails Oct 11 '17 at 23:25

2 Answers2

3

hydra-derivatives is not a Gemfile gem; it's bundled as a dependency of another gem, called hydra-works.

You can still add this as an explicit dependency in your Gemfile:

  # only restrict the version if you know of an incompatibility
  gem 'hydra-derivatives' , '~> 3.3'

then run

  bundle update hydra-derivatives --conservative

or

  bundle update hydra-works --conservative

adding the option --conservative to the bundle update command, makes sure that you don't update any other unrelated gems. This helps keeping the changes focused and manageable.

Tilo
  • 33,354
  • 5
  • 79
  • 106
-1

Remove the hydra-works gem from your Gemfile. Either remove the gem and its dependencies by hand from the installed gem location or if you have the application in its own Ruby environment using rbenv or rvm run bundle clean --force.
Beware bundle clean --force will remove all of the gems in the Ruby version other than those specified in your Gemfile. If you have other applications that use the same version of Ruby you'll have to reinstall the gems for that application if they are different than what you are using in this application.

Add this to your Gemfile

gem 'hydra-derivatives', '~> 3.3.2'
gem 'hydra-works'

And run bundle install

You should see the correct dependency version now in your Gemfile.lock

Preston
  • 163
  • 1
  • 8
  • Got switched to a different priority. Will return to this and give it the attention it deserves. Currently writing some tests to see why the hell the bug popped up instead of just assuming upgrading the gem is the solution! – RudyOnRails Oct 12 '17 at 22:13
  • after some experimenting and fact checking, I can confirm that the latest version of hydra-derivatives 3.3.2 ends up depending on faraday (~> 0.12.1), however another gem depends on faraday (~> 0.9.0). So this is my problem! I am going to experiment with forking iiif-presentation (~> 0.1.0) and bumping gemspec for faraday up to faraday (~> 0.12.1). Sorry for the waste of time, I wish I knew more going into this! – RudyOnRails Oct 16 '17 at 20:23
  • Temporarily adding indirect dependency (`json`) and running `bundle update json` worked for me. – x-yuri Mar 26 '19 at 01:12