Documentation ¶
Index ¶
- type CopyConfig
- type Plan
- type Stage
- func (s *Stage) AddFileByName(relPath string) error
- func (s *Stage) AddFileByObject(relPath string, fd *os.File)
- func (s *Stage) BasePath() string
- func (s *Stage) Copy(dstPath string, cfgs ...CopyConfig) (plan *Plan, errs []error)
- func (s *Stage) CopyFileAll(srcPath, dstRelPath string, fileMode, dirMode os.FileMode) (*os.File, error)
- func (s *Stage) CreateFileAll(relPath string, fileMode, dirMode os.FileMode) (*os.File, error)
- func (s *Stage) MkdirAll(relPath string, dirMode os.FileMode) error
- func (s *Stage) Output() (errs []error)
- func (s *Stage) OverwriteSkip(destAbsPath string)
- func (s *Stage) Path(relPathParts ...string) string
- func (s *Stage) Rename(fromRelPath, toRelPath string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CopyConfig ¶
type CopyConfig struct { // RemovableDirs holds destination absolute paths of all dirs which are allowed to be removed. // If it is nil, all destination dirs may be removed. RemovableDirs *cage_strings.Set // RemovableFiles holds destination absolute paths of all files which are allowed to be removed. // If it is nil, all destination files may be removed. RemovableFiles *cage_strings.Set DryRun bool }
type Plan ¶
type Plan struct { // Add holds relative paths of files that exist in the stage but not the destination. Add *cage_strings.Set // Overwrite holds relative paths of files that exist in the stage and also the destination, // and the latter will be overwritten because the content has changed. Overwrite *cage_strings.Set // Remove holds relative paths of files that do not exist in the stage and but do in the destination. Remove *cage_strings.Set }
type Stage ¶
type Stage struct {
// contains filtered or unexported fields
}
func NewTempDirStage ¶
NewTempDirStage create the stage with ioutil.TempDir.
For example, on Linux a prefix of "stage" would create a directory like "/tmp/stage725468197".
func (*Stage) AddFileByName ¶
AddFileByName registers a stage file for copying.
It is similar to AddFileByObject except that it opens the file to obtain the object/descriptor.
func (*Stage) AddFileByObject ¶
AddFileByObject a stage file for copying.
It is similar to AddFileByName except that it excepts the object/descriptor as a parameter.
func (*Stage) Copy ¶
func (s *Stage) Copy(dstPath string, cfgs ...CopyConfig) (plan *Plan, errs []error)
Output makes a copy of the stage's files in a destination directory.
If the destination does not exist, it will be created.
An optional CopyConfig will replace the default (zero) value.
func (*Stage) CopyFileAll ¶
func (s *Stage) CopyFileAll(srcPath, dstRelPath string, fileMode, dirMode os.FileMode) (*os.File, error)
CopyFileAll adds a copy of a non-stage file into the stage at the selected relative path and all non-existent ancestor directories.
func (*Stage) CreateFileAll ¶
CreateFileAll creates a new stage file and all non-existent ancestor directories.
func (*Stage) MkdirAll ¶
MkdirAll creates a new stage directory and all non-existent ancestor directories.
func (*Stage) OverwriteSkip ¶
OverwriteSkip marks an absolute path in the destination tree that should not be overwritten or removed.