nuget

package module
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2019 License: GPL-3.0 Imports: 14 Imported by: 2

README

go-nuget

Package for handling NuSpec and NuPkg files for NuGet, written in Go.

Supports:

  • Spec - returns Sample .nuspec file
  • Pack - generates a .nupkg file from a .nuspec
  • Push - Pushes a .nupkg file to a NuGet server

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PackNupkg

func PackNupkg(ns *nuspec.NuSpec, basePath string, outputPath string) ([]byte, error)

PackNupkg produces a .nupkg file in byte format

func PushNupkg

func PushNupkg(fileContents []byte, apiKey string, host string) (int, int64, error)

PushNupkg PUTs a .nupkg binary to a NuGet Repository

func SampleNuSpec

func SampleNuSpec(id string, user string) *nuspec.NuSpec

SampleNuSpec returns a populated sample NuSpec struct

Types

type ContentTypeEntry

type ContentTypeEntry struct {
	Extension   string `xml:"Extension,attr"`
	ContentType string `xml:"ContentType,attr"`
}

ContentTypeEntry is used by the ContentTypes struct

type ContentTypes

type ContentTypes struct {
	XMLName xml.Name            `xml:"Types"`
	Xmlns   string              `xml:"xmlns,attr"`
	Entry   []*ContentTypeEntry `xml:"Default"`
}

ContentTypes is represents a [Content_Types].xml file from a .nupkg file

func NewContentTypes

func NewContentTypes() *ContentTypes

NewContentTypes is a constructor for the ContentTypes struct

func (*ContentTypes) Add

func (ct *ContentTypes) Add(ext string)

Add pushes a new extension into a ContentType struct

func (*ContentTypes) ToBytes

func (ct *ContentTypes) ToBytes() ([]byte, error)

ToBytes produces the nuspec in XML format

type PsmdcpFile

type PsmdcpFile struct {
	XMLName        xml.Name `xml:"coreProperties"`
	XMLNSdc        string   `xml:"xmlns:dc,attr"`
	XMLNSdcterms   string   `xml:"xmlns:dcterms,attr"`
	XMLNSxsi       string   `xml:"xmlns:xsi,attr"`
	XMLNS          string   `xml:"xmlns,attr"`
	Creator        string   `xml:"dc:creator"`
	Description    string   `xml:"dc:description"`
	Identifier     string   `xml:"dc:identifier"`
	Version        string   `xml:"version"`
	Keywords       string   `xml:"keywords"`
	LastModifiedBy string   `xml:"lastModifiedBy"`
}

PsmdcpFile is a variation XML generated by nuget

func NewPsmdcpFile

func NewPsmdcpFile() *PsmdcpFile

NewPsmdcpFile returns a populated skeleton for a Nuget Packages Entry

func (*PsmdcpFile) ToBytes

func (pf *PsmdcpFile) ToBytes() ([]byte, error)

ToBytes exports structure as byte array

type Rel

type Rel struct {
	Type   string `xml:"Type,attr"`
	Target string `xml:"Target,attr"`
	ID     string `xml:"Id,attr"`
}

Rel represents a relationship used in RelFile

type RelFile

type RelFile struct {
	XMLName xml.Name `xml:"Relationships"`
	XMLns   string   `xml:"xmlns,attr"`
	Rels    []*Rel   `xml:"Relationship"`
}

RelFile represents a Relationship File stored in .rels

func NewRelFile

func NewRelFile() *RelFile

NewRelFile returns a populated skeleton for a Nuget Packages Entry

func (*RelFile) Add

func (rf *RelFile) Add(t string, targ string)

Add appends a new relationship to the list

func (*RelFile) ToBytes

func (rf *RelFile) ToBytes() ([]byte, error)

ToBytes exports structure as byte array

Jump to

Keyboard shortcuts

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