From 6dee59e45b345b2a5329cd77a678006dc60c37a6 Mon Sep 17 00:00:00 2001 From: Drew Short Date: Thu, 18 Jan 2018 17:30:48 -0600 Subject: [PATCH] Adjusting for the embedded master path for github repositories --- src/spm/spm.moon | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/spm/spm.moon b/src/spm/spm.moon index 6b7fe0e..05d76ee 100644 --- a/src/spm/spm.moon +++ b/src/spm/spm.moon @@ -23,9 +23,15 @@ localInstalledPackagesFile = "/etc/spdata.svd" localConfigFile = "/etc/spm.cfg" class Repository - new: (name, src) => + new: (name, src, isGithub) => @name = name @src = src + @isGithub = isGithub + + getRepoPath: => + if @isGithub + return @src .. "/master" + @src args, options = shell.parse(...) @@ -77,14 +83,15 @@ getRepositories = (repoLocation) -> continue if repository.src == nil and repository.repo == nil - print("Repository malformed/unsupported:" .. repositoryName) + print("Repository malformed/unsupported: " .. repositoryName) continue src = repository.src - + isGithub = false if src == nil - src = githubContentRoot .. repository.repo .."/master" - repositories[repositoryName] = Repository(repositoryName, src) + src = githubContentRoot .. repository.repo + isGithub = true + repositories[repositoryName] = Repository(repositoryName, src, isGithub) repositories @@ -179,7 +186,7 @@ listPackages = (filter) -> for _, repository in pairs(repositories) print("Checking Repository " .. repository.src) - packages = getPackages(repository.src) + packages = getPackages(repository\getRepoPath) if packages == nil io.stderr\write("Error while trying to receive package list for " .. repository.src .. "\n") @@ -236,7 +243,7 @@ getInformation = (requestedPackage) -> return for _, repository in pairs(repositories) - packages = getPackages(repository.src) + packages = getPackages(repository\getRepoPath) if packages == nil io.stderr\write("Error while trying to receive package list for " .. repository.src .. "\n")