engines

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2020 License: BSD-3-Clause Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterClientAPIs

func RegisterClientAPIs()

RegisterClientAPIs register all the client APIs for all the clients.

func TestBB

func TestBB()

TestBB func

func TestGL

func TestGL()

TestGL func

Types

type ClientAPI

type ClientAPI struct {
	Single      SingleRepoHandler
	PostIssue   SingleRepoHandler
	AppendIssue SingleRepoHandler
}

ClientAPI contains all the API function in a single Client.

type Comments

type Comments []Comment

Comments type

type CommentsHandler

type CommentsHandler func(domain Domain, url *url.URL) error

CommentsHandler ...

type Domain

type Domain struct {
	// Domains.yml data
	Host      string   `yaml:"host"`
	BasicAuth []string `yaml:"basic-auth"`
}

Domain is a single code hosting service.

func ReadAndParseDomains

func ReadAndParseDomains(domainsFile string) ([]Domain, error)

ReadAndParseDomains read domainsFile and return the parsed content in a Domain slice.

func (Domain) API

func (domain Domain) API() string

API returns a Domain without tld.

type Engine

type Engine struct {
	// contains filtered or unexported fields
}

Engine is a helper class representing an engine.

func NewEngine

func NewEngine() *Engine

NewEngine istance

func (*Engine) IdentifyVCS

func (e *Engine) IdentifyVCS(url *url.URL) (*Domain, error)

IdentifyVCS Will identify which VCS platform come the request and address it through correct engine this will handle vcs recognition and initiate with correct engine

func (*Engine) Start

func (e *Engine) Start(url *url.URL, valid bool, valErrors interface{}, dryRun bool) error

Start will get go API request and populate Event struct

  • urlString is a string representing URL pointing to publiccode.yml but will accept also repo url
  • valid is a bool representing publiccode validation status
  • valErrors is a string in JSON format that will be deserialized it contains all validation errors

func (*Engine) StartFlow

func (e *Engine) StartFlow(event *Event, d *Domain) error

StartFlow ..

type Issues

type Issues []GHIssue

Issues type

type Repository

type Repository struct {
	Name        string
	Hostname    string
	FileRawURL  string
	GitCloneURL string
	GitBranch   string
	Domain      Domain
	Headers     map[string]string
	Metadata    []byte
}

Repository is a single code repository. FileRawURL contains the direct url to the raw file.

type SingleRepoHandler

type SingleRepoHandler func(domain Domain, event *Event) error

SingleRepoHandler returns the client handler for an a single repository (every domain has a different handler implementation).

func GetAppendIssueClientAPIEngine

func GetAppendIssueClientAPIEngine(clientAPI string) (SingleRepoHandler, error)

GetAppendIssueClientAPIEngine checks if the API client for the requested Post Issue clientAPI exists and return its handler.

func GetPostIssueClientAPIEngine

func GetPostIssueClientAPIEngine(clientAPI string) (SingleRepoHandler, error)

GetPostIssueClientAPIEngine checks if the API client for the requested Post Issue clientAPI exists and return its handler.

func GetSingleClientAPIEngine

func GetSingleClientAPIEngine(clientAPI string) (SingleRepoHandler, error)

GetSingleClientAPIEngine checks if the API client for the requested single repository clientAPI exists and return its handler.

func RegisterAppendIssueGithubAPI

func RegisterAppendIssueGithubAPI() SingleRepoHandler

RegisterAppendIssueGithubAPI register API that will post an issue for given validation errors using ghUsername user on GitHub

func RegisterPostIssueGithubAPI

func RegisterPostIssueGithubAPI() SingleRepoHandler

RegisterPostIssueGithubAPI register API that will post an issue for given validation errors using ghUsername user on GitHub

func RegisterSingleGithubAPI

func RegisterSingleGithubAPI() SingleRepoHandler

RegisterSingleGithubAPI register API to get all issues which have been created from ghUsername user on GitHub

Jump to

Keyboard shortcuts

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