mirror of
https://github.com/goreleaser/nfpm.git
synced 2026-06-19 08:05:04 +00:00
docs
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
// Package deb implements pkg.Packager providing .deb bindings.
|
||||
package deb
|
||||
|
||||
import (
|
||||
@@ -14,12 +15,14 @@ import (
|
||||
"github.com/caarlos0/pkg/tmpl"
|
||||
)
|
||||
|
||||
// Deb is a deb pkg
|
||||
type Deb struct {
|
||||
ctx context.Context
|
||||
Info pkg.Info
|
||||
Path string
|
||||
}
|
||||
|
||||
// New deb package with the given ctx and info
|
||||
func New(ctx context.Context, info pkg.Info) (*Deb, error) {
|
||||
folder, err := ioutil.TempDir("", "deb")
|
||||
if err != nil {
|
||||
@@ -33,6 +36,7 @@ func New(ctx context.Context, info pkg.Info) (*Deb, error) {
|
||||
}, nil
|
||||
}
|
||||
|
||||
// Add adds a file to the package
|
||||
func (d *Deb) Add(src, dst string) error {
|
||||
info, err := os.Stat(src)
|
||||
if err != nil {
|
||||
@@ -48,6 +52,7 @@ func (d *Deb) Add(src, dst string) error {
|
||||
return ioutil.WriteFile(filepath.Join(d.Path, dst), bts, info.Mode())
|
||||
}
|
||||
|
||||
// Close closes the package
|
||||
func (d *Deb) Close() error {
|
||||
if err := d.createControl(); err != nil {
|
||||
return err
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
// Package pkg provides ways to package programs in some linux packaging
|
||||
// formats.
|
||||
package pkg
|
||||
|
||||
import "io"
|
||||
|
||||
// Packager can package files in some format
|
||||
type Packager interface {
|
||||
io.Closer
|
||||
Add(src, dst string) error
|
||||
}
|
||||
|
||||
// Info contains information about the package
|
||||
type Info struct {
|
||||
Filename string
|
||||
Name string
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
// Package tmpl contains templating utilities
|
||||
package tmpl
|
||||
|
||||
import "strings"
|
||||
|
||||
// Join joins strings with `, `
|
||||
func Join(strs []string) string {
|
||||
return strings.Trim(strings.Join(strs, ", "), " ")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user