Documentation ¶
Overview ¶
Package release provides an appcast release(s) that suits most appcast providers.
Officially, it supports 3 providers: "GitHub Atom Feed", "SourceForge RSS Feed" and "Sparkle RSS Feed". However, it can be extended to your own needs if necessary.
Index ¶
- Variables
- type ByVersion
- type Download
- func (d *Download) DsaSignature() string
- func (d *Download) Filetype() string
- func (d *Download) Length() int
- func (d *Download) Md5() string
- func (d *Download) SetDsaSignature(dsaSignature string)
- func (d *Download) SetFiletype(filetype string)
- func (d *Download) SetLength(length int)
- func (d *Download) SetMd5(md5 string)
- func (d *Download) SetUrl(url string)
- func (d *Download) Url() string
- type Downloader
- type PublishedDateTime
- func (p *PublishedDateTime) Format() string
- func (p *PublishedDateTime) Parse(dateTime string) (err error)
- func (p *PublishedDateTime) SetFormat(format string)
- func (p *PublishedDateTime) SetTime(time *time.Time)
- func (p *PublishedDateTime) String() string
- func (p *PublishedDateTime) Time() *time.Time
- type PublishedDateTimer
- type Release
- func (r *Release) AddDownload(d Download)
- func (r *Release) Build() string
- func (r *Release) Description() string
- func (r *Release) Downloads() []Download
- func (r *Release) IsPreRelease() bool
- func (r *Release) MinimumSystemVersion() string
- func (r *Release) PublishedDateTime() *PublishedDateTime
- func (r *Release) ReleaseNotesLink() string
- func (r *Release) SetBuild(build string)
- func (r *Release) SetDescription(description string)
- func (r *Release) SetDownloads(downloads []Download)
- func (r *Release) SetIsPreRelease(isPreRelease bool)
- func (r *Release) SetMinimumSystemVersion(minimumSystemVersion string)
- func (r *Release) SetPublishedDateTime(publishedDateTime *PublishedDateTime)
- func (r *Release) SetReleaseNotesLink(releaseNotesLink string)
- func (r *Release) SetTitle(title string)
- func (r *Release) SetVersion(version *version.Version)
- func (r *Release) SetVersionString(value string) error
- func (r *Release) Title() string
- func (r *Release) Version() *version.Version
- func (r *Release) VersionOrBuildString() string
- type Releaser
- type Releases
- func (r *Releases) FilterByMediaType(regexpStr string, inversed ...interface{})
- func (r *Releases) FilterByPrerelease(inversed ...interface{})
- func (r *Releases) FilterByTitle(regexpStr string, inversed ...interface{})
- func (r *Releases) FilterByUrl(regexpStr string, inversed ...interface{})
- func (r *Releases) Filtered() []Releaser
- func (r *Releases) First() Releaser
- func (r *Releases) Len() int
- func (r *Releases) Original() []Releaser
- func (r *Releases) ResetFilters()
- func (r *Releases) SetFiltered(filtered []Releaser)
- func (r *Releases) SetOriginal(original []Releaser)
- func (r *Releases) SortByVersions(s Sort)
- type Releaseser
- type Sort
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type ByVersion ¶
type ByVersion []Releaser
ByVersion implements sort.Interface for the []Releaser based Version field.
type Download ¶
type Download struct {
// contains filtered or unexported fields
}
Download holds a single release download data.
func NewDownload ¶
NewDownload returns a new Download instance pointer. Requires an url to be passed as a parameter. Optionally, the filetype can be passed as a second parameter, the length as a third one, the dsaSignature as a fourth and the md5 as a fifth.
func (*Download) DsaSignature ¶ added in v0.4.0
DsaSignature is a Download.dsaSignature getter.
func (*Download) SetDsaSignature ¶ added in v0.4.0
SetDsaSignature is a Download.dsaSignature setter.
func (*Download) SetFiletype ¶ added in v0.4.0
SetFiletype is a Download.filetype setter.
type Downloader ¶ added in v0.4.0
type Downloader interface { Url() string SetUrl(url string) Filetype() string SetFiletype(filetype string) Length() int SetLength(length int) DsaSignature() string SetDsaSignature(dsaSignature string) Md5() string SetMd5(dsaSignature string) }
Downloader is the interface that wraps the Download methods.
type PublishedDateTime ¶
type PublishedDateTime struct {
// contains filtered or unexported fields
}
PublishedDateTime represents a release published date and time.
func NewPublishedDateTime ¶
func NewPublishedDateTime(a ...interface{}) *PublishedDateTime
NewPublishedDateTime returns a new PublishedDateTime instance pointer. Optionally, the time can be passed as a parameter.
func (*PublishedDateTime) Format ¶
func (p *PublishedDateTime) Format() string
Format is a PublishedDateTime.format getter.
func (*PublishedDateTime) Parse ¶
func (p *PublishedDateTime) Parse(dateTime string) (err error)
Parse parses the provided dateTime string using the predefined time formats in the PublishedDateTimeFormats global variable and sets the original string value as the PublishedDateTime.original value alongside with the PublishedDateTime.time and PublishedDateTime.format.
func (*PublishedDateTime) SetFormat ¶
func (p *PublishedDateTime) SetFormat(format string)
SetFormat is a PublishedDateTime.format setter.
func (*PublishedDateTime) SetTime ¶
func (p *PublishedDateTime) SetTime(time *time.Time)
SetTime is a PublishedDateTime.time setter.
func (*PublishedDateTime) String ¶
func (p *PublishedDateTime) String() string
String returns the string representation of the PublishedDateTime.
func (*PublishedDateTime) Time ¶
func (p *PublishedDateTime) Time() *time.Time
Time is a PublishedDateTime.time getter.
type PublishedDateTimer ¶
type PublishedDateTimer interface { Parse(dateTime string) (err error) Time() *time.Time SetTime(time *time.Time) Format() string SetFormat(format string) }
PublishedDateTimer is the interface that wraps the PublishedDateTime methods.
type Release ¶
type Release struct {
// contains filtered or unexported fields
}
Release represents a single application release.
func New ¶
New returns a new Release instance pointer. Requires both version and build strings. By default, Release.IsPrerelease is set to false, so the release will be considered as stable.
func (*Release) AddDownload ¶
AddDownload appends the provided Download to the Release.downloads slice.
func (*Release) Description ¶
Description is a Release.description getter.
func (*Release) IsPreRelease ¶
IsPreRelease is a Release.isPreRelease getter.
func (*Release) MinimumSystemVersion ¶ added in v0.4.0
MinimumSystemVersion is a Release.minimumSystemVersion getter.
func (*Release) PublishedDateTime ¶
func (r *Release) PublishedDateTime() *PublishedDateTime
PublishedDateTime is a Release.publishedDateTime getter.
func (*Release) ReleaseNotesLink ¶ added in v0.4.0
ReleaseNotesLink is a Release.releaseNotesLink getter.
func (*Release) SetDescription ¶
SetDescription is a Release.description setter.
func (*Release) SetDownloads ¶
SetDownloads is a Release.downloads setter.
func (*Release) SetIsPreRelease ¶
SetIsPreRelease is a Release.isPreRelease setter.
func (*Release) SetMinimumSystemVersion ¶ added in v0.4.0
SetMinimumSystemVersion is a Release.minimumSystemVersion setter.
func (*Release) SetPublishedDateTime ¶
func (r *Release) SetPublishedDateTime(publishedDateTime *PublishedDateTime)
SetPublishedDateTime is a Release.publishedDateTime setter.
func (*Release) SetReleaseNotesLink ¶ added in v0.4.0
SetReleaseNotesLink is a Release.releaseNotesLink setter.
func (*Release) SetVersion ¶
func (r *Release) SetVersion(version *version.Version)
SetVersion is a Release.version setter.
func (*Release) SetVersionString ¶
SetVersionString sets the Release.version from the provided version value string. Returns an error, if the provided version string value doesn't follow the SemVer specification.
func (*Release) Version ¶
func (r *Release) Version() *version.Version
Version is a Release.version getter.
func (*Release) VersionOrBuildString ¶
VersionOrBuildString retrieves the release version string if it's available. Otherwise, returns the release build string.
type Releaser ¶
type Releaser interface { VersionOrBuildString() string Version() *version.Version SetVersion(version *version.Version) SetVersionString(value string) error Build() string SetBuild(build string) Title() string SetTitle(title string) Description() string SetDescription(description string) PublishedDateTime() *PublishedDateTime SetPublishedDateTime(publishedDateTime *PublishedDateTime) ReleaseNotesLink() string SetReleaseNotesLink(releaseNotesLink string) MinimumSystemVersion() string SetMinimumSystemVersion(minimumSystemVersion string) AddDownload(d Download) Downloads() []Download SetDownloads(downloads []Download) IsPreRelease() bool SetIsPreRelease(isPreRelease bool) }
Releaser is the interface that wraps the Release methods.
type Releases ¶ added in v0.5.0
type Releases struct {
// contains filtered or unexported fields
}
Releases represents the appcast releases which holds both the filtered and the original ones.
func NewReleases ¶ added in v0.5.0
NewReleases returns a new Releases instance pointer. Requires []Releaser slice to be passed as a parameter which will be set to the Releases.filtered and the Releases.original.
func (*Releases) FilterByMediaType ¶ added in v0.5.0
FilterByMediaType filters all Releases.filtered by matching the downloads media type with the provided RegExp string.
When inversed bool is set to true, the unmatched releases will be used instead.
func (*Releases) FilterByPrerelease ¶ added in v0.5.0
func (r *Releases) FilterByPrerelease(inversed ...interface{})
FilterByPrerelease filters all Releases.filtered by matching only the pre-releases.
When inversed bool is set to true, the unmatched releases will be used instead.
func (*Releases) FilterByTitle ¶ added in v0.5.0
FilterByTitle filters all Releases.filtered by matching the release title with the provided RegExp string.
When inversed bool is set to true, the unmatched releases will be used instead.
func (*Releases) FilterByUrl ¶ added in v0.5.0
FilterByUrl filters all Releases.filtered by matching the release download URL with the provided RegExp string.
When inversed bool is set to true, the unmatched releases will be used instead.
func (*Releases) First ¶ added in v0.5.0
First is a convenience method to get the first release from the Releases.filtered slice.
func (*Releases) Len ¶ added in v0.5.0
Len is a convenience method to get the Releases.filtered slice length.
func (*Releases) ResetFilters ¶ added in v0.5.0
func (r *Releases) ResetFilters()
ResetFilters resets the Releases.filtered to their original state before applying any filters.
func (*Releases) SetFiltered ¶ added in v0.5.0
SetFiltered is a Releases.filtered setter.
func (*Releases) SetOriginal ¶ added in v0.5.0
SetOriginal is a Releases.original setter.
func (*Releases) SortByVersions ¶ added in v0.5.0
SortByVersions sorts the Releases.filtered slice by versions. Can be useful if the versions order is inconsistent.
type Releaseser ¶ added in v0.5.0
type Releaseser interface { SortByVersions(s Sort) FilterByTitle(regexpStr string, inversed ...interface{}) FilterByMediaType(regexpStr string, inversed ...interface{}) FilterByUrl(regexpStr string, inversed ...interface{}) FilterByPrerelease(inversed ...interface{}) ResetFilters() Len() int First() Releaser Filtered() []Releaser SetFiltered(filtered []Releaser) Original() []Releaser SetOriginal(original []Releaser) }
Releaseser is the interface that wraps the Releases methods.
TODO: Find a better Releaseser interface name.