eclipse - how to make required gems auto-completable - ruby

I'm using eclipse for ruby development and I have installed the Ruby Development Tools plugin. Seems eclipse doesn't auto-complete required gems, for example
require "gemA"
a = gemA.new
a. # no auto-completion
Is there a way to make it work in eclipse?

You may want to check out JetBrain's Ruby Mine. It's not free, but I've heard it's worth the money.
Also, I doubt eclipse has auto-completion for that plug-in. To make sure, check your IDE preferences that auto-completion is enabled.

Related

Rubymine use local gem configuration

I'm running Ruby mine 7.1.2 on Windows and I'm having difficulty with it because it seems to want to use its own gems and version of fun where. My application works fine from the command line if I do bundle install or bundle exec rails script but when I try to run from the IDE it complains about missing gems.
I could just try to reinstall all the gems via ruby mine but some of the gems require special customization in Windows and doing that from the command line is much easier. Is there anyway I can have ruby mine just use the gems which are already installed?
Rubymine will usually bundle your ruby SDK (i.e. ruby itself) and all it's associated gems so that you don't end up with weird configuration dependencies.
If you want to circumvent that then follow an official guide. In addition to that guide, be aware that there are also per-run SDK settings. These kick in when running or debugging a RubyMine project and need to be configured in the run -> configuration settings dialog.
My (unsolicited) additional advice is that I'd recommend figuring out what aspects of your global ruby installation are causing issues with RubyMine's bundle installer. The reason RubyMine sandboxes several SDKs is to reduce major headaches when you go to deploy your applications. Without it, you might encounter dependency hell when you deploy your application. From my personal (and extremely annoying) experience, rushing these initial set-up steps tend to come back with vengeance when you want to run ruby apps elsewhere.

Rails 1.9.3 Syntax Highlighting in Eclipse

