# Major FreeBSD flaw: ruby gems should not be ported



## BeastieBoy (Jun 30, 2010)

Hi,

I use Ruby on Rails, and on FreeBSD I see that there is a devel/ruby-gems port and rubygem-* ports. I think it's wrong, rubygems and gems belong to Ruby and shouldn't be handled by freebsd's port system. Moreover Nginx requires ruby-gems and rubygem-rake, installing from scratch rubygems (aka: the real way described at rubygems.org) won't get detected by Nginx as it looks if the port was installed or not.

There is also a rubygem-rails port. Currently it's in version 2.3.8 which is the current released version, great, but there are other important gems that are not ported or a bit old. Paperclip is one of them.

Installing gem ports is also painful. Rake's port is under devel/rubygem-rake whereas rdiscount is under textproc/rubygem-rdiscount.

Moreover, this means that I'll be mixing gem ports and pure gems, I don't like that. And if I mistakenly update gems through rubygems, this means the port will be unsync with the installed gem, and obviously I won't be able to uninstall it either (I tested it).

How do ruby and rails users handle this major issue?


----------



## BeastieBoy (Jul 1, 2010)

One solution I see, is to install Nginx+Passenger using the original install, i.e: bypass freebsd port, so that it doesn't require the ruby-gems port, so that it can be installed internally by Ruby.


----------



## BeastieBoy (Jul 5, 2010)

Glad to see nobody cares or uses RoR on FreeBSD...


----------



## phoenix (Jul 5, 2010)

Posting to the freebsd-ports mailing list would be more appropriate.  This is an end-users help forum (user-to-user).  A few devs hang out here, but you'd get better response to developer issues like this on the mailing lists.


----------



## DutchDaemon (Jul 6, 2010)

Also note that ports are third-party applications, and as such not a part of FreeBSD. You need to contact the port maintainer or (indeed) the ports mailing list.


----------



## BeastieBoy (Jul 6, 2010)

My bad. I'll post the issue to the aforementioned mailing-list. I'll keep you updated on what they think about it.


----------



## dotemacs (Jul 8, 2010)

Hello BeastyBoy,

you bring up an interesting question.

"Moreover, this means that I'll be mixing gem ports and pure gems, I don't like that. And if I mistakenly update gems through rubygems, this means the port will be unsync with the installed gem, and obviously I won't be able to uninstall it either (I tested it)."

Various versions of a same gem can co-exist so just keep the ones that are required by the ports and install the additional ones that you need. Sure it might look ugly, but it will work. 

I guess this is the same situation with CPAN modules, where some are installed by the ports and the others can be installed manually that are not in the ports.

I believe that Debian and therefore Ubuntu, tried to have their own way of handling the ruby gems and instead just has its own messy system packaging system (for gems), which nobody using ruby likes and stays away from. That is my experience. I'd be glad to hear other rubyists opinions.

Thanks


----------



## bsd10 (Jul 8, 2010)

BeastieBoy said:
			
		

> Moreover, this means that I'll be mixing gem ports and pure gems, I don't like that. And if I mistakenly update gems through rubygems, this means the port will be unsync with the installed gem, and obviously I won't be able to uninstall it either (I tested it).
> 
> How do ruby and rails users handle this major issue?



You can install everything manually, but using the gem ports makes installing and updating ported apps very easy.

I run a Rails app in a production environment, and I have gems from ports that are dependencies, but I also installed some separate gems manually without any problems.


----------



## BeastieBoy (Jul 8, 2010)

@dotemacs: rubygems messy? uh? I haven't run into any problem for 3 years.

The problem of mixing gems and ports, is that let's say I install Nginx from ports. It requires gem-rake, so it installs it. Now I also need paperclip which doesn't exist as a port, so I install it manuall with "gem install paperclip". Time passes, and I decide to update my gems, so I hit "gem update", therefore the rake gem gets updated, but the port still thinks it's at a previous version, and gets confused.

I guess that a ported gem when update through "gem update" should skip the update and display a message like "beware this gem is installed by port, use freebsd port manager to update the port".


----------



## dotemacs (Jul 8, 2010)

Hello,



			
				BeastieBoy said:
			
		

> @dotemacs: rubygems messy? uh? I haven't run into any problem for 3 years.



If you read my post again you'll see that I'm referring to the way Debian/Ubuntu packages its gems. That is messy.



			
				BeastieBoy said:
			
		

> The problem of mixing gems and ports, is that let's say I install Nginx from ports. It requires gem-rake, so it installs it. Now I also need paperclip which doesn't exist as a port, so I install it manuall with "gem install paperclip". Time passes, and I decide to update my gems, so I hit "gem update", therefore the rake gem gets updated, but the port still thinks it's at a previous version, and gets confused.



But what is stopping you from having multiple gem versions of one port on the system? They can co-exist and you can use whatever it is that you need.



			
				BeastieBoy said:
			
		

> I guess that a ported gem when update through "gem update" should skip the update and display a message like "beware this gem is installed by port, use freebsd port manager to update the port".



I guess if this were to be done, then rubygems would need to be aware of the FreeBSD's ports system.


----------



## BeastieBoy (Jul 8, 2010)

No you can't have multiple gems that way. If Nginx install gem-rake let's say 1.6 (random number), now in rubygems I update all gems: "gem update" and rake has an update available 1.7. So now I have 1.6 and 1.7 installed, then I update the ports, so rake 1.6 gets updated to 1.6.3.

So now rubygems sees 1.6 and 1.7 but in reality it's 1.6.3 and 1.7. Cleaning up gems doesn't work either, because then it would erase gem 1.6 (bound to port 1.6.3), and now gem-rake port has lost its files.


----------



## bsd10 (Jul 8, 2010)

BeastieBoy said:
			
		

> No you can't have multiple gems that way. If Nginx install gem-rake let's say 1.6 (random number), now in rubygems I update all gems: "gem update" and rake has an update available 1.7. So now I have 1.6 and 1.7 installed, then I update the ports, so rake 1.6 gets updated to 1.6.3.
> 
> So now rubygems sees 1.6 and 1.7 but in reality it's 1.6.3 and 1.7. Cleaning up gems doesn't work either, because then it would erase gem 1.6 (bound to port 1.6.3), and now gem-rake port has lost its files.



How does "gem update" save you from dependency version issues? Until Ruby has something like Maven that let's you define specific dependencies for each project, you will have issues with dependency versions if you install them manually. The ports approach actually solves the problem, but only for ported apps.


----------



## BeastieBoy (Jul 9, 2010)

Until now none of my gems has gone into dependency problems, things get fixed so quickly I don't have time to run into major problems. From time to time one gem gives troubles (and I immediately spot it), so simply reinstalling an older version until the new one gets fixed solves the problem, and that occurs very rarely.


----------

