From: Jeremy Bopp Date: 2012-02-07T02:41:27+09:00 Subject: Re: ruby executable on ubuntu On 02/06/2012 09:59 AM, Adam Ms. wrote: > mark kirby wrote in post #1043353: >> Hi >> I just wonderd if you guys know any way to execute a .rb file by >> clicking on it. > >> >> ;-) THANKS > > Add a ruby shebang and chmod +x This may not be the best possible solution unless you can safely rely on the packaged Ruby versions included with Ubuntu. Given that there are so many recommendations to install Ruby with RVM, especially on distributions such as Ubuntu, adding a simple shebang line could be problematic if you have more than a handful of files to run this way. The problem is that if you change the Ruby you want to use later with a new installation from RVM, you'll have to update all those files to point to the new installation in their shebang lines. However, if you use the .desktop file approach, you only need to modify the single .desktop file. The .desktop approach has its own pitfalls, of course. One I can think of off the top of my head is that all .rb files become effectively executable whether you want to trust them to be so or not and whether they are really application scripts or not. Is there a way to set the shebang line to somehow reference RVM in such a way that a simple file in the home directory could be used to dynamically specify which of the RVM managed rubies should be used? I'm thinking this would basically be like a user-level .rvmrc file. I probably just need to read the RVM documentation to find that this does exist, but if you had such a mechanism, you could safely skip .desktop files entirely while still avoiding the need to mess with all your .rb scripts in order to get them to run with the right Ruby. -Jeremy