iosrubyrubygemsrubymotionkindle

Can I use kindle-highlights gem with RubyMotion


I'm trying to use kindle-highlights gem in RubyMotion. I found motion-bundler, that should help me bring these two together.

According to FAQ from motion-bundler, not every gem will work.

Can I use every random Ruby gem available?

Unfortunately, no. You can only use Ruby gems which do not require libraries (e.g. psych.bundle) and do not use string evaluation at runtime (for instance using class_eval with a String).

If I'm trying to use kindle-higlights I get the uninitialized constant error:

(main)> 2017-02-14 10:13:41.606 HelloMotion[60710:1987881] app_delegate.rb:26:in `application:didFinishLaunchingWithOptions:': uninitialized constant AppDelegate::KindleHighlights (NameError) 2017-02-14 10:13:41.610 HelloMotion[60710:1987881] *** Terminating app due to uncaught exception 'NameError', reason: 'app_delegate.rb:26:in `application:didFinishLaunchingWithOptions:': uninitialized constant AppDelegate::KindleHighlights (NameError)

So what i want to know is:


Solution

  • Couple of things:

    motion-bundler is still a useful library and should help but the gem you want says it required Ruby 2.1.0, so I don't think it will work. If you want to try to make a gem RubyMotion compatible (without motion-bundler) you can try following this tutorial http://blog.motioninmotion.tv/gems-for-ruby-or-rubymotion/