Code Completion with Ruby + Qt - ruby

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.

Related

Adding an interpreter to RubyMine

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.

Ruby 1.8.5 is missing thread extension?

I am trying to compile Ruby 1.8.5 on my Mac (yes, I need this specific version), but am having trouble getting the standard C extensions to work. All the Ruby 1.8.5 sources I get from here don't include ext/thread sources, so I can't compile the thread.bundle extension. However, several .rb files in Ruby require this extension, so I'm a bit confused how anyone has compiled 1.8.5 Ruby on Mac before.
Does anyone know if there are precompiled archived versions of Ruby out there where I could find this? Or does anyone know why the thread extension is missing from all the 1.8.5 downloads I find? It's present in 1.8.6.
Why are you compiling Ruby? From what I can tell in the SketchUp developer docs -- and I could be wrong -- SketchUp already contains its own Ruby interpreter. Or perhaps it uses the system Ruby, at least on Mac OS (the docs are ambiguous). Either way, I don't think you need to do what you're doing...

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.

CoffeeScript on Windows?

How can I try CoffeeScript on Windows?
The installation instructions are only for *nix: http://jashkenas.github.com/coffee-script/#installation
EDIT:
Since I asked this a while ago, many new answers have appeared. The number ( and quality ) of options for Windows users has been increased a lot. I "accepted" an answer a long time ago, then changed to other ( better ) answers as they came up, but I have now decided to not accept any answer, and let the community ( votes ) show which answers are best. Thanks to everyone for the input.
UPDATE: See my other answer to this question, How can I compile CoffeeScript from .NET? for a far more accurate and up-to-date list of the current options.
CoffeeScript-Compiler-for-Windows works well.
Maybe it was more complicated when this question was posted. But as of 2012, CoffeeScript is as easy to use on any platform. The instructions are the same for Windows, Mac, or Linux
Install Nodejs from http://nodejs.org/
Install CoffeeScript globally with the node package manager npm install -g coffeescript or locally npm install --save-dev coffeescript
Write a script in your favourite text editor. Save it, say as hello.coffee
Run your script coffee hello.coffee or compile it coffee -c hello.coffee (to hello.js)
Node.js runs on Cygwin these days, so that's probably your best bet with getting CoffeeScript running on Windows. I'd try that first.
If you have a different preferred JavaScript runtime, you can probably use the prebuilt-compiler (extras/coffee-script.js). For example, if you include that script on a webpage, you can call
CoffeeScript.compile(code);
... to get back the compiled JavaScript string.
UPDATE 2012-04-12: Cygwin is no longer needed to run Node on Windows. Microsoft
worked with Joyent through 2H 2011 to improve node's support for
Windows IOCP async IO. Node 0.6 was the first release of node to
natively support Windows.
You can run the CoffeeScript compiler under good old Window Script Host (cscript.exe), a standard component on Windows since Windows 98. Admittedly I tried this a while back and it didn't work, but I tried again recently and now all the standard CoffeeScript tests compile just fine.
A bit of plumbing code using a *.wsf file and coffee-script.js is all you need. My code is on GitHub: https://github.com/duncansmart/coffeescript-windows
I blogged about it here: http://blog.dotsmart.net/2011/06/20/the-simplest-way-to-compile-coffeescript-on-windows/
You can use jcoffeescript as a command-line solution.
It uses a Java-based javascript engine (Rhino) and wraps up the task of compiling coffee-script.js from the CoffeeScript project. This allows it to run the CoffeeScript compiler as a Java program.
The command to use (on Windows/Linux) looks like this:
java -jar jcoffeescript-1.0.jar < foo.coffee > foo.js
You will need to download & build the Java source code (use IntelliJ Community Edition to avoid downloading Ant) or a pre-built download for CoffeeScript v1.0.
I now use jcoffeescript in place of the Ruby solution (another answer here), because this allows me to keep up with the latest CoffeeScript version.
You can use a command-line version of CoffeeScript by installing Ruby on Windows and then installing the CoffeeScript Gem.
After that, the command-line is available, for example, 'coffee bla.coffee' - to compile your CoffeeScript code down to JavaScript code.
The only disadvantage doing it this way (not using Node.js) is that the Ruby version of CoffeeScript is restricted to version 0.3.2 - the last version written in Ruby before it was moved over to Node.js.
*However, I still use the Ruby version of CoffeeScript in my current employment and my personal web page and I don't see much of a problem as this version of CoffeeScript is quite mature and most of the features listed on the CoffeeScript website can be used.
*striked out this last statement which was correct at the time but is becoming more incorrect every few days; CoffeeScript has now advanced a long way since 0.3.2 and is past 1.1
There're already bunch of answers here, but let me add mine. I wrote a .NET library for compiling CoffeeScript on Windows.
As jashkenas suggested, I've used the pre-compiled extras/coffee-script.js file.
Together with the Jurassic JavaScript compiler I've wrapped it all up in a single library: CoffeeSharp
The library also ships with a commandline tool and a HttpHandler for ASP.NET web development.
I've used this one: https://bitbucket.org/maly/coffeescript-win/zealots
looks working well, althouth you need to manually need to update coffee.script from 0.95 to 1.0.1.
Since node.js is now ported to Windows, this is actually pretty easy:
http://www.colourcoding.net/blog/archive/2011/09/20/using-coffeescript-on-windows.aspx
If you want to use CoffeeScript in an ASP.NET application then you can use this HTTP handler to serve compiled CoffeeScript code.
I haven't tried this myself yet, but it seems to be an answer. (I've downloaded and installed but not used it yet.)
There's an add-in for Visual Studio 2010 that adds CoffeeScript editing to VS (among other things).
It's called Web Workbench and is downloaded as a vsix. (i.e. can be downloaded from within the VS UI.)
I'm only putting this in only as an answer to the more general implied question for "How can I try" tools that don't normally run on Windows or have yet to be ported. Use a virtual machine running a UNIX-like OS such as Linux or BSD.
Provided you have enough RAM and are willing to learn enough to get around, it will make trying open source software a lot easier. In the CoffeeScript case you can still do things like --watch on a shared folder and remain in Windows land most of the time. You also won't pollute your system with tools and services you try and don't buy into, which is handy if you do that a lot.
Consider using Chocolatey to install http://chocolatey.org/packages/CoffeeScript on Windows.
(Installing Chocolatey : https://github.com/chocolatey/chocolatey/wiki/Installation)

Can Ruby + Crate + Windows work?

I've got a project for work I'd like to do in Ruby that will have to run on Windows, but perturbing the filesystem for a Ruby install or RubyScript2Exe unpack isn't an option (this is supposed to be the harness for a testing system). Has anyone successfully used Crate to package up something on Windows? If so, what was your build environment like and can you pass on any other hints?
I've tried and worked in getting Crate work under Windows, but is a more complicated system than I would expect.
If extraction of code for your system is your problem. I recommend take a look to Exerb, and specially: exerb-mingw hosted on GitHub exerb-mingw
It will generate a single executable like Ocra or RubyScript2Exe, but with the difference that the source code will not be extracted and extensions will be dynamically loaded.
This works perfectly with RubyInstaller packages, and is being used with Pik (Ruby version manager for Windows).
Hope this helps.
You can embed a Ruby interpreter and script into a C program, which may be easier than trying to run Crate. Here are some helpful links that describe how to do this, and may provide enough sample code to use as a skeleton for what you are trying to build.

Resources