开发者

How to distribute frozen binary gems with Ruby application (not Rails)

开发者 https://www.devze.com 2023-04-06 04:03 出处:网络
I wrote a bunch of Ruby scripts that integrate different tools to create a \"workflow for academics\". A number of my friends have been very interested in trying this out, however they are held back b

I wrote a bunch of Ruby scripts that integrate different tools to create a "workflow for academics". A number of my friends have been very interested in trying this out, however they are held back by how hard it is to install or replicate my environment.

Although Ruby comes built-in with Mac OSX (the applications I integrate are all Mac applications, so unfortunately the solution can only work on Mac), I use a few binary gems, including Appscript (bridge to AppleScript). The problem is that this requires XCode, which my non-programmer friends do not have installed (and it seems a bit demanding to ask them to instal开发者_运维知识库l 3GB of software to run a few kbs of code).

I tried freezing the gems by installing them with gem -i, into a subdirectory of the source (on github), and tried removing my entire central gems directory on my local computer - it worked fine, the scripts still ran, etc. However, when my friends tried running the scripts, they got error messages about missing library files etc.

So my two questions are: * how specific are compiled binary gems? will they work on other Mac OSX versions? with other versions of Ruby? etc * how can I find out exactly which binary files (located in central locations) a Ruby gem depends on, and package this with the source (and how do I tell the gem where to find these files in non-standard locations)

I know this might not be "standard procedure", and I should just package it as a gem and let my friends deal with the problems etc - but I'd really like to solve this, and I am sure there must be some way of doing this?

Thanks a lot


In my experience, compiled gems are not portable. They're dependent on the exact version of ruby and whatever other libraries they use. A better solution would be to have your friends install the "Command Line Tools" version of Xcode -- it's only 100-150 MB and includes everything you need to build gems (and other software). You'll need a (free) Apple Developer ID to download it though.

https://developer.apple.com/downloads?q=Command%20Line%20Tools

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号