0
0
forked from toolshed/abra

fix: skip name validation for remote recipes

See toolshed/abra#601
This commit is contained in:
2025-08-18 08:56:52 +02:00
parent 60b3af1fa4
commit 1aa7016789
3 changed files with 17 additions and 11 deletions

View File

@ -59,8 +59,10 @@ func ValidateRecipe(args []string, cmdName string) recipe.Recipe {
} }
if _, ok := knownRecipes[recipeName]; !ok { if _, ok := knownRecipes[recipeName]; !ok {
if !strings.Contains(recipeName, "/") {
log.Fatalf("no recipe '%s' exists?", recipeName) log.Fatalf("no recipe '%s' exists?", recipeName)
} }
}
chosenRecipe := recipe.Get(recipeName) chosenRecipe := recipe.Get(recipeName)
if err := chosenRecipe.EnsureExists(); err != nil { if err := chosenRecipe.EnsureExists(); err != nil {

View File

@ -22,14 +22,16 @@ teardown(){
} }
@test "retrieve recipe if missing" { @test "retrieve recipe if missing" {
run rm -rf "$ABRA_DIR/recipes/$TEST_RECIPE" if [[ -d "$ABRA_DIR/recipe/custom-html" ]]; then
run rm -rf "$ABRA_DIR/recipes/custom-html"
assert_success assert_success
assert_not_exists "$ABRA_DIR/recipes/$TEST_RECIPE" assert_not_exists "$ABRA_DIR/recipes/custom-html"
fi
run $ABRA recipe lint "$TEST_RECIPE" run $ABRA recipe lint custom-html
assert_success assert_success
assert_exists "$ABRA_DIR/recipes/$TEST_RECIPE" assert_exists "$ABRA_DIR/recipes/custom-html"
} }
@test "bail if unstaged changes and no --chaos" { @test "bail if unstaged changes and no --chaos" {

View File

@ -30,15 +30,17 @@ teardown(){
} }
@test "retrieve recipe if missing" { @test "retrieve recipe if missing" {
run rm -rf "$ABRA_DIR/recipes/$TEST_RECIPE" if [[ -d "$ABRA_DIR/recipe/custom-html" ]]; then
run rm -rf "$ABRA_DIR/recipes/custom-html"
assert_success assert_success
assert_not_exists "$ABRA_DIR/recipes/$TEST_RECIPE" assert_not_exists "$ABRA_DIR/recipes/custom-html"
fi
run $ABRA recipe upgrade "$TEST_RECIPE" --no-input run $ABRA recipe upgrade "custom-html" --no-input
assert_success assert_success
assert_output --partial 'can upgrade service: app' assert_output --partial 'can upgrade service: app'
assert_exists "$ABRA_DIR/recipes/$TEST_RECIPE" assert_exists "$ABRA_DIR/recipes/custom-html"
} }
@test "error if unstaged changes" { @test "error if unstaged changes" {