[MacRuby-devel] Gems again; signing records

Martin Hawkins martin.hawkins at gmail.com
Fri Jan 28 10:49:48 PST 2011


Well, I've just realised that get the fileutils message was in fact a
sign of some success, as the UUID gem does indeed require it.
I'll play around a little more with gem loading - I've got to get it
right for other projects. I was doing what you suggested but without
apparent success.

wrt CFUUID, that's helpful and I'll look at that. I was just looking
at NSProcessInfo, which has a globallyUniqueString method.

On Jan 28, 6:25 pm, Joshua Ballanco <jball... at gmail.com> wrote:
> On Fri, Jan 28, 2011 at 12:41 PM, Martin Hawkins
> <martin.hawk... at gmail.com>wrote:
>
> > In rb_main.rb
>
> > $:.unshift  File.join(File.dirname(__FILE__), 'Vendor/uuid-2.3.1/lib')
> > $:.unshift  File.join(File.dirname(__FILE__), 'Vendor/macaddr-1.0.0/
> > lib')
>
> > require 'macaddr'
> > require 'uuid'
>
> > However, when I try to require 'macaddr' or 'uuid' from another class
> > definition file, I get 'no such file to load'.
>
> Two things:
>
> -- You should only have to require these files once, unless you expect the
> other class definitions to be used independently of your main project.
> Putting these in rb_main.rb is typically a good idea.
> -- This might be obvious, but just in case: the "File.join(File.dirname..."
> patern will only work in rb_main.rb or any other file in the same directory.
> If you've put your class definition files in lib/ then you'll need to change
> the relative path.
>
> > 1. What is the *proper* way of incorporating gems into a MacRuby
> > project using XCode to build and run; and
>
> Typically, when you unpack a gem it will have a structure like:
>
> /foo_gem-1.0/lib
> /foo_gem-1.0/lib/foo_gem.rb
> /foo_gem-1.0/lib/foo_gem/library_files.rb
>
> In other words, usually the "lib" directory is already partitioned by gem
> name inside the gem. So, what I do is to just collect all the contents of
> the "lib" directories for all the gems and put them together (either
> directly in my own lib/ or in vendor/lib/). There's no reason for the extra
> directories...just adds complexity.
>
> > 2. All I want to do is sign records for later comparison. Can anybody
> > suggest an alternative method, other than using UUID?
>
> In MacRuby you can use the CFUUID utilities:http://developer.apple.com/library/mac/#documentation/CoreFoundation/...
>
> > macirb
>
> irb(main):001:0> framework 'Foundation'
> => true
> irb(main):002:0> cfuuid = CFUUIDCreate(nil)
> => #<__NSCFType:0x200f6dd60>
> irb(main):003:0> id = CFUUIDCreateString(nil, cfuuid)
> => "689369A5-5CCD-41D0-BF83-1759BFD4F3EA"
> irb(main):004:0> CFRelease(cfuuid)
> => nil
>
> _______________________________________________
> MacRuby-devel mailing list
> MacRuby-de... at lists.macosforge.orghttp://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


More information about the MacRuby-devel mailing list