From owner-svn-ports-head@FreeBSD.ORG Wed Feb 26 17:15:04 2014 Return-Path: Delivered-To: svn-ports-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5F0CFFF7; Wed, 26 Feb 2014 17:15:04 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 48C7D119F; Wed, 26 Feb 2014 17:15:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s1QHF4TL010974; Wed, 26 Feb 2014 17:15:04 GMT (envelope-from zi@svn.freebsd.org) Received: (from zi@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s1QHF3Te010965; Wed, 26 Feb 2014 17:15:03 GMT (envelope-from zi@svn.freebsd.org) Message-Id: <201402261715.s1QHF3Te010965@svn.freebsd.org> From: Ryan Steinmetz Date: Wed, 26 Feb 2014 17:15:03 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r346216 - in head/devel: . go-json-rest go-json-rest/files X-SVN-Group: ports-head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the ports tree for head List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Feb 2014 17:15:04 -0000 Author: zi Date: Wed Feb 26 17:15:02 2014 New Revision: 346216 URL: http://svnweb.freebsd.org/changeset/ports/346216 QAT: https://qat.redports.org/buildarchive/r346216/ Log: New port: devel/go-rest-json: Go-Json-Rest is a thin layer on top of net/http that helps building RESTful JSON APIs easily. It provides fast URL routing using a Trie based implementation, and helpers to deal with JSON requests and responses. It is not a high-level REST framework that transparently maps HTTP requests to procedure calls, on the opposite, you constantly have access to the underlying net/http objects. WWW: https://github.com/ant0ine/go-json-rest/ Added: head/devel/go-json-rest/ head/devel/go-json-rest/Makefile (contents, props changed) head/devel/go-json-rest/distinfo (contents, props changed) head/devel/go-json-rest/files/ head/devel/go-json-rest/files/patch-request.go (contents, props changed) head/devel/go-json-rest/pkg-descr (contents, props changed) head/devel/go-json-rest/pkg-plist (contents, props changed) Modified: head/devel/Makefile Modified: head/devel/Makefile ============================================================================== --- head/devel/Makefile Wed Feb 26 17:04:47 2014 (r346215) +++ head/devel/Makefile Wed Feb 26 17:15:02 2014 (r346216) @@ -589,6 +589,7 @@ SUBDIR += gnulibiberty SUBDIR += gnustep SUBDIR += gnustep-make + SUBDIR += go-json-rest SUBDIR += go-pretty SUBDIR += go-sql-driver SUBDIR += gob2 Added: head/devel/go-json-rest/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/devel/go-json-rest/Makefile Wed Feb 26 17:15:02 2014 (r346216) @@ -0,0 +1,18 @@ +# Created by: Ryan Steinmetz +# $FreeBSD$ + +PORTNAME= go-json-rest +PORTVERSION= 20140226 +CATEGORIES= devel +MASTER_SITES= LOCAL/zi/ \ + http://mirrors.rit.edu/zi/ + +MAINTAINER= lattera@gmail.com +COMMENT= Quick and easy way to setup a RESTful JSON API + +GO_PKGNAME= github.com/ant0ine/go-json-rest +WRKSRC= ${WRKDIR}/${PORTNAME}-master + +.include +.include "${PORTSDIR}/lang/go/files/bsd.go.mk" +.include Added: head/devel/go-json-rest/distinfo ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/devel/go-json-rest/distinfo Wed Feb 26 17:15:02 2014 (r346216) @@ -0,0 +1,2 @@ +SHA256 (go-json-rest-20140226.tar.gz) = b2d04af83c7c6c6819e5d6518b1a8c4b3a25c744ee917194ba4e7255f424e5f0 +SIZE (go-json-rest-20140226.tar.gz) = 16373 Added: head/devel/go-json-rest/files/patch-request.go ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/devel/go-json-rest/files/patch-request.go Wed Feb 26 17:15:02 2014 (r346216) @@ -0,0 +1,39 @@ +--- ./request.go.orig 2014-02-25 00:55:56.000000000 -0500 ++++ ./request.go 2014-02-26 11:51:45.000000000 -0500 +@@ -15,19 +15,34 @@ + PathParams map[string]string + } + ++func CToGoString(c []byte) string { ++ n := -1 ++ for i, b := range c { ++ if b == 0 { ++ break ++ } ++ n = i ++ } ++ return string(c[:n+1]) ++} ++ + // Provide a convenient access to the PathParams map + func (self *Request) PathParam(name string) string { + return self.PathParams[name] + } + + // Read the request body and decode the JSON using json.Unmarshal +-func (self *Request) DecodeJsonPayload(v interface{}) error { ++func (self *Request) DecodeJsonPayload(v interface{}, decodeBody bool) error { + content, err := ioutil.ReadAll(self.Body) + self.Body.Close() + if err != nil { + return err + } +- err = json.Unmarshal(content, v) ++ contentstr := "" ++ if decodeBody == true { ++ contentstr, _ = url.QueryUnescape(CToGoString(content)) ++ } ++ err = json.Unmarshal([]byte(contentstr), v) + if err != nil { + return err + } Added: head/devel/go-json-rest/pkg-descr ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/devel/go-json-rest/pkg-descr Wed Feb 26 17:15:02 2014 (r346216) @@ -0,0 +1,8 @@ +Go-Json-Rest is a thin layer on top of net/http that helps building RESTful +JSON APIs easily. It provides fast URL routing using a Trie based +implementation, and helpers to deal with JSON requests and responses. It is +not a high-level REST framework that transparently maps HTTP requests +to procedure calls, on the opposite, you constantly have access to the +underlying net/http objects. + +WWW: https://github.com/ant0ine/go-json-rest/ Added: head/devel/go-json-rest/pkg-plist ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/devel/go-json-rest/pkg-plist Wed Feb 26 17:15:02 2014 (r346216) @@ -0,0 +1,35 @@ +@comment $FreeBSD$ +%%GO_LIBDIR%%/github.com/ant0ine/go-json-rest.a +%%GO_SRCDIR%%/%%GO_PKGNAME%%/LICENSE +%%GO_SRCDIR%%/%%GO_PKGNAME%%/README.md +%%GO_SRCDIR%%/%%GO_PKGNAME%%/env.go +%%GO_SRCDIR%%/%%GO_PKGNAME%%/gzip.go +%%GO_SRCDIR%%/%%GO_PKGNAME%%/gzip_test.go +%%GO_SRCDIR%%/%%GO_PKGNAME%%/handler.go +%%GO_SRCDIR%%/%%GO_PKGNAME%%/handler_test.go +%%GO_SRCDIR%%/%%GO_PKGNAME%%/log.go +%%GO_SRCDIR%%/%%GO_PKGNAME%%/recorder.go +%%GO_SRCDIR%%/%%GO_PKGNAME%%/request.go +%%GO_SRCDIR%%/%%GO_PKGNAME%%/request.go.orig +%%GO_SRCDIR%%/%%GO_PKGNAME%%/request_test.go +%%GO_SRCDIR%%/%%GO_PKGNAME%%/response.go +%%GO_SRCDIR%%/%%GO_PKGNAME%%/router.go +%%GO_SRCDIR%%/%%GO_PKGNAME%%/router_benchmark_test.go +%%GO_SRCDIR%%/%%GO_PKGNAME%%/router_test.go +%%GO_SRCDIR%%/%%GO_PKGNAME%%/status.go +%%GO_SRCDIR%%/%%GO_PKGNAME%%/status_test.go +%%GO_SRCDIR%%/%%GO_PKGNAME%%/test/util.go +%%GO_SRCDIR%%/%%GO_PKGNAME%%/timer.go +%%GO_SRCDIR%%/%%GO_PKGNAME%%/trie/impl.go +%%GO_SRCDIR%%/%%GO_PKGNAME%%/trie/impl_test.go +@dirrm %%GO_SRCDIR%%/%%GO_PKGNAME%%/test +@dirrm %%GO_SRCDIR%%/%%GO_PKGNAME%%/trie +@dirrmtry %%GO_SRCDIR%%/%%GO_PKGNAME%% +@dirrmtry %%GO_SRCDIR%%/github.com/ant0ine +@dirrmtry %%GO_SRCDIR%%/github.com +@dirrmtry %%GO_LIBDIR%%/github.com/ant0ine +@dirrmtry %%GO_LIBDIR%%/github.com +@dirrmtry %%GO_LIBDIR%% +@dirrmtry %%GO_SRCDIR%% +@dirrmtry share/go/pkg +@dirrmtry share/go