configurationFile

package
v0.0.0-...-6dd38b0 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2018 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package configurationFile represents Encodable/Decodable Golang structures from/to TOML structures.

*
*The global structure is ConfigurationFile, which is the simple way to store accurtely your local informations.
*

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeBytesArray

func DecodeBytesArray(c *ConfigurationFile, data []byte) error

DecodeBytesArray is a function to decode an entire string (which is the content of a given TOML file) to a ConfigurationFile structure

func DecodeString

func DecodeString(c *ConfigurationFile, data string) error

DecodeString is a function to decode an entire string (which is the content of a given TOML file) to a ConfigurationFile structure

func GetConfigurationFileContent

func GetConfigurationFileContent(filePointer *os.File, bytesArray *[]byte)

GetConfigurationFileContent get the content of the local configuration file.

*If no configuration file has been found, create a default one and set the bytes array.

Types

type ConfigurationFile

type ConfigurationFile struct {
	Author              string
	Local               LocalInformations        `toml:"local"`
	Repositories        map[string]GitRepository `toml:"repositories"`
	VisibleRepositories VisibleRepositories      `toml:"-"`
	Groups              map[string]Group         `toml:"group"`
	// contains filtered or unexported fields
}

ConfigurationFile represents the TOML structure of the Goyave configuration file

*
*Properties:
*	Author:
*		The name of the user
*  Local:
*		Local informations
*  Repositories:
*		Local git repositories
*	VisibleRepositories:
*		A list of local ** visible ** git repositories (** used localy **)
*	Groups:
*		A list of groups
*	locker:
*		Mutex to perform concurrent RW on map data structures

func Default

func Default(author string, hostname string) *ConfigurationFile

Default is a constructor for ConfigurationFile

*
*Parameters:
*	author:
*		The name of the user
*  hostname:
*		The machine hostname

func (*ConfigurationFile) AddRepository

func (c *ConfigurationFile) AddRepository(path, target string) error

AddRepository append the given repository to the list of local repositories, if it does not exists

func (*ConfigurationFile) Encode

func (c *ConfigurationFile) Encode(buffer *bytes.Buffer) error

Encode is a function to encode a ConfigurationFile structure to a byffer of bytes

func (*ConfigurationFile) GetPath

func (c *ConfigurationFile) GetPath(repository string) (string, bool)

GetPath returns the local path file, for a given repository

func (*ConfigurationFile) Process

func (c *ConfigurationFile) Process()

Process initializes useful fields in the data structure

type GitRepository

type GitRepository struct {
	Name  string               `toml:"name"`
	Paths map[string]GroupPath `toml:"paths"`
	URL   string               `toml:"url"`
}

GitRepository represents the structure of a local git repository

*
*Properties:
*	Name:
* 		The custom name of the repository
*  Paths:
*		Path per group name
*	URL:
*		The remote URL of the repository (from origin)

type Group

type Group []string

Group represents a group of git repositories names

type GroupPath

type GroupPath struct {
	Name string
	Path string
}

GroupPath represents the structure of a local path, using a given group

*
*Properties:
*  Name:
*		The name of the local git repository
*	Path:
*		A string that points to the local git repository

type LocalInformations

type LocalInformations struct {
	DefaultTarget string
	Group         string
}

LocalInformations represents your local configuration of Goyave

*
*Properties:
*  DefaultEntry:
*		The default entry to store a git repository (hidden or visible)
*	Group:
*		The current group name.

type VisibleRepositories

type VisibleRepositories map[string]string

VisibleRepositories is a map structure to store, for each repository name (and the hostname), the associated path

Jump to

Keyboard shortcuts

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