Solaris Express Developer Edition (SXDE) 01/08 comes with both a native Ruby implementation and NetBeans 6.0 preinstalled.
This howto describes some initial configuration steps you need to make to have a smooth experience using native Ruby with NetBeans in SXDE 01/08.
The easiest way to do this is to write a little script that sets GEM_HOME and then starts NetBeans, and then modify your NetBeans shortcut to run this script.
#!/bin/bash export GEM_HOME=/var/ruby/1.8/gem_repository /opt/netbeans-6.0/bin/netbeans
Don't forget to do chmod +x ~/bin/netbeans to make your new script executable.
Alternately, if you don't want to bother with changing your shortcut, you can just run your script from the command-line.
What follows are the manual instructions and background information for setting up the gem repository and installing Rails.
$ su Password: # chmod -R a+w /var/ruby/1.8/gem_home # chmod -R a+w /opt/netbeans-6.0/ruby1/jruby-1.0.2/lib/ruby/gems # chmod -R a+w /usr/ruby/1.8/bin
Note you also need to make Ruby's bin directory writable. I'm not sure why this is, but installation of Rails fails unless you do this.
The native Ruby support that comes with SXDE 01/08 does not include Rails. It is easy enough to install however.
Note that NetBeans 6.0 has some issues with Rails 2.x, although you can get it to work, see the NetBeans Tutorial Divas blog on how to do this. However, for best results, I recommend using the same version that comes with JRuby support in NetBeans, which is version 1.2.5.
$ gem install rails --version 1.2.5
This assumes GEM_HOME is set in your enviornment...
It will ask you if you want to install all dependencies, just keep saying "yes." I tried to use the --include-dependencies option but it failed saying the gem rails (version 1.2.5) could not be found...
To get the latest version of Rails rather than version 1.2.5, just do gem install rails with no version specified.
You can also install Rails directly in NetBeans, once you have set up your GEM_HOME correctly.
You will be prompted to install Rails the first time you create a Rails project. However, with this approach, NetBeans automatically installs the latest version of Rails, which is not what I recommend.
So, a better approach is to go to Tools->Ruby Gems, and select the Available tab, and search for "Rails". Then click Install and choose "1.2.5" from the version drop-down, or choose the latest version if you want to go with 2.x.
This is pretty simple. Bring up NetBeans, and create a new Ruby On Rails project (File->New Project->Rails->Ruby on Rails Application). The first panel of the project wizard will ask you if you want to use JRuby or native Ruby (under /usr/ruby/1.8/bin). Pick native Ruby, and you're good to go.
At this point you should be able to walk through the Ruby Tutorial without a hitch (you will need to start up MySQL, which is described in this howto).
This is a Wiki page, which is meant to be collaborative. If you have more information that you think is useful, or corrections and errata, please feel free to add your comments here.
CORRECTION: I think you want to set GEM_HOME=/var/ruby/1.8/gem_home not /var/ruby/1.8/gem_repository like you have in the script at the top of the page. This path doesn't exist on my SXDE 01/08 image and causes gem to crash noisily.
COMMENT: You can start the Netbeans php ide (which has less modules and presumely a smaller RAM footprint) by substituting /opt/netbeans-6.0/bin/netbeans-php for /opt/netbeans-6.0/bin/netbeans in the startup script at the top of the page.
| install-rails.jpg | ![]() |
156262 bytes |
| setup-ruby.sh | ![]() |
548 bytes |