Browse Source

Adjusting for the embedded master path for github repositories

environments/development/deployments/46
Drew Short 7 years ago
parent
commit
6dee59e45b
  1. 21
      src/spm/spm.moon

21
src/spm/spm.moon

@ -23,9 +23,15 @@ localInstalledPackagesFile = "/etc/spdata.svd"
localConfigFile = "/etc/spm.cfg" localConfigFile = "/etc/spm.cfg"
class Repository class Repository
new: (name, src) =>
new: (name, src, isGithub) =>
@name = name @name = name
@src = src @src = src
@isGithub = isGithub
getRepoPath: =>
if @isGithub
return @src .. "/master"
@src
args, options = shell.parse(...) args, options = shell.parse(...)
@ -77,14 +83,15 @@ getRepositories = (repoLocation) ->
continue continue
if repository.src == nil and repository.repo == nil if repository.src == nil and repository.repo == nil
print("Repository malformed/unsupported:" .. repositoryName)
print("Repository malformed/unsupported: " .. repositoryName)
continue continue
src = repository.src src = repository.src
isGithub = false
if src == nil 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 repositories
@ -179,7 +186,7 @@ listPackages = (filter) ->
for _, repository in pairs(repositories) for _, repository in pairs(repositories)
print("Checking Repository " .. repository.src) print("Checking Repository " .. repository.src)
packages = getPackages(repository.src)
packages = getPackages(repository\getRepoPath)
if packages == nil if packages == nil
io.stderr\write("Error while trying to receive package list for " .. repository.src .. "\n") io.stderr\write("Error while trying to receive package list for " .. repository.src .. "\n")
@ -236,7 +243,7 @@ getInformation = (requestedPackage) ->
return return
for _, repository in pairs(repositories) for _, repository in pairs(repositories)
packages = getPackages(repository.src)
packages = getPackages(repository\getRepoPath)
if packages == nil if packages == nil
io.stderr\write("Error while trying to receive package list for " .. repository.src .. "\n") io.stderr\write("Error while trying to receive package list for " .. repository.src .. "\n")

Loading…
Cancel
Save