Example #1
0
func TestBundle(t *testing.T) {
	file, _ := os.Open("fixtures/bundled.json")
	data, _ := ioutil.ReadAll(file)
	BundletestsBundle := gobundle.NewBuilder("bundletests").Add(
		"fixtures/bundled.json", data,
	).Build()
	bundle, _ := BundletestsBundle.Open("fixtures/bundled.json")
	data, _ = ioutil.ReadAll(bundle)
	err := json.Unmarshal(data, &extracted)
	if err != nil {
		t.Fatalf("extraction failed: %v\n", err)
	}
	if extracted.Name != "bundle of joy" {
		t.Fatalf("did not get expected struct, got: %v\n", extracted)
	}
}
Example #2
0
package web

import (
	"github.com/alecthomas/gobundle"
)

// CardBundle bundles the RAML file with the binary.
var CardBundle = gobundle.NewBuilder("web").Compressed().UncompressOnInit().Add(
	"api.raml", []byte("x\xdat\x8e=\x8b\xc30\f@w\xfd\n\xc1q\xe3\xc5w\xdb\xe1\xad\xd0n\xfd\x80\x94vw\x12\xd5\x11\xd8Q\xb0\x95\x94\xfc\xfb:\xb4\x1d;\t\x9e\x9ex\xfa\xfa\xae7\x87=\xfeV\xff\xa0\xac\x81,\xfaD7\x98)e\x96\xc1\xe2\x1f@\xe32]\x12[\xecUGk\x8cg\xed\xa7\xa6j%\x9a]+\x83D\u03ba\xe5B]8K\x98\xb4\xdce\u3961\x94\x16\u891d\"\r\xeaVl\x01\xf1\a\xf1\x15:\x95\xc8\xcct\a0\xeb\u0093\xae\x03\xb1\xe3<\x06\xb7\x1c],R-\xa2`\xde\xef|\u052eO\xe1\x11\x00\x00\xff\xff\x93\xc6D\x0e"),
).Build()
Example #3
0
package main

import (
	"github.com/alecthomas/gobundle"
)

var MainBundle *gobundle.Bundle = gobundle.NewBuilder("main").Compressed().UncompressOnInit().Add(
	"api.raml", []byte("x\xda,\x8d\u036a\xc20\x10\x85\xf7\xf3\x14\x03\x97\xbb\xb4\u045dd'\xe8\xce\x1f\xa8\xf8\x00i;\xa6\x03I\xa7$\xd3J\xdf\xde\x04\\\x1d\xf8\xce9|\u007f\xff\xed\xe9v\xc5}s\x04e\rd\xd1'z\xc3J)\xb3L\x16\x0f\x00\x9d\xcb\xf4JlqT\x9d\xad1\x9eu\\\xba\xa6\x97h.\xbdL\x129\xeb\x99\vu\xe1)a\xd1\xf2\xcb\xc6KG)m0H\xbfD\x9a\xd4Ul\x01q\x87\xf8\x13=\x8ade\xfa\x00\x98Zx\xd2\x1a\x88\x03\xe79\xb8\xed\xeeb\x19\xb5\"\xfa\r\x00\x00\xff\xff\x8fo6\x90"),
).Build()