Skip to content
This repository has been archived by the owner on Mar 31, 2023. It is now read-only.

Commit

Permalink
Release 0.38.1
Browse files Browse the repository at this point in the history
  • Loading branch information
talwat committed May 22, 2022
1 parent 7451aaa commit 1b9b947
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 18 deletions.
2 changes: 1 addition & 1 deletion github.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type GHFile struct {

func sendGithubRequest(url string) (string, http.Header) {
tokenLen := len(config.Github.Token)
if tokenLen >= 4 && config.Github.Username != "" {
if tokenLen >= 4 && config.Github.Username != "" { // Check if the token & username are set properly
debugLog(
"Sending request to %s with username %s and token (last 4 digits) %s",
bolden(url), bolden(config.Github.Username),
Expand Down
13 changes: 10 additions & 3 deletions input.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,16 @@ import (
"strings"
)

const version = "0.38"

var purge, debug, assumeYes, force, noDeps, ignoreRoot bool = false, false, false, false, false, false
const version = "0.38.1"

var (
purge bool = false
debug bool = false
assumeYes bool = false
force bool = false
noDeps bool = false
ignoreRoot bool = false
)

var optionToOthers, optionToOther bool = false, false

Expand Down
4 changes: 2 additions & 2 deletions load.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ func loadPkg(packageFile string, pkgName string) Package {

keySlice := make([]string, 0)

for key := range environmentVariables {
for key := range environmentVariables { // Iterate through environment variables & add them to keySlice
keySlice = append(keySlice, key)
}

debugLog("Replacing environment variables...")

for _, key := range keySlice {
for _, key := range keySlice { // Iterate through keySlice & replace them in the package file with their proper values
environmentVariables["PREFIX"] = config.Paths.Prefix
debugLog("Replacing %s with %s...", key, environmentVariables[key])
packageFile = strings.ReplaceAll(packageFile, ":("+key+"):", environmentVariables[key])
Expand Down
2 changes: 1 addition & 1 deletion pkgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func installPkgs(pkgNames []string) {
toCheckName = getPkgNameFromURL(pkgName)
case isFile:
split := strings.Split(pkgName, "/")
toCheckName = strings.TrimSuffix(split[len(split)-1], ".json")
toCheckName = strings.TrimSuffix(split[len(split)-1], ".json") // Get final part of path, without .json file extension
default:
toCheckName = pkgName
}
Expand Down
7 changes: 2 additions & 5 deletions repo.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package main

import (
"os"
"strings"
)

Expand Down Expand Up @@ -48,7 +47,7 @@ func stripSources(sourcesFile string, noParse bool) ([]string, string) {

// Iterate through each line
for _, line := range strings.Split(strings.TrimSpace(sourcesFile), "\n") {
if strings.HasPrefix(line, "#") || strings.TrimSpace(line) == "" {
if strings.HasPrefix(line, "#") || strings.TrimSpace(line) == "" { // Skip comments and empty lines
continue
}

Expand All @@ -74,8 +73,7 @@ func addRepo(repoLink string) {
if force {
log(3, "Invalid url, but continuing because force is set to true.")
} else {
log(4, "Invalid url: %s.", bolden(repoLink))
os.Exit(1)
errorLogRaw("Invalid url: %s", bolden(repoLink))
}
}

Expand All @@ -87,7 +85,6 @@ func addRepo(repoLink string) {
log(3, "Repo %s already exists in sources file, but continuing because force is set to true.", bolden(repoLink))
} else {
errorLogRaw("Repo %s already exists in sources file", bolden(repoLink))
os.Exit(1)
}
}

Expand Down
12 changes: 6 additions & 6 deletions updating.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func updateAllPackages() {

chapLog("==>", "", "Getting installed packages")

installedPackages := make([]string, 0)
installedPkgs := make([]string, 0)

log(1, "Getting contents of %s", bolden(infoPath))

Expand All @@ -56,16 +56,16 @@ func updateAllPackages() {
log(1, "Iterating through contents of %s", bolden(infoPath))

for _, file := range files {
installedPackages = append(installedPackages, strings.ReplaceAll(file.Name(), ".json", ""))
installedPkgs = append(installedPkgs, strings.TrimSuffix(file.Name(), ".json")) // Trim .json from end of file name & append to installedPkgs
}

chapLog("=>", "", "Updating packages")

for _, installedPackage := range installedPackages { // Iterate through installed packages
chapLog("==>", "", "Updating %s", installedPackage)
rawGetInfo(installedPackage, readLoad(installedPackage))
for _, pkgName := range installedPkgs { // Iterate through installed packages
chapLog("==>", "", "Updating %s", pkgName)
rawGetInfo(pkgName, readLoad(pkgName))
chapLog("===>", textCol.Green, "Success")
log(0, "Successfully updated package info for %s.", bolden(installedPackage))
log(0, "Successfully updated package info for %s.", bolden(pkgName))
}

chapLog("=>", textCol.Green, "Success")
Expand Down

0 comments on commit 1b9b947

Please sign in to comment.