Adding an interpreter to RubyMine - ruby

I recently downloaded RubyMine 7.1. This is my first time using Ruby. I am trying to add an interpreter to my first project. When I go to Settings -> Languages and Frameworks -> Ruby SDK and Gems, and I try to add an interpreter path, it says "The selected file is not a valid home for Ruby SDK." What does this mean and how can I add an SDK?

Probably you are using a Ruby SDK version that is not supported by the RubyMine.
Try downgrading Ruby, and configuring IDE again.

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.

RubyMine doesn't recognize my Ruby installation path

I've made a custom sient installer of Ruby 2.0 with some gems and extras, my installer expands all the Ruby files to c:\Program Files (x86)\Ruby, the interpreter (ruby.exe) is in the Bin folder, all is as normally but just it's not an original installation, I expand the files and I add the registry keys to associate files by my own, I can run Ruby as normally ever I want.
Now, is the first time that I try the JetBrains RubyMine IDE, and I can't found a simple guide which explains how to set the Ruby directory, seems that this IDE assumes that the Ruby installation is original and maybe takes a registry value from the original Ruby installer to know the Path or something, I don't know, but just I didn't see any help about how to set the Ruby directory manually.
(I have the same problem for PyCharm)
Anyways I've tried to set it from the Ruby SDK and Gems option, the dialog-box says "select Ruby interpreter Path", but I'm on the Path and it's not recognized, I mean that the Ok button still disabled:
Then I'm missing the right option anywhere? or really a professional and expensive IDE like this doesn't has support just to specify the location of Ruby in these circunstance where an user does not use the original Ruby installer? I really will think not.
In my experience it is more preferable to set your PATH environment variables appropriately instead of trying to locate executables on a per-app basis.
You can set your path so that the desired Ruby takes precedence over any other rubies and I am sure that RubyMine will pick it up (or just use ruby and let your PATH specify which to use).
On another note you might also want to have a look at a ruby version manager such as rbenv or RVM.
Update: Just tried to set manually a Ruby SDK in the latest version of RubyMine (6.3) and it worked as expected. I had, however, to expand the folder in which the binary resided (in your case bin), select the actual binary and then click OK. Have you tried that as well?
If you have two JRuby versions installed and one of them is not recognized:
Add both bin directories to your PATH (like in Kostas Rousis's answer above),
set JRUBY_HOME to the one version you want to use and
restart RubyMine.
In my case, I have the version 1.6.8 and 9.1.13.0 installed. Setting JRUBY_HOME to the newer version I can use both versions. However setting JRUBY_HOME to the older version, RubyMine only recognises the older version, even when I navigate to the newer version's folder. That's a really weird behavior but I'll take it. I still remember that it worked properly in earlier versions of RubyMine though (I'm currently at 2017.2.4).

How to import the ruby flickr gem "Flickraw" into eclipse?

I'm totally new to Ruby but I'd like to use it for a small application I've in mind.
But I'm struggeling at the beginning: How can I use the library "flickraw" in order to access the flickr api within eclipse?
I've managed to update ruby to 1.9.3 but in eclipse I found only an older interpreter (1.8).
Could someone please tell me how I can show eclipse where ruby 1.9.3 is installed?
Beside of that, how can I use this flickraw library in eclipse? I only know how to import jar's for a java project but not how to do it for a ruby project :(
Could someone please tell me how I can import a external ruby library into eclipse?
Machine: Mac OS X Mountain Lion,
IDE: Eclipse Juno,
flickraw library: http://hanklords.github.com/flickraw/
many thanks!
You've probably already answered your question (being 6 months ago), but I answer this to help future generations of Eclipse Rubyists who come upon your question.
I assume you're using Eclipse RDT (Ruby Development Tools). I'm using Eclipse Juno (4.2.1) on Windows, but the menu items should be the same on any OS for similar versions of Eclipse.
To change or set your Eclipse Ruby interpreter:
Go to "Windows" > "Preferences"
Click the "Ruby" entry on the left pane of the "Preferences" window
Click the "Interpreter" subentry (also on the left pane)
Click the "Add" button
Click "Browse" by the Interpreter Executable text box
Now find your Ruby executable - I used RailsInstaller on Win7, so mine is in C:\RailsInstaller\Ruby1.9.3\bin
If you found a good executable, Eclipse should figure out the rest of the interpreter information itself
To import Ruby libraries into an Eclipse project: I'm not sure per se. This is what led me to your post. I thought I needed to import all my gems by hand. But when I used the gem installer ("./gem install targetgem") and restarted Eclipse, Eclipse was magically aware of the gems. (I'm not sure what dark magic allowed Eclipse to do that.)
Hope this helps future Rubyites.

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.

Code Completion with Ruby + Qt

I'm currently learning Qt programming with Ruby. Does anyone know an IDE that provides code completion for the Qt APIs when using Ruby?
I'm using NetBeans at the moment - I've set it up to use the standard Ruby interpreter as I didn't know how to get Qt working with JRuby - would getting this set up correctly solve my problem?
If you are using Linux, you can try KDevelop with the Ruby plugin. If there is one IDE supporting both Ruby and Qt, it's KDevelop.
If you are using Ubuntu, it is a bit of trouble because there is no .deb packages available for the Ruby plugin, you will have to build the plugin yourself.
There is some instructions to build the php plugin for Ubuntu here : http://milianw.de/blog/building-kdevplatform-kdevelop-and-the-php-plugin-from-svn. I suspect that the procedure should be almost the same for the ruby plugin.

Resources