foundation for virtualbox builder

This commit is contained in:
Mitchell Hashimoto 2013-06-11 15:12:45 -07:00
parent 133648203c
commit 99af93f86a
4 changed files with 62 additions and 0 deletions

View File

@ -0,0 +1,33 @@
package virtualbox
import (
"github.com/mitchellh/mapstructure"
"github.com/mitchellh/multistep"
"github.com/mitchellh/packer/packer"
)
const BuilderId = "mitchellh.virtualbox"
type Builder struct {
config config
runner multistep.Runner
}
type config struct {
OutputDir string `mapstructure:"output_directory"`
}
func (b *Builder) Prepare(raw interface{}) error {
if err := mapstructure.Decode(raw, &b.config); err != nil {
return err
}
return nil
}
func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) packer.Artifact {
return nil
}
func (b *Builder) Cancel() {
}

View File

@ -0,0 +1,18 @@
package virtualbox
import (
"github.com/mitchellh/packer/packer"
"testing"
)
func testConfig() map[string]interface{} {
return map[string]interface{}{}
}
func TestBuilder_ImplementsBuilder(t *testing.T) {
var raw interface{}
raw = &Builder{}
if _, ok := raw.(packer.Builder); !ok {
t.Error("Builder must implement builder.")
}
}

View File

@ -18,6 +18,7 @@ const defaultConfig = `
"builders": {
"amazon-ebs": "packer-builder-amazon-ebs",
"virtualbox": "packer-builder-virtualbox",
"vmware": "packer-builder-vmware"
},

View File

@ -0,0 +1,10 @@
package main
import (
"github.com/mitchellh/packer/builder/virtualbox"
"github.com/mitchellh/packer/packer/plugin"
)
func main() {
plugin.ServeBuilder(new(virtualbox.Builder))
}