Re: Anyone using TouchDB with RubyMotion?

189 views
Skip to first unread message

Jens Alfke

unread,
Nov 13, 2012, 7:46:22 PM11/13/12
to mobile-c...@googlegroups.com

On Nov 13, 2012, at 1:57 PM, Jim Rankin <jimb...@gmail.com> wrote:

Unfortunately, I have not been able to get the TouchDB CocoaPod to build with motion-cocoapods.

I wouldn’t recommend using CocoaPods to build TouchDB, because (a) last I heard only an old version of the source is pod-ified; (b) it’s a different build system from the projects in the repository; and (c) I’m generally skeptical of CocoaPods because it assumes you can dump a bunch of different library sources in a pile and try to compile them in a single target, which seems unlikely to me.

I recommend you download the compiled TouchDB 1.0 framework from Github and link it into your target instead.

—Jens

Jim Rankin

unread,
Nov 14, 2012, 8:33:48 AM11/14/12
to mobile-c...@googlegroups.com
Thanks for the response!  I actually downloaded the public-api branch and built the TouchDB.framework from that, which worked.

Here is how my Rakefile ended up (for anyone else considering using TouchDB with Ruby Motion):

# -*- coding: utf-8 -*-
$:.unshift("/Library/RubyMotion/lib")
require 'motion/project'

Motion::Project::App.setup do |app|
  # Use `rake config' to see complete project settings.
  app.name = 'TouchSourceTest'
  app.vendor_project('vendor/TouchDB.framework', :static,
                     :products => ['TouchDB'],
                     :headers_dir => 'Headers')
  app.libs += %w(/usr/lib/libz.dylib /usr/lib/libsqlite3.dylib)
  app.frameworks += %w(CFNetwork SystemConfiguration MobileCoreServices Security)
end

Now to try actually using TouchDB in my app! :)

Thanks again,
 -jim rankin

Jens Alfke

unread,
Nov 14, 2012, 2:50:55 PM11/14/12
to mobile-c...@googlegroups.com

On Nov 14, 2012, at 5:33 AM, Jim Rankin <jimb...@gmail.com> wrote:

Now to try actually using TouchDB in my app! :)

Cool! You’ll probably want to grab one of the Ruby CouchDB APIs, and point it at the root URL that TDServer gives you when it starts up. I believe the wiki has a snippet showing how to start up TDServer without going through CouchCocoa.

—Jens

Jens Alfke

unread,
Nov 19, 2012, 1:06:23 PM11/19/12
to mobile-c...@googlegroups.com

On Nov 18, 2012, at 5:07 PM, Naoya Makino <na...@goclio.com> wrote:

Hi Jim, thanks for sharing your rakefile with working version of properly linking touchdb with rubymotion. I am just curios why we did not have to include CouchCocoa framework to get touchdb working. 

Probably because Ruby is talking directly to the TouchDB REST API, instead of bridging to the Objective-C API provided by CouchCocoa.

—Jens

Naoya Makino

unread,
Nov 19, 2012, 7:58:04 PM11/19/12
to mobile-c...@googlegroups.com
I am facing a blocker trying to use touchdb with rubymotion, struggling with defining views and doing queries on them. I posted my questions on rubymotion group, but your feedback is very appreciated

Jens Alfke

unread,
Nov 19, 2012, 8:10:51 PM11/19/12
to mobile-c...@googlegroups.com

On Nov 19, 2012, at 4:58 PM, Naoya Makino <na...@goclio.com> wrote:

> I am facing a blocker trying to use touchdb with rubymotion, struggling with defining views and doing queries on them. I posted my questions on rubymotion group, but your feedback is very appreciated
> https://groups.google.com/d/msg/rubymotion/-95TxLK_GDE/4xgKBzLGSR8J

See the message earlier in the thread from ‘colinta’:

>> I was really curious about this one, and I asked around a little bit, but it turns out this is just currently not supported in RubyMotion.
>> But, that doesn't mean it's not possible in the future! Submit a support ticket, and that will put it on Laurent's radar.

‘This' refers to invoking an Objective-C block from Ruby. The problem is that the map block is passed a parameter called ‘emit’ that’s a block the map function needs to call. If you have a Ruby map function, you’re getting some kind of generic Ruby wrapper around the block, with no way to call it.

—Jens
Reply all
Reply to author
Forward
0 new messages