Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Xcode 4 support ruby-on-rails?

Does Xcode 4 have support for rails projects? If so, to what extent?

UPDATE - Obviously it lets you edit text files. But does it give you any IDE features, e.g. syntax highlighting, navigation to declarations, code completion, etc... ?

like image 400
Simon Avatar asked Mar 11 '11 15:03

Simon


People also ask

Does Xcode support Ruby?

Apple's Xcode Command Line Tools provide a C language compiler. You'll need it to install Ruby. Also, for many Ruby projects, you will need the C language compiler to automatically install gems that use native extensions (some gems speed up Ruby by using code written in C).

Does Rails need Xcode?

Recent versions of Mac OS X have Ruby and Rails installed by default, but you will need to upgrade to version 2.1. 4 of Ruby and version 4.1. 7 of Rails. To get started, you will need to install XCode, but note that you will NOT be developing in XCode, you just need to have it installed.


2 Answers

In the past Xcode releases many were able to use the Xcode IDE for non-apple projects such as PHP, Rails, etc.

All you had to do was open Xcode organiser and drag your project in there and it worked. Not so with Xcode 4, but the feature has not been removed but in fact improved in my opinion.

In Xcode 4, click File > New > New Workspace.

Give it a name and once on the main editor window simply drag and drop your Rails, PHP, etc project onto the project navigator.

Then you can choose Editor > Syntax Coloring > [Any] for syntax highlighting.

M.

like image 143
pieterk Avatar answered Oct 04 '22 13:10

pieterk


I paid up to intall XCode 4 thinking that it would be simpler to consolidate all my development to a single IDE. XCode is the default because of the built in Mac API docs. I built a few MacRuby (0.10) samples, which parse and run.

Problems are:

  1. XCode insists on using // to comment lines, which then don't parse.
  2. There is no debugging for Ruby files, only for the Objective C wrapper stub.
  3. There is no in-app "run" for rack, rails or scripting type apps.
  4. The syntax parsing is limited to keywords, strings, comments and characters.
  5. XCode doesn't understand .erb or .yaml files are html and ruby.

There were workarounds for 1 and 5 in 3.2 for 1 and 5 but they no longer work with 4 as far as I can see.

On the plus side, the documentation interface to OSX and NextStep is very nice and MacRuby and the UI editor work well together and allow bundling desktop apps which can be distributed standalone or via the app store. I would use it to build ruby apps that use the desktop GUI.

For conventional web or scripting apps you can 'bare edit' rails projects in the 'Workspace' area and then skip to the terminal to run a server or use script/console to debug; but for this NetBeans is still far superior IMHO with in-code debugging and automated tests and workflow.

like image 45
PeeDee Avatar answered Oct 04 '22 13:10

PeeDee