Skip to content

Commit

Permalink
Merge pull request #2 from fraenkel/args
Browse files Browse the repository at this point in the history
Pull arguments from command line
  • Loading branch information
vito committed Mar 17, 2014
2 parents 77055fb + 87b3c3b commit eebae28
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 17 deletions.
12 changes: 6 additions & 6 deletions main.go
Expand Up @@ -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",
)

Expand Down
19 changes: 8 additions & 11 deletions main_test.go
Expand Up @@ -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")
Expand All @@ -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)
Expand Down

0 comments on commit eebae28

Please sign in to comment.