I'm new to Rails and need to get my Eclipse DLTK highlighting working.
It is occasionally giving syntax error, unexpected ':' for hash colon notation. Though the application runs fine.
I'm using Eclipse Indigo and the Ruby Development Tools.
So, unfortunately, this is still an issue in Eclipse, and it's driving me crazy.
Both the Eclipse DLTK project (for both Indigo and Juno) and the Aptana Studio plugin for Eclipse -- all have this issue.
Here's the relevant bugs, still open and unaddressed:
1) https://bugs.eclipse.org/bugs/show_bug.cgi?id=386350
2) http://jira.appcelerator.org/browse/APSTUD-4405
It's enough to make me overcome the usual switching IDE inertia, so I'm currently evaluating RubyMine (it does not have that syntax error problem, as I just tested, and is an excellent Ruby IDE from everything I've been able to read).
[edit] For what it's worth, I also just submitted a patch for this issue on the dltk.ruby github repo.
As of today, I like Idodds answer best: use DLTK 5.0 which appears to be the only option both (modestly) maintained and (modestly) functional. I had to crawl through some nasty internets to find the answer to "how to actually install DLTK 5.0" since all the search results send you to update sites which gives you DLTK 2.0 at best. I finally found this, which was the best I encountered for getting 5.0 on newer eclipse luna (newer than Kepler which Idodds detailed):
http://download.eclipse.org/technology/dltk/updates-dev/5.0/
When I used that update site (and de-selected "show in groups" since they've misconfigured this plugin). Then I just selected the two options I wanted: "Ruby Development Tools" and "Ruby Development Tools SDK" (which in turn required the core plugin). PLEASE NOTE: I also made very sure to confirm the "Version" looked something like "5.*" which it did in this site (and definitely did not in the others).
PostScript: the other two:
RDT: I've been using RDT for almost a year now with ~0 success. it does a modest job of syntax highlighting, but it does a comprehensive job of crash-and-burning on ruby 1.9 syntax. I wish internet/google would flag RDT as deprecated: a plugin which supports ruby 1.8 and prior really should not be listed in current "ruby" search results.
Aptana gets some very good press, and some very bad press. I should try it, since I need Rails not just ruby, but the bad press seems pretty comprehensive, so I've avoided it. I tried a few times and failed, but of course any non-java eclipse plugin will probably take a few days to make work.
This seems to be mostly resolved now. The main problem I encountered was with the new hash key syntax.
With Eclipse Kepler and DLTK 5.0 there are less errors. The syntax checker seems strict, but now works.
Using the Kepler release make sure you add the following as a Repository in "Install New Software":
http://download.eclipse.org/releases/kepler
Then install DLTK 5.0. The repositories that come bundled with Kepler don't seem to refer to the latest DLTK version which is why this issue looks like its not fixed.

What IDEs are available for jRuby?

I've done some googling and there seems to be a scarcity of IDEs for jRuby.
I've read about TextMate and Sublime, but they don't provide debugging or code completion.
Can someone make a suggestion (or is this technology still in its infancy)?
There are several options; I prefer JetBrains' IntelliJ (RubyMine).
Aptana has an Eclipse plugin. NetBeans used to have official support, not sure what the current state is.

How to fix rails 3.0.1 on Netbeans 6.9.1 for Ruby 1.9.2

I have Mac os 10.5.8 and Ruby 1.9.2p0, Rails 3.0.1, Netbeans 6.9.1 installed. When i run the project by creating it from existing source code, it says
Error opening script file: /usr/local/src/demo_app/script/server (No such file or directory)
Before it i have edited project in TextMate and run successfully over terminal. I know that with Rails 3.0 there is no script/server but rails server, to run the project. How to fix this issue, is there any way to configure RUN command in netbeans or any other idea is most welcome.
Thanks
I had the same problem. Here is what you can try:
Go to the folder where the gem ruby-debug-ide-0.4.6 (or whatever your version is) is installed.
In the lib folder, edit the file ruby-debug.rb
Locate the method def debug_program(options).
Look for the line bt = debug_load(Debugger::PROG_SCRIPT, options.stop, options.load_mode)
Just before that line, add Debugger.const_set('PROG_SCRIPT', './rails server')
Save file and restart Netbeans.
You may see a warning that constant is being set or something when NetBeans starts the debugger, just ignore that.
Also, you should upgrade to using Rails 3.0.3
I have read that Neatbeans 6.9.1 doesn't support Rails 3 as the underlying command line tools have changed in Rails but the changes were too late for the Netbeans release cycle.
I would recommend, if you are using MRI Ruby (1.8.*) or YARV Ruby (1.9.*) switching to Rubymine if you need an IDE either temporarily or permanently as it fully supports Rails 3 and all of the command line tools that support it. It has good integration with git too and many other very useful version control tools. If you are using any other versions of Ruby I can't say if you will have much success because I don't know.
It also has good refactoring tools and debugging support if you need it.
You can get a temporary 30 day licence from the home page and also keep up to date with development changes at the EAP page, they also offer free licenses if you are doing open source development.
For mac os 10.5.8 you might want to have a look at this thread if you have difficulty installing it.
I don't expect a bounty for this answer as its not an exact answer to your question but its a possible solution.

What's wrong with Aptana RadRails Eclipse update site?

I'm trying to install Aptana Studio as Eclipse plugin in Eclipse 3.3 (Europa), and I'm following instructions on this link. However, the recommended update address for Eclipse 3.3 http://update.aptana.com/install/studio/3.2/ returns the following error message:
"Unable to access site: "http://update.aptana.com/install/studio/3.2/" [Server returned HTTP response code: "403 Forbidden" for URL: http://update.aptana.com/install/studio/3.2/.]"
The latest version does install on Eclipse 3.4 (Ganymede), however I'm trying to add a bit of Ruby to existing Java-based projects and 3.3 environment my team currently uses.
Questions:
Is this only a temporary error, am I doing something wrong?
Did someone get Aptana Studio to work with Eclipse 3.3?
Is there a way to install only RadRails plugin without complete Aptana Studio? It seems to include a bunch of stuff I don't really need.
Idea here is to integrate a bit of Ruby into existing Java project, but so far Ruby has been pain in the buttocks to get working. Switching to NetBeans or installing Aptana as standalone are not really options I'd like to consider, and I'll switch to Eclipse 3.4 if I have to, but to be honest I'm currently at the point where I'm seriously considering ditching Ruby as "not mature enough" and considering other options (like Groovy for example).
There was a ticket 3913 mentioning this workaround:
manually modify the following line in the feature.xml file under C:\Program Files\Aptana\Aptana Studio 1.2\features\com.aptana.ide.feature.framework.air_1.2.5.*:
<update label="%updateSiteName" url="http://update.aptana.com/update/air/3.2/"/>
to
<update label="%updateSiteName" url="http://update.aptana.com/update/air/1.5/3.2/"/>
But in your case, both
http://update.aptana.com/install/studio/3.2
http://update.aptana.com/install/studio/1.5/3.2
redirect to:
http://update15.aptana.org/studio/26124/3.2
http://update15.aptana.org/studio/26124/1.5/3.2
So... may be a new ticket to Aptana support is in order.
I ended up using Ruby Developer Tools as described here, which were enough for my needs at this point.

Resources