From 87b3c3b8853b6eaf68e212553b0cb2935c554036 Mon Sep 17 00:00:00 2001 From: fraenkel Date: Mon, 17 Mar 2014 14:20:13 -0400 Subject: [PATCH] Pull arguments from command line --- main.go | 12 ++++++------ main_test.go | 19 ++++++++----------- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/main.go b/main.go index f370be38..c5aff9b2 100644 --- a/main.go +++ b/main.go @@ -12,37 +12,37 @@ import ( var appDir = flag.String( "appDir", - os.Getenv("APP_DIR"), + "", "directory containing raw app bits, settable as $APP_DIR", ) var outputDir = flag.String( "outputDir", - os.Getenv("OUTPUT_DIR"), + "", "directory in which to write the smelted app bits, settable as $OUTPUT_DIR", ) var resultDir = flag.String( "resultDir", - os.Getenv("RESULT_DIR"), + "", "directory in which to place smelting result metadata, settable as $RESULT_DIR", ) var buildpacksDir = flag.String( "buildpacksDir", - os.Getenv("BUILDPACKS_DIR"), + "", "directory containing the buildpacks to try, settable as $BUILDPACKS_DIR", ) var cacheDir = flag.String( "cacheDir", - os.Getenv("CACHE_DIR"), + "", "directory to store cached artifacts to buildpacks, settable as $CACHE_DIR", ) var buildpackOrder = flag.String( "buildpackOrder", - os.Getenv("BUILDPACK_ORDER"), + "", "comma-separated list of buildpacks, to be tried in order, settable as $BUILDPACK_ORDER", ) diff --git a/main_test.go b/main_test.go index 801bb3e9..439427f0 100644 --- a/main_test.go +++ b/main_test.go @@ -38,8 +38,6 @@ var _ = Describe("Smelting", func() { } BeforeEach(func() { - smelterCmd = exec.Command(smelterPath) - var err error appDir, err = ioutil.TempDir(os.TempDir(), "smelting-app") @@ -57,15 +55,14 @@ var _ = Describe("Smelting", func() { resultDir, err = ioutil.TempDir(os.TempDir(), "smelting-result") Ω(err).ShouldNot(HaveOccurred()) - smelterCmd.Env = append( - os.Environ(), - "APP_DIR="+appDir, - "BUILDPACKS_DIR="+buildpacksDir, - "OUTPUT_DIR="+outputDir, - "CACHE_DIR="+cacheDir, - "BUILDPACK_ORDER=always-detects", - "RESULT_DIR="+resultDir, - ) + smelterCmd = exec.Command(smelterPath, + "-appDir", appDir, + "-buildpacksDir", buildpacksDir, + "-outputDir", outputDir, + "-cacheDir", cacheDir, + "-buildpackOrder", "always-detects", + "-resultDir", resultDir) + smelterCmd.Env = os.Environ() cp(path.Join(buildpackFixtures, "always-detects"), buildpacksDir) cp(path.Join(appFixtures, "bash-app", "app.sh"), appDir)