Drop into irb when debugging in Aptana 3 - ruby

I am new to ruby and Aptana (I have used eclipse before) I was wondering if when debugging in Aptana we can drop into irb to play around with things with current values set. For example doing Java dev in eclipse on a breakpoint you can open Window -> Show View -> Display and start executing Java code with all objects having their current state. Is there a similar thing for debugging ruby apps in Aptana 3?
Thanks

This feature wasn't implemented in Studio 3.0, but is scheduled for 3.0.2. Here's the ticket for the work: https://aptana.lighthouseapp.com/projects/35272/tickets/2122-port-display-view-fro-ruby-debugging-from-radrails-2x
You can try it out via our nightly builds. See here for the instructions on getting that: http://wiki.appcelerator.org/display/tis/Changing+the+Update+Type#

If you want to start an IRB session at runtime try Pry. Also Check out the blog post

Related

How to setup ruby profiler in IntelliJ

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)

Aptana 3 and shell

How config Aptana Studio 3 for running CakePHP bake shell script?
Several times I came up to this thread while searching Stack Overflow and Google for an answer too. I noticed that Aptana 3 doesn't have a "Tools --> External Tools" item anymore, although Aptana 2 had this great feature by default.
I couldn't find any solutions, so I started to find out myself. For all people having the same problem, here's the solution:
The feature is there, but not available on default.
Open the "Web" perspective
Right click the "Web" perspective (right upper part of the screen)
Click "Customize..."
Go to the tab "Command Groups Availability"
Enable "External Tools" by checking its checkbox
Go to the tab "Menu Visibility"
Expand "Run" and enable "External Tools" by checking its checkbox
Press "OK" and you're ready to go.
To complete the whole case, here is the configuration I use for the CakePHP Bake External Tools. It's a little bit different than suggestions elsewehere, but it makes it independent for each project.
CakePHP 1.x
Open Run -> External Tools -> External Tools Configurations
Create a program
Name: CakePHP Bake
Location:
Mac OSX: ${project_loc}/cake/console/cake
Windows: ${project_loc}/cake/console/cake.bat
Working Directory: ${project_loc}/app
Arguments: bake
Using ${project_loc} in the location (step 4) will locate the Cake console of your current project. While most projects in my case uses the latest version (currently 1.3 branche), older projects may still use the 1.2 or even the 1.1 branche. The bake console may differ from branche to branche.
UPDATE Aug 22nd 2014
As I've posted this solution in 2011 and people are still using this topic, here's how it works for the new CakePHP 2.x range.
Open Run -> External Tools -> External Tools Configurations
Create a program
Name: CakePHP 2.x Bake
Location:
Mac OSX: ${project_loc}/lib/Cake/Console/cake
Windows: ${project_loc}/lib/Cake/Console/cake.bat
Working Directory: ${project_loc}/app
Arguments: bake
LINK
Aptana is built on eclipse. Search for eclipse solution.

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