The "One Laptop Per Child" project has a great device ready to ship, but there's no Java on there. Let's think about working together to put Java on OLPC!
Well, I'm back everyone! For those of you who didn't know, I was spending a week in London for my day job. Nice town, btw. Anyway, it was for this reason that I fell somewhat silent both on my blog and on EclipseZone. Actually, EclipseZone fell pretty silent in general for a few days as we played editor vacation roulette. Thankfully, all is back to normal, and life should move forward nicely.
One of the things I experimented with while sitting through meetings was using DLTK Ruby instead of RDT for my Ruby development. After all, DLTK supposedly offers a better editor than RDT, including auto-complete and proper indentation support. I had been getting very frustrated with RDT expanding my tabs to spaces automatically. (even after I changed the formatter setting to make it stop) RDT was slowing me down in a lot of ways, so I figured "what have I got to lose?" The answer: a lot of time, apparently.
DLTK is
not
the easiest tool in the world to get started with. I suppose I can't really blame them since they are still in pre-release, but still there should be some guide (or at least a hint) somewhere that lets us poor users get started. I ended up spending a lot of time fiddling with preferences and project files to try and get stuff working. Also, I had to work around some weird bug in the Europa-current release of DLTK which caused the editor to completely flake out half the time. So, to help enlighten all the rest of you who want to try this, here's what I did:
Installation
The update site is the only thing on the DLTK wiki page which is remotely related to installation and configuration. Now, while DLTK does offer a distribution targeted at Eclipse 3.2, it only supports TCL. However, this wasn't a horrible problem since I was already using Eclipse 3.3. For the rest of you who haven't switched to 3.3 yet, I would recommend 3.3 M6. Really, it's pretty stable now and worth trying (as long as you aren't using Instantiations Window Builder. More on that in a future article…)
Here's the link to the update site:
http://download.eclipse.org/technology/dltk/updates/1.0/site-interim.xml
The one important thing is that you will have to scroll all the way down the list of mirrors and select the "DLTK Update Site" mirror. This is because the DLTK integration builds aren't mirrored out. Note, I don't recommend you do this sort of thing (select the direct mirror) on a regular basis. If nothing else, your download speeds will be terrible.
Installation of DLTK Ruby is pretty standard stuff. You want the DLTK Ruby IDE, not the SDK or the Source. Well, the SDK and Source won't do you any harm, but they won't do any good either… Once you select the Ruby IDE, the update manager will notify you that DLTK Core is a prerequisite. If you hit "Select Required" Eclipse will locate the dependencies in the update site and mark them for installation.
Oh, the download servers for DLTK are a little slow (at least from the UK), so have a little patience. It took me about 10 minutes to pull down everything on an 8 Mbps BT connection.
Configuration
You won't be able to do anything useful with DLTK until you configure the installed interpreters. Hit Eclipse preferences, expand "DLTK Ruby" and then select "Ruby Interpreters". You can search for an interpreter, and that's pretty cool, but I just added mine manually. Note, you
cannot
add JRuby as an interpreter yet because it doesn't actually have a Windows executable as part of the distribution. DLTK will not let you add batch files as interpreters, so we're stuck with C Ruby until they fix this.
The one important thing to do after you have the interpreter located is to add its external libraries. DLTK is a little vague on just what qualifies as "external libraries", so I had to play around with it for a bit before I discovered
the magic hand-shake to make it work. Essentially, you want
$RUBY_HOME/lib/ruby
added to your list of external libraries. For example, my external libraries list looks like this
Once you've got your external libraries set, you should be able to use DLTK Ruby for development. DLTK does have a few more settings which allow you to mess with indentation (tabs vs spaces, indentation width, etc) as well as syntax coloring. Also worth of note is that the DLTK editor doesn't fully support some of the syntax coloring options. For example, the "return" keyword will always be colored purple and bolded, regardless of what your settings are for the other keywords (which will be observed). As far as I can tell, DLTK has been respecting tab settings and width (unlike RDT in Eclipse 3.3).
Usage
The next step is obviously to try out your new toy. DLTK does define a few new views and a new perspective, but I just used everything within my standard Java Development perspective. In fact, I didn't even use the new Script Explorer view, but instead used the old stand-by, Package Explorer. This sort of simplified things a bit (especially considering that with RDT and DLTK Ruby installed, I had two perspectives named "Ruby" with identical icons).
You will need to create a DLTK Ruby -> Ruby Project in order to get started. Content assist and running of script files won't work if you're just editing scripts within other project types (though, the basic editor functionality does work). Creation of the project is fairly trivial, especially to someone familiar with JDT project creation so I won't go over it too much.
Once the project is created, you can create a script file within the source folder you assigned (by default, the project root). I just used the New -> File dialog, but DLTK Ruby does provide a new "Ruby Source File" dialog which is virtually identical. I'm assuming they will add more options in the future. Open the created file and type the following text into the editor (you can copy/paste, but then you miss the full effect):
def test
File.superclass
str_var = ''
str_var.split '.'
end
When you get to "File.", pause for a moment and let DLTK finish indexing your source directory. If you power through this line, you'll have to close the editor and Eclipse (in that order) and then start Eclipse back up in order to be able to re-trigger the content assist indexing. On my machine (7200 RPM SATA drive with 2 GB RAM) it takes about 10 seconds to index everything and present a coherent content assist.
Pretty cool!
DLTK Ruby has a great editor with a lot of promise. They (the DLTK team) have said that they're targeting themselves for the Eclipse 3.3 Europa release train, and it will be very interesting to see if they can live up to all this promise. Hopefully, they will be able to iron out the wrinkles from their tool in the next few months and on June 29
th
present us with a product which is worthy of stacking against NetBeans, Ruby in Steel and IntelliJ in the field of Ruby IDEs.
I just downloaded and fired up eclipse 3.3M6. DLTK Ruby 1.0.0v200702161649 is in the Europa update server.
Either code-assist is implemented in a later version, or I didn't configure things right (though, it looks too straightforward), or there is something wrong with my interpretor or environment, code-assist didn't work for me out of the box.
I used the update site you provided to get update dltk to the latest available there. This xml file is a list of mirrors. I found out that not all mirrors are the same. One mirror didn't the later versions that other mirrors do.
Anyway, I have dltk ruby sdk 1.0.0v200703141020 installed now. I'm still disappointed that code-assist is not working. Oh well, will keep one eye open on this.
> Daniel,
>
> Thanks for the intro.
>
> I just downloaded and fired up eclipse 3.3M6. DLTK
> Ruby 1.0.0v200702161649 is in the Europa update
> server.
>
> Either code-assist is implemented in a later version,
> or I didn't configure things right (though, it looks
> too straightforward), or there is something wrong
> with my interpretor or environment, code-assist
> didn't work for me out of the box.
>
> I used the update site you provided to get update
> dltk to the latest available there. This xml file is
> a list of mirrors. I found out that not all mirrors
> are the same. One mirror didn't the later versions
> that other mirrors do.
>
> Anyway, I have dltk ruby sdk 1.0.0v200703141020
> installed now. I'm still disappointed that
> code-assist is not working. Oh well, will keep one
> eye open on this.
>
> John
Yeah, the code assist is pretty touchy. The type inference isn't too good yet, so it can only present non-static content-assist where it's blatantly obvious (like "1."). What if you do "File." like in the post? That's what finally made it work for me, is doing it on a static(ish) type.
The other possibility is that the sources directories didn't get added right, you're using the editor within a non-DLTK Ruby project, or maybe the indexing got interupted. Like is said, it's pretty finicky. I'm looking forward to a more stable editor.
> I am curious about this sentence of yours:
>
> "DLTK will not let you add batch files as
> interpreters, so we're stuck with C Ruby until they
> fix this."
>
> Would the following work?
>
> Interpreter Executable: cmd.exe
> Interpreter Arguments: /C c:\SomeDir\SomeBat.bat
>
> -Christopher
Nope, unfortunately not. Apparently DLTK not only prevents the use of cmd.exe as an interpreter, but it also rules out args passed to the interpreter executables.
Installing and Configuring DLTK Ruby
At 1:26 PM on Mar 26, 2007, Daniel Spiewak
wrote:
One of the things I experimented with while sitting through meetings was using DLTK Ruby instead of RDT for my Ruby development. After all, DLTK supposedly offers a better editor than RDT, including auto-complete and proper indentation support. I had been getting very frustrated with RDT expanding my tabs to spaces automatically. (even after I changed the formatter setting to make it stop) RDT was slowing me down in a lot of ways, so I figured "what have I got to lose?" The answer: a lot of time, apparently.
DLTK is not the easiest tool in the world to get started with. I suppose I can't really blame them since they are still in pre-release, but still there should be some guide (or at least a hint) somewhere that lets us poor users get started. I ended up spending a lot of time fiddling with preferences and project files to try and get stuff working. Also, I had to work around some weird bug in the Europa-current release of DLTK which caused the editor to completely flake out half the time. So, to help enlighten all the rest of you who want to try this, here's what I did:
Installation
The update site is the only thing on the DLTK wiki page which is remotely related to installation and configuration. Now, while DLTK does offer a distribution targeted at Eclipse 3.2, it only supports TCL. However, this wasn't a horrible problem since I was already using Eclipse 3.3. For the rest of you who haven't switched to 3.3 yet, I would recommend 3.3 M6. Really, it's pretty stable now and worth trying (as long as you aren't using Instantiations Window Builder. More on that in a future article…)
Here's the link to the update site: http://download.eclipse.org/technology/dltk/updates/1.0/site-interim.xml The one important thing is that you will have to scroll all the way down the list of mirrors and select the "DLTK Update Site" mirror. This is because the DLTK integration builds aren't mirrored out. Note, I don't recommend you do this sort of thing (select the direct mirror) on a regular basis. If nothing else, your download speeds will be terrible.
Installation of DLTK Ruby is pretty standard stuff. You want the DLTK Ruby IDE, not the SDK or the Source. Well, the SDK and Source won't do you any harm, but they won't do any good either… Once you select the Ruby IDE, the update manager will notify you that DLTK Core is a prerequisite. If you hit "Select Required" Eclipse will locate the dependencies in the update site and mark them for installation.
Oh, the download servers for DLTK are a little slow (at least from the UK), so have a little patience. It took me about 10 minutes to pull down everything on an 8 Mbps BT connection.
Configuration
You won't be able to do anything useful with DLTK until you configure the installed interpreters. Hit Eclipse preferences, expand "DLTK Ruby" and then select "Ruby Interpreters". You can search for an interpreter, and that's pretty cool, but I just added mine manually. Note, you cannot add JRuby as an interpreter yet because it doesn't actually have a Windows executable as part of the distribution. DLTK will not let you add batch files as interpreters, so we're stuck with C Ruby until they fix this.
The one important thing to do after you have the interpreter located is to add its external libraries. DLTK is a little vague on just what qualifies as "external libraries", so I had to play around with it for a bit before I discovered
Once you've got your external libraries set, you should be able to use DLTK Ruby for development. DLTK does have a few more settings which allow you to mess with indentation (tabs vs spaces, indentation width, etc) as well as syntax coloring. Also worth of note is that the DLTK editor doesn't fully support some of the syntax coloring options. For example, the "return" keyword will always be colored purple and bolded, regardless of what your settings are for the other keywords (which will be observed). As far as I can tell, DLTK has been respecting tab settings and width (unlike RDT in Eclipse 3.3).
Usage
The next step is obviously to try out your new toy. DLTK does define a few new views and a new perspective, but I just used everything within my standard Java Development perspective. In fact, I didn't even use the new Script Explorer view, but instead used the old stand-by, Package Explorer. This sort of simplified things a bit (especially considering that with RDT and DLTK Ruby installed, I had two perspectives named "Ruby" with identical icons).
You will need to create a DLTK Ruby -> Ruby Project in order to get started. Content assist and running of script files won't work if you're just editing scripts within other project types (though, the basic editor functionality does work). Creation of the project is fairly trivial, especially to someone familiar with JDT project creation so I won't go over it too much.
Once the project is created, you can create a script file within the source folder you assigned (by default, the project root). I just used the New -> File dialog, but DLTK Ruby does provide a new "Ruby Source File" dialog which is virtually identical. I'm assuming they will add more options in the future. Open the created file and type the following text into the editor (you can copy/paste, but then you miss the full effect):
When you get to "File.", pause for a moment and let DLTK finish indexing your source directory. If you power through this line, you'll have to close the editor and Eclipse (in that order) and then start Eclipse back up in order to be able to re-trigger the content assist indexing. On my machine (7200 RPM SATA drive with 2 GB RAM) it takes about 10 seconds to index everything and present a coherent content assist.
Pretty cool!
DLTK Ruby has a great editor with a lot of promise. They (the DLTK team) have said that they're targeting themselves for the Eclipse 3.3 Europa release train, and it will be very interesting to see if they can live up to all this promise. Hopefully, they will be able to iron out the wrinkles from their tool in the next few months and on June 29 th present us with a product which is worthy of stacking against NetBeans, Ruby in Steel and IntelliJ in the field of Ruby IDEs.
4 replies so far (
Post your own)
Re: Installing and Configuring DLTK Ruby
Daniel,Thanks for the intro.
I just downloaded and fired up eclipse 3.3M6. DLTK Ruby 1.0.0v200702161649 is in the Europa update server.
Either code-assist is implemented in a later version, or I didn't configure things right (though, it looks too straightforward), or there is something wrong with my interpretor or environment, code-assist didn't work for me out of the box.
I used the update site you provided to get update dltk to the latest available there. This xml file is a list of mirrors. I found out that not all mirrors are the same. One mirror didn't the later versions that other mirrors do.
Anyway, I have dltk ruby sdk 1.0.0v200703141020 installed now. I'm still disappointed that code-assist is not working. Oh well, will keep one eye open on this.
John
Re: Installing and Configuring DLTK Ruby
> Daniel,>
> Thanks for the intro.
>
> I just downloaded and fired up eclipse 3.3M6. DLTK
> Ruby 1.0.0v200702161649 is in the Europa update
> server.
>
> Either code-assist is implemented in a later version,
> or I didn't configure things right (though, it looks
> too straightforward), or there is something wrong
> with my interpretor or environment, code-assist
> didn't work for me out of the box.
>
> I used the update site you provided to get update
> dltk to the latest available there. This xml file is
> a list of mirrors. I found out that not all mirrors
> are the same. One mirror didn't the later versions
> that other mirrors do.
>
> Anyway, I have dltk ruby sdk 1.0.0v200703141020
> installed now. I'm still disappointed that
> code-assist is not working. Oh well, will keep one
> eye open on this.
>
> John
Yeah, the code assist is pretty touchy. The type inference isn't too good yet, so it can only present non-static content-assist where it's blatantly obvious (like "1."). What if you do "File." like in the post? That's what finally made it work for me, is doing it on a static(ish) type.
The other possibility is that the sources directories didn't get added right, you're using the editor within a non-DLTK Ruby project, or maybe the indexing got interupted. Like is said, it's pretty finicky. I'm looking forward to a more stable editor.
ActiveObjects: an Easier Java ORM; Fuse: Resource Injection for Java
Re: Installing and Configuring DLTK Ruby
I am curious about this sentence of yours:"DLTK will not let you add batch files as interpreters, so we're stuck with C Ruby until they fix this."
Would the following work?
Interpreter Executable: cmd.exe
Interpreter Arguments: /C c:\SomeDir\SomeBat.bat
-Christopher
Re: Installing and Configuring DLTK Ruby
> I am curious about this sentence of yours:>
> "DLTK will not let you add batch files as
> interpreters, so we're stuck with C Ruby until they
> fix this."
>
> Would the following work?
>
> Interpreter Executable: cmd.exe
> Interpreter Arguments: /C c:\SomeDir\SomeBat.bat
>
> -Christopher
Nope, unfortunately not. Apparently DLTK not only prevents the use of cmd.exe as an interpreter, but it also rules out args passed to the interpreter executables.
ActiveObjects: an Easier Java ORM; Fuse: Resource Injection for Java