[MacRuby-devel] Using Gems in MacRuby
Hi Everyone, I have searched the web but have not found a good explanation on how to use gems in a MacRuby project. Is there a tutorial I am missing? Thanks, Craig ___ MacRuby-devel mailing list [email protected] http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
Re: [MacRuby-devel] Using Gems in MacRuby
On Oct 15, 2009, at 8:55 PM, s.ross wrote: On Oct 15, 2009, at 6:10 PM, Conrad Taylor wrote: On Thu, Oct 15, 2009 at 5:03 PM, s.ross wrote: On Oct 15, 2009, at 1:43 PM, Laurent Sansonetti wrote: Hi Craig, On Oct 14, 2009, at 7:07 PM, Craig Williams wrote: Hi Everyone, I have searched the web but have not found a good explanation on how to use gems in a MacRuby project. Is there a tutorial I am missing? We should definitely write a tutorial about that. The RubyGems support is pretty new so I don't think anybody tried yet to embed gems in a MacRuby app. At a glance I believe it would be a matter of installing the gem inside MacRuby.framework, embed it in the app then change the GEM_HOME environment variable. Laurent Oof. Changing the framework? Maybe I'm not understanding what you're suggesting. Why would it not be enough to install all gems in a vendor/ directory and change GEM_HOME to there? Or something that would not involve embedding (eventually) all gems in use in all apps you're developing inside the MacRuby.framework... Steve Steve, you should be able to install the gem(s) and require them in the relevant file(s). You shouldn't have to unpack the gem(s) into a vendor directory because they should be visible to the Ruby environment after you require it. -Conrad Conrad-- I guess I'm thinking of a case where you didn't want to rely on a particular gem being present on a target machine -- say for an app you were distributing. Naturally, the GEM_HOME built into MacRuby is just fine on *my* machine. But, if I give the app to someone else who may not have a particular gem installed, boom! Steve Any examples on how to do this? I get an error that it failed to load ~/.gemrc during build. Craig___ MacRuby-devel mailing list [email protected] http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
Re: [MacRuby-devel] Using Gems in MacRuby
Hi Everyone,
I am still not understanding how to include gems in my MacRuby
project. From what has been discussed, I "unpacked"
the gem and included it in the project in "Vendor/gems."
I am using this in the rb_main.rb file, but it is resulting in 2180
errors.
Dir.glob(File.expand_path("#{NSBundle.mainBundle.resourcePath}/vendor/
gems/*", __FILE__)).each do |gem|
$:.unshift File.join(gem, 'lib')
end
I know this must be very simple but I am not getting it. I write Ruby
scripts nearly every day but I all of my development
experience is with Objective-C. I would really appreciate a small
example of how to accomplish this.
Thanks,
Craig
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
[MacRuby-devel] How to get elements from Boxed object
This works in Objective-C but in MacRuby I cannot find a way to access the
properties of the Boxed object that is returned by loc.coordinate in the code
below.
Thanks,
Craig
MacRuby Version 0.7 -> pulled today
OS -> 10.6.3
Objective-C version:
CLLocation *loc = [[CLLocation alloc] initWithLatitude:38.0 longitude:-122.0];
NSLog(@"Lat: %.2f", loc.coordinate.latitude);
NSLog(@"Long: %.2f", loc.coordinate.longitude);
[loc release];
// Result:
// 2010-04-30 16:48:55.568 OCCoreLocationTest[70030:a0f] Lat: 38.00
// 2010-04-30 16:48:55.570 OCCoreLocationTest[70030:a0f] Long: -122.00
The loc.coordinate is a CLLocationCoordinate2D struct.
typedef struct {
CLLocationDegrees latitude;
CLLocationDegrees longitude;
} CLLocationCoordinate2D;
MacRuby version:
framework 'corelocation'
loc = CLLocation.alloc.initWithLatitude(38.0, longitude:-122.0)
# => #
puts loc.class
# => CLLocation
puts loc.description
# => <+38., -122.> +/- 0.00m (speed -1.00 mps / course -1.00) @
2010-04-30 16:37:47 -0600
puts loc.horizontalAccuracy
# => 0.0
puts loc.verticalAccuracy
# => -1.0
puts loc.timestamp
# => #<__NSCFDate:0x20005ff40>
puts loc.coordinate
# => #
puts loc.altitude
# => 0.0
puts loc.coordinate.longitude
# => Error:in `': undefined method `longitude' for #
(NoMethodError)
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
Re: [MacRuby-devel] How to get elements from Boxed object
Than you Laurent,
I have been searching all over for Boxed but not CLLocation.
btw, is there a projected timeframe when MacRuby will be OSA compliant?
No rush, just wondering. ;)
Regards,
Craig
On May 2, 2010, at 3:14 PM, Laurent Sansonetti wrote:
> Hi Craig,
>
> I believe you're hitting http://www.macruby.org/trac/ticket/641
>
> Laurent
>
> On May 2, 2010, at 11:48 AM, Craig Williams wrote:
>
>> This works in Objective-C but in MacRuby I cannot find a way to access the
>> properties of the Boxed object that is returned by loc.coordinate in the
>> code below.
>>
>> Thanks,
>>
>> Craig
>>
>>
>> MacRuby Version 0.7 -> pulled today
>>
>> OS -> 10.6.3
>>
>>
>> Objective-C version:
>> CLLocation *loc = [[CLLocation alloc] initWithLatitude:38.0
>> longitude:-122.0];
>> NSLog(@"Lat: %.2f", loc.coordinate.latitude);
>> NSLog(@"Long: %.2f", loc.coordinate.longitude);
>> [loc release];
>>
>> // Result:
>> // 2010-04-30 16:48:55.568 OCCoreLocationTest[70030:a0f] Lat: 38.00
>> // 2010-04-30 16:48:55.570 OCCoreLocationTest[70030:a0f] Long: -122.00
>>
>> The loc.coordinate is a CLLocationCoordinate2D struct.
>>
>> typedef struct {
>> CLLocationDegrees latitude;
>> CLLocationDegrees longitude;
>> } CLLocationCoordinate2D;
>>
>>
>> MacRuby version:
>> framework 'corelocation'
>>
>> loc = CLLocation.alloc.initWithLatitude(38.0, longitude:-122.0)
>> # => #
>>
>> puts loc.class
>> # => CLLocation
>> puts loc.description
>> # => <+38., -122.> +/- 0.00m (speed -1.00 mps / course
>> -1.00) @ 2010-04-30 16:37:47 -0600
>> puts loc.horizontalAccuracy
>> # => 0.0
>> puts loc.verticalAccuracy
>> # => -1.0
>> puts loc.timestamp
>> # => #<__NSCFDate:0x20005ff40>
>> puts loc.coordinate
>> # => #
>> puts loc.altitude
>> # => 0.0
>> puts loc.coordinate.longitude
>> # => Error:in `': undefined method `longitude' for
>> # (NoMethodError)
>>
>>
>>
>>
>>
>>
>> ___
>> MacRuby-devel mailing list
>> [email protected]
>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
> ___
> MacRuby-devel mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
Re: [MacRuby-devel] DictionaryServices
Hi ecin,
This appears to be working.
framework
'/System/Library/Frameworks/CoreServices.framework/Frameworks/DictionaryServices.framework'
word = 'History'
word_len = DCSGetTermRangeInString(nil, word, 0);
res= DCSCopyTextDefinition(nil, word, word_len)
puts "Definition for: #{word}"
puts res
hth,
Craig
On May 23, 2010, at 10:02 AM, ecin wrote:
> I'd like to use Dictionary Services
> (http://developer.apple.com/mac/library/documentation/UserExperience/Reference/DictionaryServicesRef)
> to look up definitions in a MacRuby app, but am having a hard time figuring
> out exactly what I need to require in order to access its functions, as
>
> framework 'Cocoa'
> framework 'CoreServices'
>
> doesn't do the trick. Is this another example of missing bridge support, or
> am I missing something else?
> ___
> MacRuby-devel mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
[MacRuby-devel] Using Sequel and Sqlite3
I have built an app to quickly find MacVim commands to help me learn MacVim. The app works great on my machine but when I try to use it on another machine I get Sqlite3 errors. I am embedding MacRuby in the project and have tried vendoring Sqlite3 and Sequel as well. Embedding the gems did not fix the problem. I have put the project on GitHub if anyone wants to take a look at it. https://github.com/CraigWilliams/MVimLookup Thanks, Craig Williams Applications Developer Factory Design Labs t / 303.573.9100 x417 w / factorylabs.com F/ ___ MacRuby-devel mailing list [email protected] http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
Re: [MacRuby-devel] [ANN] Launch: Redwood - Spotlight for the cloud
Very nice! > On 1 Aug 2011, at 18:07, Derek Haynes wrote: > >> Redwood is a "Spotlight for the cloud" -- it searches Basecamp, Gmail, >> Google Docs, and Pivotal Tracker from one search bar on your desktop. >> You can download Redwood from our homepage: >> >> http://redwoodapp.com >> >> We've loved developing the app with MacRuby. Details on the technical guts: >> >> * MacRuby 0.10, embedded in the application bundle >> * Originally we used the Nokogiri and GData gems. However, we dropped >> these as the load time took several seconds during the application >> launch. A likely cause: gems are not compiled like the application >> code. The performance during application usage was fine. >> * Several Obj-C libraries: Sqlite3 and FMDB for database, >> ASIHTTPRequest for HTTP, Sparkle for auto-update, SBJson, and CocoaFob >> + Potion Store (a Rails app) for licensing. >> * Search results are rendered in HTML/CSS, and events are passed back >> and forth between an embedded Webview and Cocoa >> >> We'll provide a richer overview of our experience w/MacRuby in a >> couple of weeks on our blog. >> >> Give the full-featured trial a whirl and let me know how it goes: >> http://redwoodapp.com >> >> Cheers, >> >> Derek >> ___ >> MacRuby-devel mailing list >> [email protected] >> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel > > ___ > MacRuby-devel mailing list > [email protected] > http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel ___ MacRuby-devel mailing list [email protected] http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
