Create the build command/plugin

This commit is contained in:
Mitchell Hashimoto 2013-05-07 11:39:32 -07:00
parent 399d8ab028
commit 91ade277a6
7 changed files with 37 additions and 9 deletions

View File

@ -1,12 +1,21 @@
NO_COLOR=\x1b[0m
OK_COLOR=\x1b[32;01m
ERROR_COLOR=\x1b[31;01m
WARN_COLOR=\x1b[33;01m
all:
@mkdir -p bin/
go get -d -v ./...
@echo "$(OK_COLOR)--> Compiling Packer...$(NO_COLOR)"
go build -v -o bin/packer
@echo "$(OK_COLOR)--> Compiling Command: Build...$(NO_COLOR)"
$(MAKE) -C plugin/command-build
format:
go fmt ./...
test:
@echo "$(OK_COLOR)--> Testing Packer...$(NO_COLOR)"
@go list -f '{{range .TestImports}}{{.}}\
{{end}}' ./... | xargs -n1 go get -d
go test ./...

View File

@ -1,8 +1,8 @@
package main
package build
import "github.com/mitchellh/packer/packer"
type buildCommand byte
type Command byte
func (Command) Run(env packer.Environment, arg []string) int {
env.Ui().Say("BUILDING!")

View File

@ -0,0 +1,3 @@
package build

View File

@ -1,7 +0,0 @@
package main
import "github.com/mitchellh/packer/packer/plugin"
func main() {
plugin.ServeCommand(new(buildCommand))
}

View File

@ -0,0 +1,13 @@
plugin:
go get -d -v ./...
go build -v -o $(CURDIR)/bin/packer-build
format:
go fmt ./...
test:
@go list -f '{{range .TestImports}}{{.}}\
{{end}}' ./... | xargs -n1 go get -d
go test ./...
.PHONY: all format test

Binary file not shown.

View File

@ -0,0 +1,10 @@
package main
import (
"github.com/mitchellh/packer/command/build"
"github.com/mitchellh/packer/packer/plugin"
)
func main() {
plugin.ServeCommand(new(build.Command))
}