analyzer

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2014 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseAnalysis

func ParseAnalysis(analysis Analysis) (*builderfile.Builderfile, error)

ParseAnalysis takes the results of the analysis of a directory and produces a Builderfile with some educated guesses. This is later written to a file named "Bobfile" upon running `builder init .`

func ParseAnalysisFromDir

func ParseAnalysisFromDir(dir string) (*builderfile.Builderfile, error)

ParseAnalysisFromDir is a handy function that combines NewAnalysis with ParseAnalysis to make things a little easier.

Types

type Analysis

type Analysis interface {
	GitRemotes() string
	DockerfilePresent() bool
	IsGitRepo() bool
	RepoBasename() string
}

An Analysis offers functions that provide data about a given directory. This is then used to populate an example Bobfile for `builder init .` commands.

func NewAnalysis

func NewAnalysis(dir string) (Analysis, error)

NewAnalysis creates an Analysis of the provided directory.

type RepoAnalysis

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

A RepoAnalysis implements Analysis and returns real data about a given directory. It is also the type that is returned by NewAnalysis()

func (*RepoAnalysis) DockerfilePresent

func (ra *RepoAnalysis) DockerfilePresent() bool

DockerfilePresent whether or not a file named Dockerfile is present at the top level of the directory being analyzed.

func (*RepoAnalysis) GitRemotes

func (ra *RepoAnalysis) GitRemotes() string

GitRemotes returns the output of `git remote -v` when run on the directory being analyized. If the remotes cannot be determined (i.e. if the directory is not a git repo), an empty string is returned.

func (*RepoAnalysis) IsGitRepo

func (ra *RepoAnalysis) IsGitRepo() bool

IsGitRepo returns whether or not the directory being analyzed appears to be a valid git repo. Validity is determined by whether or not `git remote -v` returns a non-zero exit code.

func (*RepoAnalysis) RepoBasename

func (ra *RepoAnalysis) RepoBasename() string

RepoBasename returns the basename of the repo being analyzed.

Jump to

Keyboard shortcuts

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