Blog.

by Jon Crosby

Lift

Great news today! I am joining my long-time friend and colleague, Tony Stubblebine, to co-found a new company, Lift.

We’re working in a space we love — human potential — in a unique partnership with Obvious, founded by Evan Williams, Biz Stone, and Jason Goldman. There will be more to share in the coming months. If you’re interested, please let us know by signing up for the upcoming beta.

Snarl - A JavaScript Bridge for JRuby

If you would like to use JavaScript directly from Ruby, check out Snarl. I just pushed its first public release to Gemcutter. Snarl is JRuby-only, as it uses Mozilla’s Rhino JavaScript engine to do its work.

First, make sure you’re using Gemcutter:

gem install gemcutter
gem tumble

Then, install and use:

gem install snarl
irb
> context = Snarl::JavascriptContext.new
> context.eval(“1+1”) # => 2
> context.eval(“var increment = function(i) { return i+1 };”)
> context.eval(“increment(3)”) # => 4
> context.load(“/path/to/js/lib.js”) # allows use of lib.js
> context.put(“foo”, “bar”)
> context.get(“foo”) # => “bar”

Golden Gate Ruby Conference: CloudKit Video and Slides

In April of this year, I had the pleasure of presenting CloudKit at the first Golden Gate Ruby Conference here in San Francisco. The videos are now online thanks to Pivotal Labs. If you’re interested in CloudKit, REST, Discovery, or the Open Stack, please take a moment to check it out.

Slides are also available on SlideShare and a brief article on Composable REST Services is available in the wrap-up PDF.

CloudKit 0.11.2 Released

A patch release for CloudKit, version 0.11.2, has been released. This is a recommended upgrade for those using the 0.11.x series of gems.

From the release notes:

  • Added Location header for 201s
  • Fixed JSON response for DELETE operations
  • Updated MD5 dependency for Ruby 1.9 (Andreas Haller)
  • Updated spec setup for RSpec 1.2 (Andreas Haller)
  • Updated gem dependencies for Rack, OpenID, and JSON
  • Other minor fixes

The next planned release is 0.12 with JSONQuery support (already available client-side in the JQuery plugin). If you are interested in working on this, see the jsonquery branch on GitHub.

Thank you to everyone for the feedback and patches.

JSONQuery, New API in CloudKit jQuery Plugin

Upcoming  JSONQuery support was recently announced for CloudKit and there is now good news to share about the progress.

A No-Dependency JSONQuery Library for JavaScript

Thanks to Kris Zyp and Jason Smith, a no-dependency JavaScript library for JSONQuery is available on GitHub. I am maintaining my own fork of this library with bug fixes and a large set of tests. If you’ve been curious about JSONQuery but wanted some concrete examples of usage, there are now over 300 lines of tests and examples to browse on my GitHub fork.

JSONQuery in the CloudKit jQuery Plugin

The latest version of the jQuery plugin for CloudKit now supports JSONQuery and includes an improved API. The original version of the plugin used TaffyDB. While TaffyDB is a quality library, the promise of a standard querying mechanism for JSON via JSONQuery was too powerful to ignore.

jQuery.data Inside

Under the hood, jquery.cloudkit.js uses jQuery.data as its local in-browser store now that TaffyDB is no longer required. jQuery.data is nothing new, but for those unfamiliar, the quick summary is that it provides a key/value store that can be attached to any DOM element.

This is useful in the case of CloudKit where a top-level store for each resource collection is attached to the window element.

The New API

The basics of setting up your local in-browser database mapped to a CloudKit service are the same; you can still point the library at the metadata URL and it will configure and load itself. Each RESTful collection in CloudKit is still exposed as its own store. Beyond this, the API has been altered to provide a better interface, delegating work to the resources themselves instead of filtering all work through the outer collection. This new philosophy more closely matches that of CloudKit::Resource on the server.

Here are some examples from the README:

JSONQuery in CloudKit

On the server side, things are moving quickly thanks to Johnson, a JavaScript bridge for Ruby. Johnson vendors SpiderMonkey to perform its work which means the exact same query API that is available in your browser is also available in CloudKit. Interested hackers can build a current gem for Johnson and use it with the jsonquery branch of CloudKit on GitHub today. These updates will be merged into the master branch for the next release.

CloudKit 0.11.1 Released

