appleopensource

package
v0.0.0-...-68d4ac6 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2021 License: BSD-3-Clause Imports: 18 Imported by: 0

Documentation

Overview

Package appleopensource implements an opensource.apple.com resource management.

Index

Constants

View Source
const ComingSoon = "(coming soon!)"

ComingSoon is a Apple's comming soon message.

Variables

View Source
var KnownRelease = [...][]string{
	MacOS:  releaseMacOS,
	Xcode:  releaseXcode,
	IOS:    releaseIOS,
	Server: releaseServer,
}

KnownRelease known release versions.

Functions

func Fetch

func Fetch(ctx context.Context, dst string, uris ...string) (err error)

Fetch fetchs the uri file to dst with multiple progress bars.

func IndexProject

func IndexProject(typ ResourceType) ([]byte, error)

IndexProject return the index of opensource.apple.com/<typ> HTML DOM tree.

func IndexRelease

func IndexRelease(platform Platform, version string) ([]byte, error)

IndexRelease return the index of projects of the specified platforms release version.

func IndexVersion

func IndexVersion(project string, typ ResourceType) ([]byte, error)

IndexVersion return the index of all versions of the project HTML DOM tree.

func ListVersions

func ListVersions(buf []byte) ([]string, error)

ListVersions parses the project version index page HTML DOM, and return the available versions of the project.

Types

type Platform

type Platform int

Platform represents a release version platform type.

const (
	// Unknown unknown platform.
	Unknown Platform = iota
	// MacOS is a macOS platform.
	MacOS
	// Xcode is a Developer Tools(Xcode) platform.
	Xcode
	// IOS is a iOS platform.
	IOS
	// Server is a macOS Server platform.
	Server
)

func (Platform) String

func (p Platform) String() string

type Product

type Product struct {
	Name       string
	Version    string
	Updated    bool // for release only
	ComingSoon bool // for release only
}

Product represents a Apple open source project.

func ListProject

func ListProject(buf []byte) ([]Product, error)

ListProject parses the project list HTML DOM, and return the project list.

func ListRelease

func ListRelease(buf []byte) ([]Product, error)

ListRelease parses the release page HTML DOM, and return the Project slice.

func (*Product) Source

func (p *Product) Source() string

Source return the source resource page uri.

func (*Product) Tarball

func (p *Product) Tarball() string

Tarball return the tarballs resource download uri.

type ResourceType

type ResourceType int

ResourceType represents a resource type.

const (
	// TarballsResource is a tarballs resource type.
	TarballsResource ResourceType = 1 << iota

	// SourceResource is a source resource type.
	SourceResource
)

func (ResourceType) String

func (r ResourceType) String() string

String implements a fmt.Stringer interface.

Jump to

Keyboard shortcuts

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