How to 'Reset' my OS X Ruby on Rails Gems? - macos

I've been playing with various development tools related to Ruby on Rails on OS X Lion, and things are kind of hosed up. I'd like to remove all my gems and re-install them. Is there an easy way to do this?

Maybe you could use the Ruby Version Manager and not have to remove and reinstall all gems.
From the site:
"RVM is a command-line tool which allows you to easily install, manage, and work with multiple ruby environments from interpreters to sets of gems."

Related

Why can't I just install the latest version of ruby with yum?

I am frustrated: I want to yum install ruby and install Ruby 2.4.1 or 2.3.0. Instead it seems that I have to use RVM or rbenv to get any version after 2.0.0 and both of those tools require some arduous process.
Why is this so complicated? Shouldn't I be able to install Ruby with a single yum command and use '/usr/bin/ruby' like I would '/usr/bin/java'?
Things change between Ruby versions. With the release of Ruby 2.4.0, many gems and applications needed to be updated in order to be compatible without breaking, including JSON, Rails, Nokogiri and others.
Now, with a OS distribution, people usually expect two things:
relative stability over its release cycle, so, things which worked yesterday continue to work tomorrow
that all shipped packages are compatible to each other.
If the CentOS maintainers were to upgrade their Ruby version mid-release, they would have to ensure that all other software they ship which depends on Ruby is also compatible with this new version, probably by also updating it. This leads to a maintenance nightmare since, often, these updates also change features which break the first point of requiring stability.
Because of that distributions usually ship a single version of Ruby (or Python or Perl) and only fix necessary bugs by backporting the fixes to their versions. Major updates are usually only done with a complete new OS release. How often this happens depends on the distribution you use. CentOS/RHEL tend to be very slow, Debian is so-so, Ubuntu has slower-to-update LTS releases and quicker-to-update regular releases.
In general, you trade stability for bleeding edge. And for their base OS, most people running servers tend to favor stability.
To use a newer version of Ruby for your own apps, you can still use rbenv, RVM, or any of the other Ruby installers. You can install these custom Ruby versions along the OS version and configure your own applications to use these versions.

Does wxRuby run with Ruby 1.9.2

I am investigating cross-platform GUI toolkits with Ruby bindings.
wxRuby appears to be a pretty good one, but I am wondering if it has bindings for Ruby 1.9.2.
It does work with 1.9.2, but you have to install it this way
gem install wxruby-ruby19
Otherwise, it will not work on 1.9.2. I'm on 1.9.2 and it took me quite awhile to figure that out how to get it installed correctly. Anyways, I have used it and think that it is pretty good, although I had not used any other GUI frameworks in Ruby.

Linux-Live-system inc. Ruby 1.9 on USB-Stick with r/w-Partition

well guess that many of you have great expertise on Linux. I currently have some issues with creating a linux-live-medium.
i have a box with OpenSuse-Linux Version 11.3 with all nice things. Several languages run very well: Perl, Python, PHP! All is very well! BTW - i am very glad that Perl runs very nice.
But I am not able to install Ruby 1.9. Everytime i want to do that i end up with Ruby 1.8.7. I want to testrun some ruby-code. Therefore i need Ruby with the following gems
mechanize
nokogiri
utf8_utils
I heard of a Linux-Live-medium that is able to run with all the wanted things including Ruby 1.9.
Therefore the Live-medium is installed on a USB-Stick with R/W partitions. Is this possible.
I am not a linux-expert - but with all the expertise here i think it is possible to create such a USB-Stick. (...with Ruby 1.9 and all with all that extensions)
I love to hear from you!
best regards
zero
Debian/Ubuntu includes both Ruby 1.8.x and 1.9.x - and essentially duplicates most packages in 2 flavors: for 1.8 and 1.9. That might be enough for your purposes - although YMMV, of course.
Yet another solution is RVM that karudzo already mentioned.
Yet another solution is virtualization: simplest form of it would be just chrooting. Most modern Linux systems have an ability to install itself based from some root directory (SuSE has install into given directory functionality, Debian/Ubuntu have debootstrap - and then just running chroot /path/to/that/directory - you'd end up in essentially another system installed cleanly in separate directory.
This will actually be a better solution for you- use RVM:
https://rvm.io/
Then you can easily switch back and forth from 1.8 to 1.9 as desired and make 1.9.2 your default. Just read their docs carefully, it really makes gem management a lot easier.

Which Ruby version is preferable?

Is there any reason to use 1.8.7 over 1.9.1 or is it always best to use the latest stable release?
Usually, if you are not maintaining scripts written in older versions, then using the latest will be what i would choose, since there will be bug fixes, new features etc...
1.9.1 but I have run into problems.
If you don't know RVM you should look at that cause you can switch between ruby versions depending on which project or error you are getting.
There are some bugs in 1.9.1 that caused problems installing some gems, and that went away when I switched to 1.9.2, so I'd recommend 1.9.2. I'd also choose 1.9.2 over 1.8.7 for learning since there are some new features in 1.9.2 plus speed improvements.
And definitely, use RVM for your installations. It makes it easy to manage Ruby versions and sets of gems.
If you are starting fresh, I would suggest 1.9.2. There are many nice syntactic features over 1.8. I would go straight to 1.9.2, as I have heard there have been some idiosyncrasies with 1.9.1. Most gems are >= 1.9 ready by now.
I also would recommend RVM (http://rvm.beginrescueend.com/). I would start with your default ruby on your system. Install RVM, the then 'rvm install 1.9.2', and you will be on the right track. RVM has a great IRC and google group, if you need help.
RVM will let you test against all versions of Ruby available. Try 'rvm list known' to get the full list.
MRI Rubies
JRuby
Rubinius
Ruby Enterprise Edition
MacRuby
MagLev
mput
IronRuby
Hope that helps!

query regarding Ruby

I am a fresher as far as Ruby is concerned. i worked in PHP for sometime. I was wondering if there is some pakage like LAMP or WAMP as in case of PHP for Ruby too......
If not at least suggest me the best setup or IDE for Ruby
Thanx in advance
There is something like: rubystack, if this is what you are looking for (rails development).
BitNami RubyStack greatly simplifies the development and deployment of Ruby on Rails applications. It includes ready-to-run versions of Apache, MySQL, Ruby and Rails and required dependencies. It can be deployed using a native installer, as a virtual machine or in the cloud.
Netbeans, an IDE coming from the java world has ruby support: http://wiki.netbeans.org/Ruby.
Windows
If you use Windows, the easiest way to get Ruby working is via the RubyInstaller.
If you only want to work on Ruby, Ruby 1.9.1 is your choice. Otherwise, if you want to experiment with Rails, you should try to install Ruby 1.8.7.
There's also a BitNami Ruby stack but it contains much more stuff than Ruby itself. You don't really need Apache or MySQL to work with Ruby on your local machine because you can use Mongrel and SQLite. In this way, you don't have to bother with additional background processes.
Avoid using Ruby 1.8.6. It's old and it's not convenient to start studying with an outdated Ruby version.
Mac OS X
Ruby comes installed by default with Leopard and Show Leopard. If you want a different Ruby version, I suggest to use RVM.
Linux
You can install Ruby by source or with your system package manager.
The Rails framework is a great setup for doing web development, and I would highly recommend RadRails as your IDE or it's base, Aptana.

Resources