svnwatch

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2017 License: AGPL-3.0 Imports: 8 Imported by: 0

README

svnwatch
  watcher for SVN repositories

installing:
  go get -u github.com/jackwilsdon/svnwatch/cmd/svnwatch

usage:
  -config string
    the configuration directory for svnwatch (default "/etc/svnwatch")
  -interval int
    how often to check for updates (0 disables this and exits after a single check) (default 0)

config:
  watches.xml:
    <watches>
      <watch url="svn://example.com">
        <command type="env">./notify_email</command>
        <command type="env">./notify_slack</command>
      </watch>
    </watches>

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterCommandType

func RegisterCommandType(name string, commandType CommandType)

RegisterCommandType registers the specified command type under the name provided.

Types

type Command

type Command struct {
	XMLName xml.Name `xml:"command"`
	Type    string   `xml:"type,attr,omitempty"`
	Command string   `xml:",chardata"`
}

Command represents a command that is executed when a change is detected.

func (Command) Execute

func (command Command) Execute(repository Repository, revision svn.Revision) error

Execute the command on the specified repository and revision.

func (*Command) UnmarshalXML

func (command *Command) UnmarshalXML(decoder *xml.Decoder, start xml.StartElement) error

UnmarshalXML unmarshals the command from XML whilst providing some extra validation.

type CommandType

type CommandType func(cmd *exec.Cmd, repository Repository, revision svn.Revision) error

A CommandType is a method of passing data about a revision into a command.

type Repositories

type Repositories struct {
	XMLName      xml.Name     `xml:"repositories"`
	Repositories []Repository `xml:"repository"`
}

Repositories represents a collection of Repository objects.

func (*Repositories) ForURL

func (r *Repositories) ForURL(url string) *Repository

ForURL returns the repository for the specified URL or creates one if it did not already exist.

type Repository

type Repository struct {
	XMLName  xml.Name `xml:"repository"`
	URL      string   `xml:"url,attr"`
	Revision int      `xml:",chardata"`
	Updated  bool     `xml:"updated,attr"`
}

Repository represents the last known state of a repository.

func (*Repository) UnmarshalXML

func (r *Repository) UnmarshalXML(decoder *xml.Decoder, start xml.StartElement) error

UnmarshalXML unmarshals the repository from XML whilst providing some extra validation.

func (*Repository) Update

func (r *Repository) Update() ([]svn.Revision, error)

Update the repository and return any new revisions.

type Watch

type Watch struct {
	XMLName  xml.Name  `xml:"watch"`
	URL      string    `xml:"url,attr"`
	Commands []Command `xml:"command"`
}

Watch represents a watch on a specific repository.

func (*Watch) UnmarshalXML

func (w *Watch) UnmarshalXML(decoder *xml.Decoder, start xml.StartElement) error

UnmarshalXML unmarshals the watch from XML whilst providing some extra validation.

func (Watch) Update

func (w Watch) Update(repositories *Repositories) error

Update the watch using the provided collection of repositories. This will also run any commands if changes are found.

type Watches

type Watches struct {
	XMLName xml.Name `xml:"watches"`
	Watches []Watch  `xml:"watch"`
}

Watches represents a collection of Watch objects.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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