Gitfed
bastien-mrq/gitfed / cmd / gitfed-install / source.go
package main

import (
	"os"
	"path/filepath"
	"strings"
)

// defaultSourceURL is gitfed's own public repo, cloned over anonymous
// HTTPS — dogfooding the exact feature described in docs/HOW_IT_WORKS.
// Overridable (see main.go's -source flag) for anyone running a fork.
const defaultSourceURL = "https://git.neuromancer.ovh/bastien-mrq/gitfed.git"

// sourceDirName is where the clone lands inside the working directory
// gitfed-install creates for itself.
const sourceDirName = "gitfed-src"

func readVersion(sourceDir string) (string, error) {
	b, err := os.ReadFile(filepath.Join(sourceDir, "VERSION"))
	if err != nil {
		return "", err
	}
	return strings.TrimSpace(string(b)), nil
}

func dockerfilePath(sourceDir string) string {
	return filepath.Join(sourceDir, "deploy", "docker", "Dockerfile")
}

func manifestPath(sourceDir, relPath string) string {
	return filepath.Join(sourceDir, relPath)
}