atp

package
v0.0.0-...-def3303 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2019 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package atp manages test environments for git-in-sync packages.

Index

Constants

This section is empty.

Variables

View Source
var Jmap = map[string][]byte{
	"recipes": []byte(`
		{
			"bundles": [{
				"path": "SETPATH",
				"zones": [{
						"user": "hendricius",
						"remote": "github",
						"workspace": "recipes",
						"repositories": [
							"pizza-dough"
						]
					},
					{
						"user": "rochacbruno",
						"remote": "github",
						"workspace": "recipes",
						"repositories": [
							"vegan_recipes"
						]
					},
					{
						"user": "niw",
						"remote": "github",
						"workspace": "recipes",
						"repositories": [
							"ramen"
						]
					}
				]
			}]
		}
`),
	"tmpgis": []byte(`
	{
		"bundles": [{
			"path": "SETPATH",
			"zones": [{
					"user": "jychri",
					"remote": "github",
					"workspace": "tmpgis",
					"repositories": [
						"gis-Ahead",
						"gis-Behind",
						"gis-Dirty",
						"gis-DirtyUntracked",
						"gis-DirtyAhead",
						"gis-DirtyBehind",
						"gis-Untracked",
						"gis-UntrackedAhead",
						"gis-UntrackedBehind",
						"gis-Complete"
					]
				}
			]
		}]
	}
	`),
}

Jmap maps a string to JSON data as a byte slice.

View Source
var Rmap = map[string]Results{
	"recipes": {
		{"hendricius", "github", "recipes", []string{"pizza-dough"}},
		{"rochacbruno", "github", "recipes", []string{"vegan_recipes"}},
		{"niw", "github", "recipes", []string{"ramen"}},
	},
	"tmpgis": {
		{"jychri", "github", "tmpgis", []string{
			"gis-Ahead",
			"gis-Behind",
			"gis-Dirty",
			"gis-DirtyUntracked",
			"gis-DirtyAhead",
			"gis-DirtyBehind",
			"gis-Untracked",
			"gis-UntrackedAhead",
			"gis-UntrackedBehind",
			"gis-Complete",
		}}},
}

Rmap maps a string to Results.

Functions

func Direct

func Direct(scope string, key string) (string, func())

Direct verifies ~/.gisrc.json, but does not validate its content. If no ~/.gisrc.json, Direct creates one and returns its absolute path with a cleanup function. If present, Direct returns its absolute path with a nil cleanup function.

func Hub

func Hub(scope string, key string) (string, func())

Hub creates a test environment at ~/tmpgis/$scope, returning the path of ~/tmpgis/$scope/gisrc.json and a cleanup function. Unlike Setup, Hub creates matching remotes on GitHub and sets repos ahead, behind, dirty, untracked or complete depending according to their names.

func Setup

func Setup(scope string, key string) (string, func())

Setup creates a test environment at ~/tmpgis/$scope/, returning the absolute path of ~/tmpgis/$scope/gisrc.json and a cleanup function.

Types

type Result

type Result struct {
	User, Remote, Workspace string
	Repos                   []string
}

Result is the expected value for a zone.

type Results

type Results []Result

Results collects Result structs.

func Resulter

func Resulter(key string) Results

Resulter returns Results from map Rmap.

Jump to

Keyboard shortcuts

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