svn commit: r346216 - in head/devel: . go-json-rest go-json-rest/files

Ryan Steinmetz zi at FreeBSD.org
Wed Feb 26 17:15:04 UTC 2014


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 <zi at FreeBSD.org>
+# $FreeBSD$
+
+PORTNAME=	go-json-rest
+PORTVERSION=	20140226
+CATEGORIES=	devel
+MASTER_SITES=	LOCAL/zi/ \
+		http://mirrors.rit.edu/zi/
+
+MAINTAINER=	lattera at 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 <bsd.port.pre.mk>
+.include "${PORTSDIR}/lang/go/files/bsd.go.mk"
+.include <bsd.port.post.mk>

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 @@
+ at 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
+ at dirrm %%GO_SRCDIR%%/%%GO_PKGNAME%%/test
+ at dirrm %%GO_SRCDIR%%/%%GO_PKGNAME%%/trie
+ at dirrmtry %%GO_SRCDIR%%/%%GO_PKGNAME%%
+ at dirrmtry %%GO_SRCDIR%%/github.com/ant0ine
+ at dirrmtry %%GO_SRCDIR%%/github.com
+ at dirrmtry %%GO_LIBDIR%%/github.com/ant0ine
+ at dirrmtry %%GO_LIBDIR%%/github.com
+ at dirrmtry %%GO_LIBDIR%%
+ at dirrmtry %%GO_SRCDIR%%
+ at dirrmtry share/go/pkg
+ at dirrmtry share/go


More information about the svn-ports-all mailing list