Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Ruby JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
app
autotest
config
doc/rdoc/generators
gems/cache
public
spec
tasks
.gitignore
Capfile
GNU-AGPL-3.0.txt
README
Rakefile
config.ru

README

AF83 // Comment-a-bit Mongo v 0.0.?

= COMMENT-A-BIT/MONGO

== WHAT IT IS

Comment-a-bit/Mongo is a small web-service oriented RESTful comment application written in Ruby. It's based on MongoDB <http://www.mongodb.org> and Merb <http://www.merbivore.com/>.

== WHAT'S ITS OBJECTIVE?

Its main purpose is to provide a lightweight JSON-based web-service platform that could be used to provide AF83 with a project-independent commenting system. 

The key features are:
  * schema-less documents (thanks to MongoDB)
  * lightweight
  * JSON-based
  * RESTful
  * easy replication (once again thanks to MongoDB)


== WHAT CAN IT DO AT THE MOMENT?

Actually, not that much right now ;-).

You can:
  * define configurations for your app - i.e. the comment attributes (typically: title, body, user_id, etc.)
  * list, show, create, update, destroy comments, RESTful-style (of course)
  * count and search (the search functionality being rather crude ATM)

Everything is JSON-based, there's no browser-friendly admin panel except for the configuration creation. So if you wanna play with it, fire up your cURL, boyzandgalz!


== HOW CAN IT BE USED?

Once the you have installed Comment-a-Bit/Mongo and fired up merb, you can browse to <http://localhost:4000/configurations/new> to set up a configuration for your application. You can then provide :
  * an application name 
  * up to 5 different fields (for instance: subject, body, tags, etc.)

When the form is submitted, a new app-specific configuration object will be created - which you can access usuing its hash-based id (e.g. c0a93b8a4a9bce190000005c). (You can view the configurations list in your browser at <http://localhost:4000/configurations/>)


Now that this new configuration (i.e. this new app) is defined, you can access its comment resources using a simple RESTful API. No HTML view is available for them, as this is designed to be used exclusively as a JSON web-service. 

For example (using dummy configuration_id and comment_id, yours will of course be different):
  * list comments: GET request to http://localhost:4000/configurations/[configuration_id]/comments
      (you can provide the classical "limit" and "offset" CGI-style parameters to get a subset of the list)
  * create a comment: POST request to http://localhost:4000/configurations/[configuration_id]/comments
  * view a comment: GET request to http://localhost:4000/configurations/[configuration_id]/comments/[comment_id]
  * update a comment: PUT request to http://localhost:4000/configurations/[configuration_id]/comments/[comment_id]
  * delete a comment: DELETE request to http://localhost:4000/configurations/[configuration_id]/comments/[comment_id]

You can also do a count and a search on comments:
  * count: GET http://localhost:4000/configurations/[configuration_id]/comments?count=true
  * search: GET http://localhost:4000/configurations/[configuration_id]/comments?search[subject]=stuff&limit=10&offset=2

(All these URLs are meant to be accessed programmatically, but you can also fire-up curl if you want to have a peek in a shell:
e.g. +curl -H 'Accept: application/json' 'http://localhost:4000/configurations/c0a93b8a4a9bce190000005c/comments/?search\[subject\]=stuff'+ - don't forget to properly escape the URL or the shell won't like it.)

== How Install Commentabit-Mongo ? ==

=== Dependencies ===

You need install a latest MongoDB stable version (1.0 when this readme is wrote)

 * RubyGems
 * Thor-0.9.9 (you can install it by : gem install thor -v=0.9.9)

=== Installation ===

 * Get all source from our repository or by download realease version
 * Put on your production server
 * Launch installation of all dependencies needed by Commentabit-Mongo
  * `thor merb:gem:redeploy`
  * `thor merb:gem:install`
 * You need configure your database.yml file where all information about your mongoDB environement are define.
  * create the config/database.yml by copying the sample file config/database.yml-sample

== Starting application ? ==

If you want, start by merb command line, you can see all information in help of ./bin/merb

If you want deploy with a Rackup file a config.ru is already ready. You can deploy this application in passenger easy.

= License =

Copyright (C) 2009 AF83

This program is free software: you can redistribute it and/or  modify
it under the terms of the GNU Affero General Public License, version 3,
as published by the Free Software Foundation.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
Something went wrong with that request. Please try again.