Newer version of fog which requires multi_json gem don't work on if a user uses an older version of RubyGem, because multi_json requires a newer version (>= 1.3.6). Good example of this is Ubuntu 10.04 where the latest RubyGem version available in the official APT repo is 1.3.5.
My solution is probably not the best and the final one, but I just want to start the discussion so we can figure out a best solution for this together.
Remove multi_json dependency.
Use 'multi_json' if available, otherwise fail back to 'json' gem.
@geemus Have you gotten any other reports of this? This seems like it would be super problematic.
@bradgignac - no, don't think I've heard about this particular one before.
@Kami - I think a slightly older version of multi_json might not require the newer rubygems (as a workaround for the time being). That said, seems like a better generic solution is worth doing. I've never much liked multi_json as a part of the setup, but it was requested by multiple parties. Maybe something like it (but with less crazy requirements) is worth doing.
@geemus I already checked that and sadly all of the multi_json versions besides the really first one (0.0.2) require RubyGem >= 1.3.6.
@geemus ^^ any other ideas?
@Kami - can you update rubygems directly? ie gem update --system should update the rubygems, even if it doesn't appear on apt. Otherwise we can probably do some kind of conditional thing as you did, but it complicates the code a good deal.
gem update --system
@geemus We use system (apt) version of rubygems so sadly upgrading using gem update --system is not an option.
Should the fog gemspec be updated to indicate it won't work with versions lower than 1.3.6?
@bradgignac I don't thing that's the right solution / doesn't change anything since the dependency already declares that.
@bradgignac, @geemus Any other suggestions?
@Kami - I was never that keen on multi_json in the first place :(, but it was requested a lot. I think something like your fix should be what we do, but I would consolidate a bit. Namely I'd like to see it a bit more like this:
Will that work for you? I would prefer to leave multi_json in the dependencies if possible, but does that fail right away for you? Since older Rubies do not include json in stdlib it would have to be installed/required, so I don't want to end up with something that only works if you have the additional knowledge to install one of either multi_json or json. Make sense?
@geemus Yeah, sounds good. I will update the patch with the approach you suggested later today. Thanks.
@Kami - thanks, and sorry for the delay. None of the approaches seemed awesome but I did want to address it, so it seems I maybe dragged my feet a bit. Hopefully we can get it sorted out now pretty quickly though.
The 'json' lib is now shipped with JRuby and MRI (probably rbx, too, but I don't have an install to check). Maybe removing multi_json is the way to go.
@nirvdrum - perhaps. I think we may be stuck with it for now though (for the sake of earlier MRI versions).
Ahh, good point.
@nirvdrum - yeah, old MRIs are a thorn in our collective side... Seems like there are enough random reasons why some people can't or won't upgrade that we can't really start cutting support though (at least last time I checked). Hopefully this will change in time.
I actually like that fog is willing to support its user base. I was being a bit short-sighted is all. At the time I was thinking that "json" won the war and is a sensible default, but I don't know how well "json" supports older rubies.
@nirvdrum - yeah, it is unfortunately pretty complicated. Partly it also has to do with performance (for some users) as a number of the non-json libraries are quite a bit faster.
If at all possible, I would like to resolve this issue so I can get rackspace-fog removed from gemcutter.
@geemus @Kami Are the comments in this thread still valid?
If they are, I would like to update the gemspec to require json and then update Fog::JSON to attempt to load and use multi_json first before falling back to JSON. Or are we past a point where the json gem would be an expectable solution?
@Kami Do you have a timeline for moving off Ubuntu 10.04?
@krames - To the best of my knowledge multi_json still wouldn't work with old rubygems and json isn't necessarily just available on older MRI. Additionally a lot of people may want to use something other than json as json is not the most performant of options here. json in the gemspec is probably ok, ditto the fallback.
@krames - could you explain how this relates to removing rackspace-fog?
@geemus Sorry!i forgot to mention that. A gem called rackspace-fog is a fork of fog that was created that replaces multijson with the json parser.
@krames This problem is not unique to us (Rackspace). Everyone who uses Ubuntu 10.04 which comes with an older version of RubyGem will encounter this problem.
@Kami - got it, no worries. Just didn't realize that was the outcome of this stuff.
I have created pull request #1730 to address this issue using the latest master.
Can everyone give me your opinions?
I'm closing this one in favor of #1730.
I wish someone had pinged me about this. I’d have looked into releasing a version of multi_json with a looser required_rubygems_version. Is this still an issue for Ubuntu 10.04?
@sferik - sorry about that. At the time we basically just sought to address the problem in the quickest/easiest way, but we should have reviewed and remediated after the fact instead of just letting it slide. If we could put together a multi_json that works with other rubygems (and therefore this old ubuntu) that would be great. Thanks!
@Kami If you need to get a more recent version of rubygems for Ubuntu, I highly recommend to check out Brightbox's Ruby NG PPA. PPAs are 3rd party repositories that can be used by apt-get. I've been using Ruby NG for quite sometime now and it was much easier to use than RVM imho in order to get a recent Ruby stack.
See more details on blog post or PPA on Launchpad.
In a nutshell, all you need to do is this:
sudo apt-add-repository ppa:brightbox/ruby-ng
sudo apt-get update
sudo apt-get install ruby rubygems ruby-switch ruby1.9.1
Would that be helpful to resolve your problem?