gobundle

package module
v0.0.0-...-e79f7f5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 3, 2015 License: MIT Imports: 12 Imported by: 1

README

gobundle

v1.1

Provides a tool & API for bundling resources with Go

Gobundle provides a command for packing resources into a go executable. Given a list of packages, for each package, it finds all of the files in <pkg dir>/bundle/, tars and gzips them, writing the resulting data to a byte array in <pkg dir>/bundle.go. The available flags are:

  • --file: if present, the data will be written to the argument as a tar. The resulting file will be an actual tar, as opposed to the golang byte array literal that is written to bundle.go. This is primarily for testing purposes.

To use the gobundle package, import "github.com/FactomProject/gobundle", set gobundle.Setup.Application.Name to your application name, and call gobundle.Init() (which calls flag.Parse()). The available flags are:

  • --conf: sets the configuration directory path; default value depends on the OS
  • --data: sets the data directory path; default value depends on the OS
  • --unpack <arg>:
    • suppress: Don't unpack
    • unpack[,force]: Do unpack
    • detect[,force]: Unpack if the conf and data are non-extant
    • only[,force]: Unpack and exit
    • force forces unpack, overwriting extant files

Change log

v1.1

Added --file for the command.

v1.0

Initial Release

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Setup struct {
	// info the consumer should set
	Application struct {
		// name of the app
		Name string

		// if the app should use system folders
		System bool

		// windows stuff
		Roaming bool

		// resource tar binary
		ResourceTar io.Reader
	}

	// directories where config and data files are stored
	Directories struct {
		Config, Data *string
	}

	// the unpack mode flag
	Unpack *string

	// the handler for non-data/-config resources
	Handler func(tarpath string, filedata io.Reader)
}

setup/config info

Functions

func AppDir

func AppDir(appName string, config, sys, roaming bool) string

func ConfigFile

func ConfigFile(path string) string

func DataFile

func DataFile(path string) string

func Init

func Init()

set up config info

unpacks if necessary
calls flag.Parse()
set up other flags before this call

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL