pvi

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

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

Go to latest
Published: Mar 19, 2016 License: MIT Imports: 13 Imported by: 0

README

#Pom Version Information (pvi) Compile pom details across many projects

Build Status

Pom Version Information is a command line tool for analyzing multiple maven projects and printing out how they are related.

Install:

go get github.com/sgoertzen/pvi/cmd/pvi
go install github.com/sgoertzen/pvi/cmd/pvi

Usage:

usage: pvi [<flags>] [<path>]

Flags:
  -?, --help               Show context-sensitive help (also try --help-long and --help-man).
  -o, --format="text"      Specify the output format. Should be either 'text' or 'json'
  -f, --filename=FILENAME  The file in which the output should be stored. If this is left off the output will be printed to the console
  -n, --nocolor            Do not color the output. Ignored if filename is specified.
  -d, --debug              Output debug information during the run.
  -p, --showpath           Show the path information for each project.
  -v, --version            Show application version.

Args:
  [<path>]  The `directory` that contains subfolders with maven projects. Defaults to current directory. Example: '/user/code/projects/'
Examples

Run the program in the current directory

pvi 

Return JSON and store into a file

pvi ../../MyCode -o=json -f=myoutput.json

##Example: Given the directory structure as follows:

/users
    /myname
        /code
            /project1
                /pom.xml
                ...
            /project2
                /pom.xml
                ...

You would run the tool with:

./pvi /users/myname/code

##Example Output:

my-parent-project (1.4.2)
--my-dependant-project (2.0.24)

If the child project points to an older version of the parent pom then you would get a message like

my-parent-project (1.4.2)
--my-dependant-project (2.0.24) ** Warning: looking for parent version: 1.3.1

##Development

Running integration tests

go test -tags=integration

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrintToFile

func PrintToFile(output string, filename string)

PrintToFile prints the given string to the specified file

func PrintToTerminal

func PrintToTerminal(output string)

PrintToTerminal prints the given string to the terminal

func SetParentVersionInPom

func SetParentVersionInPom(pomPath string, currentVersion string, newVersion string)

func SetParentVersionInText

func SetParentVersionInText(pomText string, currentVersion string, newVersion string) string

func UpdateParentVersion

func UpdateParentVersion(project Project)

Types

type PomArtifactID

type PomArtifactID struct {
	Value string `xml:",chardata"`
}

PomArtifactID the id of the given pom file

type PomGroupID

type PomGroupID struct {
	Value string `xml:",chardata"`
}

PomGroupID is the group to which this project belongs

type PomParent

type PomParent struct {
	GroupID    PomGroupID    `xml:"groupId"`
	ArtifactID PomArtifactID `xml:"artifactId"`
	Version    PomVersion    `xml:"version"`
}

PomParent contains information on this projects parent

type PomProject

type PomProject struct {
	XMLName    xml.Name      `xml:"project"`
	Parent     PomParent     `xml:"parent"`
	GroupID    PomGroupID    `xml:"groupId"`
	ArtifactID PomArtifactID `xml:"artifactId"`
	Version    PomVersion    `xml:"version"`
	FullPath   string
}

PomProject represent a pom file

type PomProjects

type PomProjects []*PomProject

PomProjects a list of type PomProject

type PomVersion

type PomVersion struct {
	Value string `xml:",chardata"`
}

PomVersion is the version of this project

type Project

type Project struct {
	Parent                *Project `json:"-"`
	Children              Projects
	ArtifactID            string
	GroupID               string
	Version               string
	MismatchParentVersion string
	FullPath              string
	MissingParent         string
}

Project represent a single project with links to parent and child projects

type Projects

type Projects []*Project

Projects is a list of type Project

func GetProjects

func GetProjects(projectPath string, debug bool) Projects

GetProjects get all projects by reading the given directory

func (Projects) AsJSON

func (projects Projects) AsJSON() string

AsJSON returns the projects in a minimized JSON format.

func (Projects) AsText

func (projects Projects) AsText(noColor bool, showpath bool) string

AsText will return the projects in a readable test format.

func (Projects) Len

func (slice Projects) Len() int

func (Projects) Less

func (slice Projects) Less(i, j int) bool

func (Projects) Swap

func (slice Projects) Swap(i, j int)

Directories

Path Synopsis
cmd
pvi

Jump to

Keyboard shortcuts

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