Monday Apr 20, 2009

NetBeans 6.5 and RSpec 1.2

The following stack trace might be a bit too familiar for those of you who have tried the latest RSpec (1.2.4) with NB 6.5.1:
 from /usr/lib/ruby/gems/1.8/gems/rspec-1.2.4/lib/spec/runner/options.rb:119:in `run_examples'
 from /usr/lib/ruby/gems/1.8/gems/rspec-1.2.4/lib/spec/runner/command_line.rb:9:in `run'
 from /usr/lib/ruby/gems/1.8/gems/rspec-1.2.4/bin/spec:4
 ...

The good news is that the issue is fixed in 6.7 builds and for 6.5.1 you can fix it by downloading this file and copying it to the netbeans_install_dir/ruby2 directory. You may want to make a backup of the existing nb_rspec_mediator.rb file in that directory first.

Update: There was still an issue with running focused tests as reported by Asfand Yar Qazi. I've now changed the link to point to a newer version that should fix that problem.

Friday Apr 17, 2009

Type Inference for Constants

Martin implemented several type inference improvements for 6.7, but since he hasn't blogged about any of those and I've now continued his work in this area I thought I'd mention some of them in this blog. Basically credit me for everything that works smoothly, for bugs please blame Martin.

There's quite a lot of stuff and I have just so much time and patience to write one blog entry, so this will be more like a series. For the uninitiated, type inference (hereinafter just TI) means that the IDE tries to infer the types of values, which, thanks to the dynamic nature of Ruby, can be a bit tricky at times.

Let's first take a look at TI for constants. Top-level constants:

(ARGV is an Array, hence the code completion dialog shows just the appropriate methods for it.)

(STDOUT is an instance of IO.)

Constants from other modules/classes:

(Date::ITALY is a number.)

And finally, local constants:

That's it for constants, in the next installment of the series I'll talk about TI for methods.

Thursday Apr 16, 2009

Ruby 1.9 Support

Over the past few weeks I've been working on a couple of editing infrastucture related tasks, one of them being switching our parser to use Tom Enebo's jruby-parser project instead of the patched JRuby we used previously. This brings us, among other things, support for Ruby 1.9. Of course, it has been possible to use 1.9 with NB even before, but it wasn't possible to use any new 1.9 syntax without having syntax errors in the editor.

The steps for enabling 1.9 support in NB depends on whether you use JRuby or MRI.

For JRuby, you need a recent enough version that supports 1.9 -- best to get the latest release, 1.2.0 (note that we already bundle 1.2.0 in 6.7 dev builds). Second, you need to switch JRuby to 1.9 mode, which you can do by using the

-Djruby.compat.version=RUBY1_9
switch. If you have a plain Ruby project, you can add it to the JVM Arguments field in Project Properties -> Run. For a Rails project, you need to add
jvm.args=-Djruby.compat.version=RUBY1_9
to
path_to_your_project dir/nbproject/project.properties.
(Obviously, there needs to be a more user friendly way to do this). Note that if you want to run JRuby in 1.9 mode from the command line, it is as easy as
jruby --1.9 ...

If you use MRI, it is enough to point the project to use a MRI 1.9 platform and the parser will be switched to the 1.9 mode automatically.

Now, time for a screenshot of the 1.9 parser in action (see e.g. this document for changes in 1.9):

The notable thing in the above screenshot is of course the lack of error stripes in the editor.

As always, please give it a try and let me know how it works for you (see here for instructions on how to get a dev build). Also, please note the debugging support for 1.9 is still not there.

Tuesday Apr 14, 2009

Browser not launched with Rails 2.3.2 and NetBeans 6.5

If you're using NetBeans 6.5 (or 6.5.1) and Rails 2.3.2 you've probably noticed that the Run action in Rails projects doesn't launch the browser like it should. It has been fixed in dev builds for some time already, but using a dev build is not an option for everyone. Since it is unclear when/if there will be another patch for 6.5.1, I made the patched Rails module available in this issue. Please follow the intructions in the issue for updating your IDE and as always, please report if you encounter any problems.

Note: the patch is for 6.5.1; I make no guarantees that it will work with 6.5, though it may.

About

emononen's blog

Search

Top Tags
Categories
Archives
« April 2009 »
SunMonTueWedThuFriSat
   
1
2
3
4
5
6
7
8
9
10
11
12
13
15
18
19
21
22
23
24
25
26
27
28
29
30
  
       
Today