39 lines
967 B
Go
39 lines
967 B
Go
|
package test
|
||
|
|
||
|
import (
|
||
|
"log"
|
||
|
"os"
|
||
|
|
||
|
"github.com/sirupsen/logrus"
|
||
|
)
|
||
|
|
||
|
// RmServerAppRecipe deletes the test server / app / recipe.
|
||
|
func RmServerAppRecipe() {
|
||
|
testAppLink := os.ExpandEnv("$HOME/.abra/servers/foo.com")
|
||
|
if err := os.Remove(testAppLink); err != nil {
|
||
|
logrus.Fatal(err)
|
||
|
}
|
||
|
|
||
|
testRecipeLink := os.ExpandEnv("$HOME/.abra/recipes/test")
|
||
|
if err := os.Remove(testRecipeLink); err != nil {
|
||
|
logrus.Fatal(err)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// MkServerAppRecipe symlinks the test server / app / recipe.
|
||
|
func MkServerAppRecipe() {
|
||
|
RmServerAppRecipe()
|
||
|
|
||
|
testAppDir := os.ExpandEnv("$PWD/../../tests/resources/testapp")
|
||
|
testAppLink := os.ExpandEnv("$HOME/.abra/servers/foo.com")
|
||
|
if err := os.Symlink(testAppDir, testAppLink); err != nil {
|
||
|
log.Fatal(err)
|
||
|
}
|
||
|
|
||
|
testRecipeDir := os.ExpandEnv("$PWD/../../tests/resources/testrecipe")
|
||
|
testRecipeLink := os.ExpandEnv("$HOME/.abra/recipes/test")
|
||
|
if err := os.Symlink(testRecipeDir, testRecipeLink); err != nil {
|
||
|
log.Fatal(err)
|
||
|
}
|
||
|
}
|