Project

soca

0.07
No commit activity in last 3 years
No release in over 3 years
There's a lot of open issues
soca is a different way of writing apps for CouchDB. The structure is up to you.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0

Runtime

~> 0.11
~> 0.3
~> 1.4.6
~> 1.16
~> 0.99
~> 0.15
~> 0.3.0
 Project Readme

soca

Sammy On Couch App or Sittin' On a Couch App

What?

A couchapp is method of creating applications that live inside CouchDB's design documents. This can be a simple as an index.html and as complicated as a full interactive JavaScript application. couchapp's inherently have a a bunch of really cool features - easy replication and synchronization, instant access to store and fetch data from CouchDB, and a full JS API. Sammy.js is a perfect fit for couchapps providing a simple programmable controller layer on top of CouchDB's data.

I highly recommend reading the section on couchapps in the CouchDB Book.

soca is a simple command line tool written in ruby for building and pushing couchapps. It is similar to and heavily inspired by the canonical couchapp python tool, couchapp, with a number of key differences.

  • local directories do not have to map 1-1 to the design docs directory
  • lifecycle hooks for easily adding or modifying the design document with ruby tools or plugins.
  • architected around using Sammy.js, instead of Evently, which is bundled with the python tool.
  • super tiny and hackable, with the hope that people will contribute patches and plugins.

Why?

I'm not one to start a language war, I think python is great and the existing couchapp tool works great for most situations. In fact I've built apps using it. I found myself working around the design documents structure, which makes sense when in JSON, but much less sense when mapped to the filesystem. By making a simple tool, that takes a JSON map of directories and files and places them in their expected JSON slot, you make a new sort of couchapp.

Unlike a traditional couchapp, a soca couchapp is actually one way - you're source directory is actually 'compiled' into its final state. This allows you to do things you couldnt before, including bundling js files, using external tools like compass, and just generally following your own preffered directory structure. This does mean that there is no soca clone to get a couchapp out of CouchDB - though replicating works the same as before (and is probably faster because you push only the docs you need or use).

The bottom line is I wanted to build couchapp's with a workflow and structure I had already established - soca lets me do that.

How?

soca is bundled as a ruby gem so installation is easy-peasy. On a system with ruby and ruby gems (OS X for example):

gem install soca

This will give you the soca bin as long as gems are in your path.

soca

Will display all the command options.

The typical workflow would be:

# Generate the app
soca generate myapp 
# cd into the app
cd myapp
# edit your .couchapprc with the db url
# Do your work, editing app.js, etc
# push the app to couchdb
soca push
# open the app in a browser
soca open

Once you get it set up, you can also use

soca autopush

Which will watch the directory and push your changes automagically.

TODO

  • Better Docs
  • More plugins
  • More generate options (compass scaffold, etc)
  • More example apps

Copyright/License

Copyright (c) 2010 Aaron Quint under the MIT License. See LICENSE for details.