CloudKit 0.11.1 has just been released. This is a maintenance update for the 0.11.x series of gems. It is a recommended upgrade, containing the following changes (pulled straight from the change log):

  • Added a block option for configuring OpenID bypassed routes (Devlin Daley)
  • Added write locks for Tokyo Tyrant Tables
  • Added Tokyo Tyrant Table example
  • Fixed POST method tunneling bug (Saimon Moore)
  • Fixed escaping of nested JSON Objects and Arrays

You can track CloudKit in these places:

Thanks to all who provided feedback and patches for this release.

Video for Rack Middleware Presentation Available

The Confreaks crew is lightning fast. The video from my Rack Middleware presentation at MountainWest is now available, just days after the event.

Rack Middleware Slides from MountainWest RubyConf 2009

MountainWest RubyConf was an incredibly good experience this year. There was a high signal-to-noise ratio with great speakers stacked up on both days. I consider myself the least of these speakers, but nevertheless have posted my slides for anyone who may be interested.

In a World of Middleware, Who Needs Monolithic Applications?

Some of the slides won’t convey all of the intended meaning without the audio, but that should be reconciled once Confreaks posts the videos on their site. I’ll link again when those appear for those who are interested.

Beyond the main conference track, the people in attendance really made the event special. There were many great conversations between talks and especially at the Engine Yard HackFest, which was amazingly good. At $100, the conference was a steal and one that I’ll never forget.

JSON Meets Tokyo Cabinet (and More!): CloudKit 0.11.0 Released

CloudKit 0.11.0 is out with exciting new features!

Tokyo Cabinet

CloudKit now supports Tokyo Cabinet as its storage system. If you haven’t checked out Tokyo Cabinet, take a moment to read Ilya Grigorik’s overview or check out its main site. You will find it to be an extremely fast and compelling storage system.

While Tokyo Cabinet is impressive, it comes with the cost of a binary dependency. Although it took only a moment to install it on my Mac using John Mettraux’s simple instructions, I didn’t want to sacrifice CloudKit’s install-and-go development experience. So, I added a pure Ruby store that mimics the Tokyo Table API (as exposed to CloudKit via Rufus::Tokyo). This is the default store used by CloudKit until you specify otherwise. See the README for an example of using the native Tokyo Table backend when you’re ready.

Making the switch to Tokyo Cabinet paves the way for the final significant piece of CloudKit’s architecture — JSONQuery support. With super-fast storage, a discoverable API, built-in Open Web auth (using OpenID and OAuth), and fully searchable data with JSONQuery, CloudKit will cover a wide range of use cases. Not only this, but it fits in the Rack stack, so it can be used alongside your other favorite frameworks and middleware.

CloudKit::Resource

Unsatisfied with “alongside,” CloudKit has made the move to “inside” too. Prior to this release, the only interface to CloudKit was through its HTTP/REST web service. With the 0.11 release, you can also use it in a manner similar to DataMapper or ActiveRecord with one small difference; instead of having to map arbitrary models to SQL, CloudKit provides a single Resource model that represents a JSON document and all of its metadata (URI, ETag, Last-Modified date, etc.). There are more details in the CloudKit docs, but here are a few examples:

JQuery Plugin

Still early in development, a working jQuery plugin is available for CloudKit. The plugin provides an in-browser queryable JSON database that automatically loads and configures itself using the metadata provided by CloudKit. For every resource collection you are hosting with CloudKit, the plugin will expose a local mirror that amounts to a queryable JSON array (implemented using TaffyDB patched for asynchronous operation). Updating your local data is simple and is synchronized with the matching web service automatically.

Here are some examples from the README:

Clouder: A Ruby API for CloudKit

For across-the-network access to CloudKit using Ruby, Demetrius Nunes has put together a library called Clouder. This use case matches the way many are using CouchDB as an ORM backend. If you’re interested in using CloudKit in this manner, be sure to fork Demetrius’s project on GitHub and contribute.

IRC

Beyond the existing site, GitHub repository, Twitter, and mailing list, there is now #cloudkit on Freenode for interested hackers. Feel free to drop in and participate in the next release or ask questions about using CloudKit in your own projects.

CloudKit 0.10.1 Released

A new 0.10.1 CloudKit gem has been released. This is the first release with patches from the growing community on GitHub. As always, a big thank you to everyone who sent feedback or code.

To install:

gem install cloudkit

To update:

gem update cloudkit

From the change log:

  • Updated oauth and sequel gem dependencies
  • Fixed 410 responses for stale PUT operations
  • Fixed MySQL content encoding (Harry Weppner)
  • Various fixes for filter_merge!, rekey!, and excluding (Cameron Walters)

You can track CloudKit in these places: