Commits

Miki Tebeka  committed 4456024

better name for it

  • Participants
  • Parent commits 22a0661

Comments (0)

Files changed (4)

+2012-10-6 version 0.2.0
+    * Using zip payload (Idea from Carlos Castillo http://bit.ly/SmYXXm)
+
 2012-10-18 version 0.1.0
     * Initial release
 `nrsc` - Resource Compiler for Go
 =================================
+
 `nrsc` compiles a directory of resource into a Go source file so you can still
 deploy a single executable as a web server with all the CSS, image files, JS ...
 included.
 
+
 Installing
 ==========
 ::
 ==========
 ::
 
-    nrsc path_to_resource_dir
 
-This will create a local directory called `nrsc` which you can import in your
-code.
 
 API
 ===
 Resource Interface
 ------------------
 
-`func Open() io.Reader`
+`func Open() (io.Reader, error)`
     Returns a reader to resource data
 
 `func Size() int64`
             "net/http"
             "os"
 
-            "./nrsc"
+            "nrsc"
     )
 
     func indexHandler(w http.ResponseWriter, req *http.Request) {
+#!/bin/bash
+# Pack assets as zip payload in go executable
+
+# Idea from Carlos Castillo (http://bit.ly/SmYXXm)
+
+case "$1" in
+    -h | --help ) echo "usage: $(basename $0) EXECTABLE RESOURCE_DIR"; exit;;
+esac
+
+if [ $# -ne 2 ]; then
+    $0 -h
+    exit 1
+fi
+
+exe=$1
+root=$2
+
+if [ ! -f "${exe}" ]; then
+    echo "error: can't find $exe"
+    exit 1
+fi
+
+if [ ! -d "${root}" ]; then
+    echo "error: ${root} is not a directory"
+    exit 1
+fi
+
+# Exit on 1'st error
+set -e
+
+tmp="/tmp/nrsc-$(date +%s).zip"
+trap "rm -f ${tmp}" EXIT
+
+(cd "${root}" && zip -r "${tmp}" .)
+
+cat "${tmp}" >> "${exe}"
+zip -q -A "${exe}"

File pack.sh

-#!/bin/bash
-# Pack assets as zip payload in go executable
-
-# Idea from Carlos Castillo (http://bit.ly/SmYXXm)
-
-case "$1" in
-    -h | --help ) echo "usage: $(basename $0) EXECTABLE RESOURCE_DIR"; exit;;
-esac
-
-if [ $# -ne 2 ]; then
-    $0 -h
-    exit 1
-fi
-
-exe=$1
-root=$2
-
-if [ ! -f "${exe}" ]; then
-    echo "error: can't find $exe"
-    exit 1
-fi
-
-if [ ! -d "${root}" ]; then
-    echo "error: ${root} is not a directory"
-    exit 1
-fi
-
-# Exit on 1'st error
-set -e
-
-tmp="/tmp/nrsc-$(date +%s).zip"
-trap "rm -f ${tmp}" EXIT
-
-(cd "${root}" && zip -r "${tmp}" .)
-
-cat "${tmp}" >> "${exe}"
-zip -q -A "${exe}"