aboutsummaryrefslogtreecommitdiff
path: root/internal/github/filesystem.go
diff options
context:
space:
mode:
authorSlack Coder <slackcoder@server.ky>2024-08-05 04:48:55 -0500
committerSlack Coder <slackcoder@server.ky>2024-08-05 04:48:55 -0500
commitd7b3c49d5cf467b90ce6f3399e77caa630f01a49 (patch)
tree4b825dc642cb6eb9a060e54bf8d69288fbee4904 /internal/github/filesystem.go
parent8161ec7d53a4c921c61b3e6e936daac63ca06d9e (diff)
downloadmirror-d7b3c49d5cf467b90ce6f3399e77caa630f01a49.tar.xz
Set To Do branch
Diffstat (limited to 'internal/github/filesystem.go')
-rw-r--r--internal/github/filesystem.go63
1 files changed, 0 insertions, 63 deletions
diff --git a/internal/github/filesystem.go b/internal/github/filesystem.go
deleted file mode 100644
index 3f069b4..0000000
--- a/internal/github/filesystem.go
+++ /dev/null
@@ -1,63 +0,0 @@
-package github
-
-import (
- "fmt"
- "net/url"
- "os"
- "path"
- "strings"
-)
-
-func listReleasesByTagName(dst *url.URL) ([]string, error) {
- entries, err := os.ReadDir(dst.Path)
- if err != nil {
- return nil, err
- }
-
- var tagNames []string
- for _, entry := range entries {
- tagNames = append(tagNames, entry.Name())
- }
-
- return tagNames, nil
-}
-
-// The path which project release assets are saved.
-func localReleaseFilePath(dst *url.URL, tagName string) string {
- return path.Join(dst.Path, tagName)
-}
-
-func releaseName(tagName string) string {
- version := tagName
- if strings.HasPrefix(version, "v") {
- version = strings.TrimLeft(version, "v")
- }
-
- return version
-}
-
-// The source filename for a Github release.
-//
-// # The source code URL provided by Github's API only references the tag name
-//
-// for the release. To make it useful for users, we rename to file to include
-// the project name as their website does.
-func releaseSourceFileName(project string, tagName string, ext string) string {
- return fmt.Sprintf("%s-%s.%s", project, releaseName(tagName), ext)
-}
-
-func removeRelease(dst *url.URL, tagName string) error {
- fp := localReleaseFilePath(dst, tagName)
- return os.RemoveAll(fp)
-}
-
-func isFileExist(fp string) (bool, error) {
- _, err := os.Stat(fp)
- if os.IsNotExist(err) {
- return false, nil
- } else if err != nil {
- return false, err
- }
-
- return true, nil
-}