annotate luabuild/luarocks-2.0.12/src/luarocks/make_manifest.lua @ 1130:54653afec7cc

<GreyKnight> (cd luabuild/luarocks-2.0.12; make)
author HackBot
date Fri, 14 Dec 2012 22:22:17 +0000
parents 87f6d05d4b4a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1125
87f6d05d4b4a <GreyKnight> (cd luabuild; tar xf luarocks-2.0.12.tar.gz)
HackBot
parents:
diff changeset
1
87f6d05d4b4a <GreyKnight> (cd luabuild; tar xf luarocks-2.0.12.tar.gz)
HackBot
parents:
diff changeset
2 --- Module implementing the luarocks-admin "make_manifest" command.
87f6d05d4b4a <GreyKnight> (cd luabuild; tar xf luarocks-2.0.12.tar.gz)
HackBot
parents:
diff changeset
3 -- Compile a manifest file for a repository.
87f6d05d4b4a <GreyKnight> (cd luabuild; tar xf luarocks-2.0.12.tar.gz)
HackBot
parents:
diff changeset
4 module("luarocks.make_manifest", package.seeall)
87f6d05d4b4a <GreyKnight> (cd luabuild; tar xf luarocks-2.0.12.tar.gz)
HackBot
parents:
diff changeset
5
87f6d05d4b4a <GreyKnight> (cd luabuild; tar xf luarocks-2.0.12.tar.gz)
HackBot
parents:
diff changeset
6 local manif = require("luarocks.manif")
87f6d05d4b4a <GreyKnight> (cd luabuild; tar xf luarocks-2.0.12.tar.gz)
HackBot
parents:
diff changeset
7 local index = require("luarocks.index")
87f6d05d4b4a <GreyKnight> (cd luabuild; tar xf luarocks-2.0.12.tar.gz)
HackBot
parents:
diff changeset
8 local cfg = require("luarocks.cfg")
87f6d05d4b4a <GreyKnight> (cd luabuild; tar xf luarocks-2.0.12.tar.gz)
HackBot
parents:
diff changeset
9 local util = require("luarocks.util")
87f6d05d4b4a <GreyKnight> (cd luabuild; tar xf luarocks-2.0.12.tar.gz)
HackBot
parents:
diff changeset
10 local deps = require("luarocks.deps")
87f6d05d4b4a <GreyKnight> (cd luabuild; tar xf luarocks-2.0.12.tar.gz)
HackBot
parents:
diff changeset
11
87f6d05d4b4a <GreyKnight> (cd luabuild; tar xf luarocks-2.0.12.tar.gz)
HackBot
parents:
diff changeset
12 help_summary = "Compile a manifest file for a repository."
87f6d05d4b4a <GreyKnight> (cd luabuild; tar xf luarocks-2.0.12.tar.gz)
HackBot
parents:
diff changeset
13
87f6d05d4b4a <GreyKnight> (cd luabuild; tar xf luarocks-2.0.12.tar.gz)
HackBot
parents:
diff changeset
14 help = [[
87f6d05d4b4a <GreyKnight> (cd luabuild; tar xf luarocks-2.0.12.tar.gz)
HackBot
parents:
diff changeset
15 <argument>, if given, is a local repository pathname.
87f6d05d4b4a <GreyKnight> (cd luabuild; tar xf luarocks-2.0.12.tar.gz)
HackBot
parents:
diff changeset
16 ]]
87f6d05d4b4a <GreyKnight> (cd luabuild; tar xf luarocks-2.0.12.tar.gz)
HackBot
parents:
diff changeset
17
87f6d05d4b4a <GreyKnight> (cd luabuild; tar xf luarocks-2.0.12.tar.gz)
HackBot
parents:
diff changeset
18 --- Driver function for "make_manifest" command.
87f6d05d4b4a <GreyKnight> (cd luabuild; tar xf luarocks-2.0.12.tar.gz)
HackBot
parents:
diff changeset
19 -- @param repo string or nil: Pathname of a local repository. If not given,
87f6d05d4b4a <GreyKnight> (cd luabuild; tar xf luarocks-2.0.12.tar.gz)
HackBot
parents:
diff changeset
20 -- the default local repository configured as cfg.rocks_dir is used.
87f6d05d4b4a <GreyKnight> (cd luabuild; tar xf luarocks-2.0.12.tar.gz)
HackBot
parents:
diff changeset
21 -- @return boolean or (nil, string): True if manifest was generated,
87f6d05d4b4a <GreyKnight> (cd luabuild; tar xf luarocks-2.0.12.tar.gz)
HackBot
parents:
diff changeset
22 -- or nil and an error message.
87f6d05d4b4a <GreyKnight> (cd luabuild; tar xf luarocks-2.0.12.tar.gz)
HackBot
parents:
diff changeset
23 function run(...)
87f6d05d4b4a <GreyKnight> (cd luabuild; tar xf luarocks-2.0.12.tar.gz)
HackBot
parents:
diff changeset
24 local flags, repo = util.parse_flags(...)
87f6d05d4b4a <GreyKnight> (cd luabuild; tar xf luarocks-2.0.12.tar.gz)
HackBot
parents:
diff changeset
25
87f6d05d4b4a <GreyKnight> (cd luabuild; tar xf luarocks-2.0.12.tar.gz)
HackBot
parents:
diff changeset
26 assert(type(repo) == "string" or not repo)
87f6d05d4b4a <GreyKnight> (cd luabuild; tar xf luarocks-2.0.12.tar.gz)
HackBot
parents:
diff changeset
27 repo = repo or cfg.rocks_dir
87f6d05d4b4a <GreyKnight> (cd luabuild; tar xf luarocks-2.0.12.tar.gz)
HackBot
parents:
diff changeset
28
87f6d05d4b4a <GreyKnight> (cd luabuild; tar xf luarocks-2.0.12.tar.gz)
HackBot
parents:
diff changeset
29 util.printout("Making manifest for "..repo)
87f6d05d4b4a <GreyKnight> (cd luabuild; tar xf luarocks-2.0.12.tar.gz)
HackBot
parents:
diff changeset
30
87f6d05d4b4a <GreyKnight> (cd luabuild; tar xf luarocks-2.0.12.tar.gz)
HackBot
parents:
diff changeset
31 local ok, err = manif.make_manifest(repo, deps.get_deps_mode(flags))
87f6d05d4b4a <GreyKnight> (cd luabuild; tar xf luarocks-2.0.12.tar.gz)
HackBot
parents:
diff changeset
32 if ok then
87f6d05d4b4a <GreyKnight> (cd luabuild; tar xf luarocks-2.0.12.tar.gz)
HackBot
parents:
diff changeset
33 util.printout("Generating index.html for "..repo)
87f6d05d4b4a <GreyKnight> (cd luabuild; tar xf luarocks-2.0.12.tar.gz)
HackBot
parents:
diff changeset
34 index.make_index(repo)
87f6d05d4b4a <GreyKnight> (cd luabuild; tar xf luarocks-2.0.12.tar.gz)
HackBot
parents:
diff changeset
35 end
87f6d05d4b4a <GreyKnight> (cd luabuild; tar xf luarocks-2.0.12.tar.gz)
HackBot
parents:
diff changeset
36 return ok, err
87f6d05d4b4a <GreyKnight> (cd luabuild; tar xf luarocks-2.0.12.tar.gz)
HackBot
parents:
diff changeset
37 end