30 Days of Tech: Day 25 - Gem dependency version
June 25th, 2008
RubyGems and I had a fight. It was about what version of net-ssh we wanted to have installed on my machine. RubyGems wanted the latest (2.0.2) and I wanted a 1.x version (1.1.4). Apparently net-ssh 2 has an issue with sshing into Fedora Core 4, which I needed it to do. Specifically I needed to use capistrano 1.4.1 to deploy an app to Fedora Core 4
This is something I’ve been doing regularly for some time, but ever since the MacBrick incident I haven’t needed these specific gems installed, so I was starting from scratch. Once I figured out what version of the gems I wanted, here was my first attempt:
(I included --no-rdoc and --no-ri just to save time writing this post).
$ sudo gem install net-ssh --version=1.1.4 --no-rdoc --no-ri
Bulk updating Gem source index for: http://gems.rubyforge.org/
Successfully installed net-ssh-1.1.4
1 gem installed
$ sudo gem install capistrano --version=1.4.1 --no-rdoc --no-ri
Bulk updating Gem source index for: http://gems.rubyforge.org/
Successfully installed net-ssh-2.0.2
Successfully installed net-sftp-2.0.1
Successfully installed capistrano-1.4.1
3 gems installed
Clearly this didn’t work so well. Installing capistrano installed the latest version of net-ssh. But why? Capistrano’s gemspec for 1.4.1 says this
...
s.add_dependency(%q<net-ssh>, [">= 1.0.10"])
s.add_dependency(%q<net-sftp>, [">= 1.1.0"])
...
But net-sftp 2.0.1’s gemspec says it needs net-ssh 1.99.1. So we need to install specific version of both. So, attempt number two.
$ sudo gem install net-ssh --version=1.1.4 --no-rdoc --no-ri
Bulk updating Gem source index for: http://gems.rubyforge.org/
Successfully installed net-ssh-1.1.4
1 gem installed
$ sudo gem install net-sftp --version=1.1.0 --no-rdoc --no-ri
Bulk updating Gem source index for: http://gems.rubyforge.org/
Successfully installed net-ssh-2.0.2
Successfully installed net-sftp-1.1.0
2 gems installed
Rats. Even though net-sftp 1.1.0 only specifies that it depends on net-ssh >= 1.0.0, RubyGems went ahead and installed the latest version anyway. It assumed that even though the dependency was satisfied, I want the latest version of net-ssh— exactly what I’m trying to avoid.
Armed with this information, I made one last ditch attempt.
$ sudo gem install capistrano --version=1.4.1 --no-rdoc --no-ri
Bulk updating Gem source index for: http://gems.rubyforge.org/
Successfully installed net-ssh-2.0.2
Successfully installed net-sftp-2.0.1
Successfully installed capistrano-1.4.1
3 gems installed
$ sudo gem install net-ssh --version=1.1.4 --no-rdoc --no-ri
Bulk updating Gem source index for: http://gems.rubyforge.org/
Successfully installed net-ssh-1.1.4
1 gem installed
$ sudo gem install net-sftp --version=1.1.0 --no-rdoc --no-ri
Bulk updating Gem source index for: http://gems.rubyforge.org/
Successfully installed net-sftp-1.1.0
1 gem installed
$ sudo gem uninstall net-sftp net-ssh
Select gem to uninstall:
1. net-sftp-1.1.0
2. net-sftp-2.0.1
3. All versions
> 2
Successfully uninstalled net-sftp-2.0.1
Select gem to uninstall:
1. net-ssh-1.1.4
2. net-ssh-2.0.2
3. All versions
> 2
Successfully uninstalled net-ssh-2.0.2
Finally, by letting RubyGems install the latest version of net-ssh and net-sftp, then installing the versions I wanted, and the uninstalling the offending versions, I was able to get into a working state to deploy. Hopefully I’ll never run into this problem again. If you should be so unlucky, however, I hope this knowledge will help you.
1 Response to “30 Days of Tech: Day 25 - Gem dependency version”
Sorry, comments are closed for this article.
July 25th, 2008 at 09:20 PM http://1991hondapreludesiparts.bloghi.com http://1991hondarepairmanual.bloghi.com http://1991hondapreludesispec.bloghi.com http://1991hondapreludesrparts.bloghi.com http://1991hondapreludesi4ws.bloghi.com http://1991hondapreludeoptions.bloghi.com http://1991hondapreludesibodykit.bloghi.com http://1991hondapreludepictures.bloghi.com http://1991hondarebeel900.bloghi.com http://1991hondapreludeperformanceparts.bloghi.com http://1991hondapreludetestdrive.bloghi.com http://1991hondapreludeparts.bloghi.com http://1991hondapreludespecifications.bloghi.com http://1991hondapreludesiguage.bloghi.com http://1991hondapreludesih22.bloghi.com http://1991hondapreludesrcartroubles.bloghi.com http://1991hondapreludepic.bloghi.com http://1991hondapreludephoto.bloghi.com http://1991hondapreludesalecanada.bloghi.com http://1991hondapreludesrparts.bloghi.com