2014-04-26 12:22:10 -04:00
|
|
|
package compress
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"os"
|
|
|
|
)
|
|
|
|
|
2014-09-08 13:28:16 -04:00
|
|
|
const BuilderId = "packer.post-processor.compress"
|
2014-04-26 12:22:10 -04:00
|
|
|
|
|
|
|
type Artifact struct {
|
|
|
|
Path string
|
|
|
|
Provider string
|
|
|
|
}
|
|
|
|
|
|
|
|
func NewArtifact(provider, path string) *Artifact {
|
|
|
|
return &Artifact{
|
|
|
|
Path: path,
|
|
|
|
Provider: provider,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (*Artifact) BuilderId() string {
|
|
|
|
return BuilderId
|
|
|
|
}
|
|
|
|
|
|
|
|
func (self *Artifact) Id() string {
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
|
|
|
|
func (self *Artifact) Files() []string {
|
|
|
|
return []string{self.Path}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (self *Artifact) String() string {
|
|
|
|
return fmt.Sprintf("'%s' compressing: %s", self.Provider, self.Path)
|
|
|
|
}
|
|
|
|
|
2014-01-19 13:32:44 -05:00
|
|
|
func (*Artifact) State(name string) interface{} {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2014-04-26 12:22:10 -04:00
|
|
|
func (self *Artifact) Destroy() error {
|
|
|
|
return os.Remove(self.Path)
|
|
|
|
}
|