Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 55 lines (48 sloc) 1.957 kb
3bfbb48 @drahosp Manifest update
drahosp authored
1 #!/bin/env lua
2
3 --- A GitHub specific manifest generator for the LuaDist deployment utility
4 local per = require "dist.persist"
5 local man = require "dist.manifest"
6 local fet = require "dist.fetch"
7
8 -- Collect URLs of repos for each module
9 local modules = io.open(".gitmodules", "r")
10 local repo = {}
11 for line in modules:lines() do
12 url = line:match("%surl%s=%s([^%s]+)")
13 if name and url then
14 repo[name] = url
15 end
16 name = line:match("%spath%s=%s([^%s]+)")
17 end
18 modules:close()
19
20 -- Collect tags for each module
21 local manifest = {}
22 for name, url in pairs(repo) do
23 local remote = io.popen("git ls-remote --tags "..url)
24 local tags = {}
25 table.insert(tags, "0 refs/tags/master")
26 for line in remote:lines() do
27 table.insert(tags, line)
28 end
29
30 -- Generate manifest entry for each tag if it contains valid dist.info
31 for line=#tags,1,-1 do
32 local hash, tag = tags[line]:match("([^%s]+)%srefs/tags/([^%s%^]+)$")
33 if hash and tag then
34 -- Collect dist.info for each tag
35 local url = "https://raw.github.com/LuaDist/"..name.."/"..tag.."/dist.info"
36 local info = man.info(per.loadText(fet.get(url)) or "")
37
38 -- Generate manifest entry for the dist
39 if info then
40 if (info.name ~= name) then print ("WARNING: Name mismatch in "..name.." and its dist.info") end
41 -- If master, mark dist version as scm
42 if tag == "master" then info.version = "scm" end
43 -- Small hack to generate correct filename
44 -- I apologize to GitHub for (ab)using their automated zip feature.
45 info.path = "https://nodeload.github.com/LuaDist/"..name.."/zipball/"..tag.."?/"..info.name.."-"..info.version..".dist"
46 print(info.name, info.version, info.path)
47 table.insert(manifest, info)
48 end
49 end
50 end
51 remote:close()
52 end
53
54 per.saveManifest("dist.manifest", manifest)
Something went wrong with that request. Please try again.