• Stars
    star
    156
  • Rank 239,589 (Top 5 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 14 years ago
  • Updated over 12 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Sammy On Couch App

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.

More Repositories

1

sammy

Sammy is a tiny javascript framework built on top of jQuery, It's RESTful Evented Javascript.
JavaScript
2,990
star
2

resque-status

resque-status is an extension to the resque queue system that provides simple trackable jobs.
Ruby
519
star
3

magick

go (golang) wrapper around imagemagick
Go
209
star
4

vegas

Vegas aims to solve the simple problem of creating executable versions of Sinatra/Rack apps.
Ruby
184
star
5

swinger

Swinger is a couchapp for creating and showing presentations. Think Keynote, stored in CouchDB, run via Javascript and Sammy.js.
JavaScript
175
star
6

sinatra-gen

Rubigen based generator for new sinatra projects
Ruby
146
star
7

jim

jim is your friendly javascript library manager
JavaScript
94
star
8

static_model

ActiveRecord like functionalities for reading from YAML with a simple class implementation
Ruby
61
star
9

resque-metrics

Metrics for your Resque jobs and workers
Ruby
55
star
10

the_json_store

Code for the Sammy Tutorial series
JavaScript
53
star
11

gembox

A sinatra based interface for browsing and admiring your gems
JavaScript
50
star
12

node-logger

A simple logging library that combines the simple APIs of Ruby's logger.rb and browser-js console.log()
JavaScript
47
star
13

stackprof-remote

A Middleware and CLI for fetching and interacting with [StackProf](https://github.com/tmm1/stackprof) dumps.
Ruby
41
star
14

redisk

An interface to Redis that mimic's Ruby's IO classes
Ruby
34
star
15

qadmin

A RESTful resource module and generator
Ruby
28
star
16

restful_query

ActiveRecord extension for querying data in a restful way
Ruby
25
star
17

action

simple soca (couchapp) for managing tasks
JavaScript
21
star
18

basecamphp

PHP Wrapper for the 37 Signals Basecamp API
PHP
21
star
19

sammyjs-org

Sammyjs.org
JavaScript
20
star
20

sinatra-sammy

A Sinatra extension that turns a Sinatra app into a one page app using the teamwork of Sammy.
Ruby
17
star
21

columnlog

a work in progress
Ruby
17
star
22

minitest-display

Patches MiniTest to allow for an easily configurable output. For Ruby 1.9 :D
Ruby
15
star
23

sammy-pushstate

Simple example soca/sammy/couchapp using the Sammy HTML5 History support
JavaScript
12
star
24

downlow

Downloading files on the DL
Ruby
11
star
25

qadmin-demo

A demo Rails app showcasing the Qadmin gem
Ruby
11
star
26

objspace_viewer

WIP Sinatra/AR app to view/analyze heapdumps from Ruby's ObjectSpace.dump_all
Ruby
11
star
27

quirkey.github.com

My github home
JavaScript
10
star
28

is_porterable

A rails plugin for easily adding import/exportability from/to CSV
Ruby
8
star
29

jqunit-spec

Its like BDD for your JS
JavaScript
7
star
30

portfolio

Sinatra app that powers my portfolio
JavaScript
7
star
31

remix-stash

A new way to deal with memcached
Ruby
6
star
32

imanip

Super-quick image resizing using the ImageMagick command line tools
Ruby
6
star
33

sequel-web

Browse (almost) any SQL database with a web browser using the power of Sequel + Sinatra
JavaScript
5
star
34

jekyll_layouts

Layout files for jekyll, specifically for code.quirkey.com
4
star
35

oneforty

An entirely client-side twitter using sammy.js
JavaScript
4
star
36

halpers

General helpers for different projects
Ruby
4
star
37

quirkey_com

Source for quirkey.com
JavaScript
3
star
38

format_benchmark

Some simple benchmarks for a talk about serialization formats in Ruby
Ruby
3
star
39

lighthouse_stats

Some scripts to generate some SCRUMish stats from Lighthouse
Ruby
3
star
40

rails-boot-reporting

A hack to output times of different tasks in the rails (2) boot process
Ruby
3
star
41

ey-cloud-recipes

A starter repo for custom chef recipes on EY's cloud platform
Ruby
2
star
42

rapture.js

Demo soca/sammy app using pushState and storage for jsbbq
JavaScript
2
star
43

qcontent

Mixins and Modules for extending ActiveRecord content models
Ruby
2
star
44

purse

Simple secure password/data storage via Ruby and Git (In development)
Ruby
2
star
45

flashdance

Get your Rails flash[] out of your controllers and into a YAML
Ruby
2
star
46

quirkey_theme

My wordpress theme
JavaScript
2
star
47

sammy-presentations

Presentations about Sammy
1
star
48

redis-reqrep

Ruby
1
star