diff --git a/builder/virtualbox/builder.go b/builder/virtualbox/builder.go new file mode 100644 index 000000000..10a7dfa57 --- /dev/null +++ b/builder/virtualbox/builder.go @@ -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() { +} diff --git a/builder/virtualbox/builder_test.go b/builder/virtualbox/builder_test.go new file mode 100644 index 000000000..fe102130d --- /dev/null +++ b/builder/virtualbox/builder_test.go @@ -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.") + } +} diff --git a/config.go b/config.go index 4e0ef4c41..f92a6126e 100644 --- a/config.go +++ b/config.go @@ -18,6 +18,7 @@ const defaultConfig = ` "builders": { "amazon-ebs": "packer-builder-amazon-ebs", + "virtualbox": "packer-builder-virtualbox", "vmware": "packer-builder-vmware" }, diff --git a/plugin/builder-virtualbox/main.go b/plugin/builder-virtualbox/main.go new file mode 100644 index 000000000..1428c5b1d --- /dev/null +++ b/plugin/builder-virtualbox/main.go @@ -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)) +}