How to bundle a ruby package into an [Objective-C] cocoa application? -


I'm trying to explain that in the Ruby () execution of the Cocoa app (Objective-C, Ruby Coco) To do (ok through NSTask, unless there is no easy way to pull ObjC; -> Coco whom I do not know).

Sass package is something you need to use "gem install" or "rake install", doing so puts tons of files in my ~ / .gem directory I want someone to be able to execute this device from within my app to my coco-based application, so I want the user to go through the installation of anything extra, so I'm hoping to be able My ai Package resource directory I need to add anything.

However, the interior and ruby ​​are not familiar with the structure of (sorry, I'm having trouble keeping the objesky / cocoa in my head!) , this is not clear to me Which of the 1,444 files installed in ~ / .gem directory (yes, I have counted) I need to embed the application and what I might have to do to obtain a directory reference e.t.c.

If someone has any experience in embedding Ruby Tools in the Cocoa app, then I really appreciate your input. I did not expect it to be very difficult, that Ruby is installed on Mac OS X ... but apparently this package (usually? Atipically?) Is more than just a script file

You can install gems in a particular place:

 < Code> GEM_HOME = path / in / your / project / gem gem installed sass  

Again, as part of your build process, folder your resources To switch to copy. Find your gem folder when you want to run a saas. Call Ruby to:

  NSString * gems_path = ...; NSTK * Task = [[NSTK Elok] Init]; // You want to copy NSProcessInfo.processInfo.environment and modify the job instead. Environment = @ {@ "GEM_HOME": gems_path}; Task.launchPath = @ "/ usr / bin / ruby"; Work.arguments = @ [[James-Path Stringbying Path: @ [@ "Bin", @ "Saas"], @ "Leisure", @ "Off", @ "Your", @ "Logic"]; // Add Handling for I / O [Work Launch];  

(typed in gitub, wrong mistakes can occur)

Note that you can prevent compatibility issues by using Ruby as well (probably MacroB) want to bundle. If not, make sure that you test all versions of OS X which you support, especially 10.9, because Ruby was upgraded to 2.0.


Comments