github.com/kaixiang/packer@v0.5.2-0.20140114230416-1f5786b0d7f1/post-processor/vagrant/vmware.go (about)

     1  package vagrant
     2  
     3  import (
     4  	"fmt"
     5  	"github.com/mitchellh/packer/packer"
     6  	"path/filepath"
     7  )
     8  
     9  type VMwareProvider struct{}
    10  
    11  func (p *VMwareProvider) Process(ui packer.Ui, artifact packer.Artifact, dir string) (vagrantfile string, metadata map[string]interface{}, err error) {
    12  	// Create the metadata
    13  	metadata = map[string]interface{}{"provider": "vmware_desktop"}
    14  
    15  	// Copy all of the original contents into the temporary directory
    16  	for _, path := range artifact.Files() {
    17  		ui.Message(fmt.Sprintf("Copying: %s", path))
    18  
    19  		dstPath := filepath.Join(dir, filepath.Base(path))
    20  		if err = CopyContents(dstPath, path); err != nil {
    21  			return
    22  		}
    23  	}
    24  
    25  	return
    26  }