Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 public
Octocat-spinner-32 views
Octocat-spinner-32 GNU-AGPL-3.0.txt
Octocat-spinner-32 README
Octocat-spinner-32 app.rb
Octocat-spinner-32 app_conf.rb
Octocat-spinner-32 commentabit-config.yml.sample
Octocat-spinner-32 config.ru
Octocat-spinner-32 console
README
= AF83 // comment-a-bit (tokyotyrant)

== DESCRIPTION

comment-a-bit/tokyotyrant is a small web-service oriented RESTful comment application written in Ruby. It's based on TokyoTyrant <http://tokyocabinet.sourceforge.net/tyrantdoc/> and Sinatra <http://www.sinatrarb.com/>.

== FEATURES

 * CRUD
 * SEARCH
 * COUNT

== REQUIREMENTS

* ruby 1.8 or 1.9
* json
* sinatra
* libtokyocabinet8
* tokyotyrant

== INSTALL

# On Debian System
aptitude -t unstable install libtokyocabinet8 libtokyocabinet-dev
aptitude install ruby rubygems libbz2-dev zlib1g-dev build-essential

wget -c http://tokyocabinet.sourceforge.net/misc/tokyotyrant-1.1.24-rc1.tar.gz
tar zxvf tokyotyrant-1.1.24.tar.gz
cd tokyotyrant-1.1.24
./configure && make && make install

wget -c http://tokyocabinet.sourceforge.net/tyrantrubypkg/tokyotyrant-ruby-1.11.tar.gz
tar zxvf tokyotyrant-ruby-1.11.tar.gz
cd tokyotyrant-ruby-1.11
gem build tokyotyrant.gemspec
gem install tokyotyrant-1.11.gem

gem install sinatra json

# Launch tokyotyrant server
ttserver commentabit.tct
ttserver -port 1979 commentabit_conf.tct

== SYNOPSIS

# Launch sinatra instance
# you can edit commentabit-config.yml.sample
# and write to commentabit-config.yml
ruby app.rb
ruby app_conf.rb -p 4568

# add a conf to http://admin:secret@localhost:4568/

# Add some comment
# all new comment add a created_at field in rfc2822 format
curl -F 'comment[comment]=toto' -F 'comment[subject_id]=23' -F 'comment[user_id]=2323' http://localhost:4567/project

# Search
curl -X 'GET' -F 'search[subject_id]=23' http://localhost:4567/project

# Count
curl "http://localhost:4567/project?count=true"

# Get a comment from project with it's id
curl "http://localhost:4567/project/1"

# update a comment
# all update comment add a updated_at field in rfc2822 format
curl -X 'PUT' -F 'comment[subject_id]=34' -F 'comment[user_id]=2323' http://localhost:4567/project/1

# delete
curl -X 'DELETE' http://localhost:4567/project/1

== 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 as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

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.