repo

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2018 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Open shows we have files and API info stored
	Open status = iota
	// Closed shows we cannot get data
	Closed
)

Variables

This section is empty.

Functions

func StartUpdateWorkers

func StartUpdateWorkers(num int, pr *Repo, tr *Repo)

StartUpdateWorkers starts Goroutines to process Plugin and Theme updates

Types

type Extension

type Extension struct {
	Slug                   string     `json:"slug"`
	Name                   string     `json:"name,omitempty"`
	Version                string     `json:"version,omitempty"`
	Author                 string     `json:"author,omitempty"`
	AuthorProfile          string     `json:"author_profile,omitempty"`
	Contributors           [][]string `json:"contributors,omitempty"`
	Requires               string     `json:"requires,omitempty"`
	Tested                 string     `json:"tested,omitempty"`
	RequiresPHP            string     `json:"requires_php,omitempty"`
	Rating                 int        `json:"rating,omitempty"`
	Ratings                []Rating   `json:"ratings,omitempty"`
	NumRatings             int        `json:"num_ratings,omitempty"`
	SupportThreads         int        `json:"support_threads,omitempty"`
	SupportThreadsResolved int        `json:"support_threads_resolved,omitempty"`
	ActiveInstalls         int        `json:"active_installs,omitempty"`
	Downloaded             int        `json:"downloaded,omitempty"`
	LastUpdated            string     `json:"last_updated,omitempty"`
	Added                  string     `json:"added,omitempty"`
	Homepage               string     `json:"homepage,omitempty"`
	Sections               struct {
		Description string `json:"description,omitempty"`
		Faq         string `json:"faq,omitempty"`
		Changelog   string `json:"changelog,omitempty"`
		Screenshots string `json:"screenshots,omitempty"`
	} `json:"sections,omitempty"`
	ShortDescription string       `json:"short_description,omitempty"`
	DownloadLink     string       `json:"download_link,omitempty"`
	Screenshots      []Screenshot `json:"screenshots,omitempty"`
	Tags             [][]string   `json:"tags,omitempty"`
	StableTag        string       `json:"stable_tag,omitempty"`
	Versions         [][]string   `json:"versions,omitempty"`
	DonateLink       string       `json:"donate_link,omitempty"`
	Status           status       `json:"status,omitempty"`

	Stats *filestats.Stats `json:"stats,omitempty"`
	sync.RWMutex
	// contains filtered or unexported fields
}

Extension holds data about a Plugin or Theme

func (*Extension) Dir

func (e *Extension) Dir() string

Dir returns the index dir

func (*Extension) GetStatus

func (e *Extension) GetStatus() string

GetStatus returns the Status as a string

func (*Extension) Search

func (e *Extension) Search(pat, slug string, opt *index.SearchOptions) (*index.SearchResponse, error)

Search performs a basic search on the current index using the supplied pattern and the options.

func (*Extension) SwapIndexes

func (e *Extension) SwapIndexes(idx *index.Index) error

SwapIndexes ...

type Rating

type Rating struct {
	Stars  string `json:"stars"`
	Number int    `json:"number"`
}

Rating contains information about ratings of a specific star level (0-5)

type Repo

type Repo struct {
	ExtType     string             `json:"type"`
	Revision    int                `json:"revision"`
	Updated     time.Time          `json:"updated"`
	Total       int                `json:"total"`
	Closed      int                `json:"closed"`
	UpdateQueue chan UpdateRequest `json:"-"`

	List map[string]*Extension `json:"-"`
	sync.RWMutex
	// contains filtered or unexported fields
}

Repo holds data about the Plugins SVN Repo.

func New

func New(c *config.Config, l *log.Logger, t string, rev int) *Repo

New returns a new Repo

func (*Repo) Add

func (r *Repo) Add(slug string)

Add creates a new Extension in the Repo

func (*Repo) Exists

func (r *Repo) Exists(slug string) bool

Exists checks if an extension exists in the Repo

func (*Repo) GenerateInstallsChart

func (r *Repo) GenerateInstallsChart() []byte

generateInstallsChart ...

func (*Repo) GenerateSizeChart

func (r *Repo) GenerateSizeChart() []byte

generateSizeChart ...

func (*Repo) Get

func (r *Repo) Get(slug string) *Extension

Get returns a pointer to an Extension

func (*Repo) GetInstallsChart

func (r *Repo) GetInstallsChart() string

GetInstallsChart ...

func (*Repo) GetRev

func (r *Repo) GetRev() int

GetRev returns the Revision of the the Repository

func (*Repo) GetSizeChart

func (r *Repo) GetSizeChart() string

GetSizeChart ...

func (*Repo) Len

func (r *Repo) Len() uint64

Len returns the number of extensions in the Repository

func (*Repo) LoadExisting

func (r *Repo) LoadExisting()

LoadExisting loading data from DB and then Indexes

func (*Repo) ProcessUpdate

func (r *Repo) ProcessUpdate(slug string, rev int) error

ProcessUpdate performs an update Updates Meta data and files

func (*Repo) QueueUpdate

func (r *Repo) QueueUpdate(slug string, rev string)

QueueUpdate adds a request to the Update Queue

func (*Repo) Remove

func (r *Repo) Remove(slug string)

Remove deletes an Extension from the Repo

func (*Repo) Set

func (r *Repo) Set(slug string, e *Extension)

Set loads the provided Extension into the Repo

func (*Repo) SetRev

func (r *Repo) SetRev(new int)

SetRev sets the Revision of the the Repository

func (*Repo) SetStatus

func (r *Repo) SetStatus(e *Extension, s status)

SetStatus sets the Extension Status

func (*Repo) UpdateIndex

func (r *Repo) UpdateIndex(idx *index.Index) error

UpdateIndex updates the index held by an Extension

func (*Repo) UpdateList

func (r *Repo) UpdateList(fresh *bool) error

UpdateList updates our Plugin list.

type Screenshot

type Screenshot struct {
	Src     string `json:"src"`
	Caption string `json:"caption"`
}

Screenshot contains the source and caption of a screenshot

type UpdateRequest

type UpdateRequest struct {
	Slug     string
	Repo     string
	Revision int
}

UpdateRequest ...

Jump to

Keyboard shortcuts

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