How to setup ruby profiler in IntelliJ - ruby

There seems to have been a recent update for to ruby mine that allows you to attach a rbspy profiler to a rails app. I have found a ton of guides on the internet (for instance this one) that explain what changes need to be updated in ruby mine to allow you to attach the profiler to the ruby process, but i have not been able to find the same steps for intellij with the ruby plugin.
Is there a way to perform the steps linked in the guide above in the Intellij IDE?

At the moment Ruby profiler isn't available via Ruby plugin in IDEA but it's planned to be in 2019.2:
https://youtrack.jetbrains.com/issue/RUBY-23977
UPD: it seems to be available in the last IDEA 2019.2 EAPs (starting from 192.5118.30)

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.

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.

How to incorporate Interactive Ruby into my development process?

I am trying to find a better way to integrate IRB with my normal ruby devleopment. Currently I rarely use IRB with my code. I only use it to verify syntax or to try something small.
I know I can load my own code into ruby as a
require 'mycode'
but this usually doesn't mesh with my programming style. Sometimes the variables I want to examine are out of scope or inside of a loop. Is there an easy way to fire up my script and freeze at a certain point inside of IRB? I guess I'm looking for an easier way to debug my ruby code without breaking my F5(compile) key.
Maybe a more experienced ruby developer can share with me a more streamlined method of development.
Install the ruby-debug gem. Of course, require it inside your app (only in development/test mode). Now you can write 'debugger' where you want to stop execution.
Once your app stop at your breakpoint, you can type 'help' to know about all commands. One of them is 'irb'. It starts an IRB session in which you have access to all methods in your current context.
I personally mostly use p (print), eval, v i (instance vars) and v l (local vars). Of course, n for next and c for continue.
The command to step out of a given block/method never worked for me though. I never investigated why :-)
I don't tend to use irb directly that frequently, as I tend to be inside rails and so use script/console a bunch, but I do like using the ruby debugger (Ruby Debug gem). It lets you set a breakpoint basically and then step through your code line by line.
Here's a screencast about it that I haven't actually watched, but a quick search pulled it up, and it could be useful:
http://brian.maybeyoureinsane.net/blog/2007/05/07/ruby-debug-basics-screencast/
For Ruby development in Eclipse: there's a much improved version of RDT (ruby development tools) available now. To install it directly in Eclipse, click Help > Software Updates > Find and Install > Search for new features radio button > next > new remote Site > Name = Ruby and URL = http://update.aptana.com/update/rdt/3.2/
Another Ruby plugin is the shiny new Eclipse DLTK (dynamic languages toolkit).
DLTK stable release 1.0.M5 just came out a few days ago.
Here are some useful installation tips.
I just use rdebug to debug any of my ruby or RoR code.
If you're willing to use an IDE for debugging, I know Eclipse (via the Ruby Development Tools) has a relatively straightforward interface. If you're doing rails then there's a specific build of eclipse called RadRails which may also help (though I haven't used it for debugging)

Resources