Open simply whatever non-NetBeans Ruby (on Rails) project in NetBeans
By Martin Krauskopf on Nov 23, 2008
Subtitle: Poor man's, but effective and simple solution
This is a tip (or trick) for how to quickly open any project (Rails or non-Rails one) without any NetBeans
metadata in NetBeans. E.g. from RubyForge,
Kenai, GitHub, ... or just your local one. In
short, all you need is to run
nb_ruby_project command (which is Ruby few-liner (excluding NetBeans
metadata)) and press C-S-1 in NetBeans.
You need just change the
two lines in the script to point to your
netbeans executable and optionally to your
userdir if you are using non-default one (e.g.
--userdir option during start-up).
NB_BIN = '/path/to/netbeans/bin/netbeans' # NB_USER_DIR = '/path/to/optional/userdir'
You might also start-up NetBeans before using the script (but not necessary)
$ nb_ruby_project Usage: nb_ruby_project <ruby_project_dir> [--rails]
For example see the following two-step (checking out and opening in NetBeans) terminal session for how to open RubyGems project from RubyForge:
$ svn co svn://rubyforge.org/var/svn/rubygems/trunk rubygems $ nb_ruby_project rubygems Project: rubygems (non-Rails) Will create following files (NetBeans metadata) in: /space/ruby/sources/rubygems/nbproject/project.xml /space/ruby/sources/rubygems/nbproject/project.properties Press "y<Enter>" to agree: y Mentioned NetBeans metadata created Opening 'Rakefile' in NetBeans...
Now the project's Rakefile should be opened in the running NetBeans session (or new NetBeans instance is started). Just press there C-S-1 (Menu | Navigate | Select in Projects) and press <Enter> to confirm the dialog as shown on the image below.
After the project is opened you might want to set different Ruby platform, add more sources and/or roots, rename the project, etc.
This is just workaround for the issue 126410 which should enable to do this from NetBeans directly. But I'm using the script very often for RubyForge-alike sites in the meantime, so sharing.... It might be enhanced with bunch of small features, like asking for source roots, being Ruby-independent, etc. But it's just a temporary workaround... hopefully not for too long.
Note that you can open all the gems you have installed on your machine, see your
directory. You might also use the script from CLI to quickly open projects already containing NetBeans metadata
(metadata creation will be just detected and skipped) during browsing your harddisk.