Skip to content

Instantly share code, notes, and snippets.

@framallo
Created December 28, 2010 20:37
Show Gist options
  • Save framallo/757679 to your computer and use it in GitHub Desktop.
Save framallo/757679 to your computer and use it in GitHub Desktop.
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..39cbcef
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "frameworks/couchdb"]
+ path = frameworks/couchdb
+ url = git://github.com/devinus/sproutcore-couchdb.git
diff --git a/Buildfile b/Buildfile
index e16d7c1..ee1977d 100644
--- a/Buildfile
+++ b/Buildfile
@@ -4,6 +4,6 @@
# ===========================================================================
# Add initial buildfile information here
-config :all, :required => :sproutcore
+config :all, :required => [:sproutcore, :couchdb]
config :all, :theme => :osx
config :osx, :theme_name => 'osx'
diff --git a/README b/README
new file mode 100644
index 0000000..f8d3ab7
--- /dev/null
+++ b/README
@@ -0,0 +1,42 @@
+= Set up Development environment
+
+We need to set both couchdb and thin server for sc-server.
+Using nginx proxy we can set that up.
+
+to install nginx
+ sudo port install nginx
+
+you need to set up user and password for development user
+The nginx.conf is located in /opt/local/etc/nginx/nginx.conf
+
+Example config:
+
+ server {
+ listen 81;
+ server_name work_it.local;
+
+ proxy_buffers 8 16k;
+ proxy_buffer_size 32k;
+
+ location ^~ /workit {
+ proxy_pass http://127.0.0.1:5984/workit;
+ }
+ location / {
+ proxy_pass http://127.0.0.1:4020;
+ }
+ }
+
+
+To start nginx I use:
+ sudo port load nginx
+
+to start the development environment
+ sudo port load nginx
+ sc-server
+ open http://work_it.local:81/work_it
+
+In development mode the following urls apply:
+couchdb database
+ http://work_it.local:81/workit
+application url
+ http://work_it.local:81/work_it/
diff --git a/apps/work_it/core.js b/apps/work_it/core.js
index 7dfcae2..ec3f6c5 100644
--- a/apps/work_it/core.js
+++ b/apps/work_it/core.js
@@ -20,7 +20,7 @@ WorkIt = SC.Object.create(
// of your model data. You can also set a data source on this store to
// connect to a backend server. The default setup below connects the store
// to any fixtures you define.
- store: SC.Store.create().from(SC.Record.fixtures),
+ store: SC.Store.create().from('WorkIt.CouchDBDataSource'),
// TODO: Add global constants or singleton objects needed by your app here.
//doubleClickedTasks: function(sender) {
diff --git a/apps/work_it/data_sources/couchdb.js b/apps/work_it/data_sources/couchdb.js
new file mode 100644
index 0000000..9ecaf30
--- /dev/null
+++ b/apps/work_it/data_sources/couchdb.js
@@ -0,0 +1,18 @@
+// ==========================================================================
+// Project: WorkIt.CouchDBDataSource
+// Copyright: ©2010 My Company, Inc.
+// ==========================================================================
+/*globals WorkIt */
+
+/** @class
+
+ (Document Your Data Source Here)
+
+ @extends SC.DataSource
+*/
+WorkIt.CouchDBDataSource = CouchDB.DataSource.extend({
+ server: '',
+ database: 'workit',
+ designDoc: null,
+ view: '/_all_docs'
+});
diff --git a/frameworks/couchdb b/frameworks/couchdb
new file mode 160000
index 0000000..690c9a2
--- /dev/null
+++ b/frameworks/couchdb
@@ -0,0 +1 @@
+Subproject commit 690c9a239c183328a0a1ddceb63ec95a44821902
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment