aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Ouellette <oue.paul18@gmail.com>2019-08-01 21:25:59 -0400
committerPaul Ouellette <oue.paul18@gmail.com>2019-08-01 23:53:03 -0400
commitd394ecba0cb8572b60483e23444ce79a9761a1aa (patch)
tree95b0e12cf2d2f0e7460394ea7e9fb63e5a55c9df
parentf52deeed485897511ecf80555e12a52c3e69d674 (diff)
downloadluarocks-d394ecba0cb8572b60483e23444ce79a9761a1aa.tar.gz
luarocks-d394ecba0cb8572b60483e23444ce79a9761a1aa.tar.bz2
luarocks-d394ecba0cb8572b60483e23444ce79a9761a1aa.zip
Remove duplication between build and make commands
-rw-r--r--src/luarocks/cmd/build.lua26
-rw-r--r--src/luarocks/cmd/make.lua48
2 files changed, 29 insertions, 45 deletions
diff --git a/src/luarocks/cmd/build.lua b/src/luarocks/cmd/build.lua
index 0b1864fc..428ede2a 100644
--- a/src/luarocks/cmd/build.lua
+++ b/src/luarocks/cmd/build.lua
@@ -19,7 +19,8 @@ local make = require("luarocks.cmd.make")
19local cmd = require("luarocks.cmd") 19local cmd = require("luarocks.cmd")
20 20
21function cmd_build.add_to_parser(parser) 21function cmd_build.add_to_parser(parser)
22 local cmd = parser:command("build", "Build and install a rock, compiling its C parts if any.", util.see_also()) 22 local cmd = parser:command("build", "Build and install a rock, compiling its C parts if any.\n"..
23 "If no arguments are given, behaves as luarocks make.", util.see_also())
23 :summary("Build/compile a rock.") 24 :summary("Build/compile a rock.")
24 :add_help("--help") 25 :add_help("--help")
25 26
@@ -29,29 +30,8 @@ function cmd_build.add_to_parser(parser)
29 cmd:argument("version", "Rock version.") 30 cmd:argument("version", "Rock version.")
30 :args("?") 31 :args("?")
31 32
32 cmd:flag("--pack-binary-rock", "Do not install rock. Instead, produce a "..
33 ".rock file with the contents of compilation in the current directory.")
34 cmd:flag("--keep", "Do not remove previously installed versions of the "..
35 "rock after building a new one. This behavior can be made permanent by "..
36 "setting keep_other_versions=true in the configuration file.")
37 cmd:flag("--force", "If --keep is not specified, force removal of "..
38 "previously installed versions if it would break dependencies.")
39 cmd:flag("--force-fast", "Like --force, but performs a forced removal "..
40 "without reporting dependency issues.")
41 cmd:option("--branch", "Override the `source.branch` field in the loaded "..
42 "rockspec. Allows to specify a different branch to fetch. Particularly "..
43 'for "dev" rocks.')
44 :argname("<name>")
45 cmd:flag("--only-deps", "Installs only the dependencies of the rock.") 33 cmd:flag("--only-deps", "Installs only the dependencies of the rock.")
46 cmd:flag("--verify", "Verify signature of the rockspec or src.rock being ".. 34 make.cmd_options(cmd)
47 "built. If the rockspec or src.rock is being downloaded, LuaRocks will "..
48 "attempt to download the signature as well. Otherwise, the signature "..
49 "file should be already available locally in the same directory.\n"..
50 "You need the signer’s public key in your local keyring for this "..
51 "option to work properly.")
52 cmd:flag("--sign", "To be used with --pack-binary-rock. Also produce a "..
53 "signature file for the generated .rock file.")
54 util.deps_mode_option(cmd)
55end 35end
56 36
57--- Build and install a rock. 37--- Build and install a rock.
diff --git a/src/luarocks/cmd/make.lua b/src/luarocks/cmd/make.lua
index da22a446..bc7c2c60 100644
--- a/src/luarocks/cmd/make.lua
+++ b/src/luarocks/cmd/make.lua
@@ -16,6 +16,31 @@ local deps = require("luarocks.deps")
16local writer = require("luarocks.manif.writer") 16local writer = require("luarocks.manif.writer")
17local cmd = require("luarocks.cmd") 17local cmd = require("luarocks.cmd")
18 18
19function make.cmd_options(parser)
20 parser:flag("--pack-binary-rock", "Do not install rock. Instead, produce a "..
21 ".rock file with the contents of compilation in the current directory.")
22 parser:flag("--keep", "Do not remove previously installed versions of the "..
23 "rock after building a new one. This behavior can be made permanent by "..
24 "setting keep_other_versions=true in the configuration file.")
25 parser:flag("--force", "If --keep is not specified, force removal of "..
26 "previously installed versions if it would break dependencies.")
27 parser:flag("--force-fast", "Like --force, but performs a forced removal "..
28 "without reporting dependency issues.")
29 parser:option("--branch", "Override the `source.branch` field in the loaded "..
30 "rockspec. Allows to specify a different branch to fetch. Particularly "..
31 'for "dev" rocks.')
32 :argname("<name>")
33 parser:flag("--verify", "Verify signature of the rockspec or src.rock being "..
34 "built. If the rockspec or src.rock is being downloaded, LuaRocks will "..
35 "attempt to download the signature as well. Otherwise, the signature "..
36 "file should be already available locally in the same directory.\n"..
37 "You need the signer’s public key in your local keyring for this "..
38 "option to work properly.")
39 parser:flag("--sign", "To be used with --pack-binary-rock. Also produce a "..
40 "signature file for the generated .rock file.")
41 util.deps_mode_option(parser)
42end
43
19function make.add_to_parser(parser) 44function make.add_to_parser(parser)
20 local cmd = parser:command("make", [[ 45 local cmd = parser:command("make", [[
21Builds sources in the current directory, but unlike "build", 46Builds sources in the current directory, but unlike "build",
@@ -40,28 +65,7 @@ only dependencies of the rockspec (see `luarocks help install`).
40 cmd:argument("rockspec", "Rockspec for the rock to build.") 65 cmd:argument("rockspec", "Rockspec for the rock to build.")
41 :args("?") 66 :args("?")
42 67
43 cmd:flag("--pack-binary-rock", "Do not install rock. Instead, produce a ".. 68 make.cmd_options(cmd)
44 ".rock file with the contents of compilation in the current directory.")
45 cmd:flag("--keep", "Do not remove previously installed versions of the "..
46 "rock after building a new one. This behavior can be made permanent by "..
47 "setting keep_other_versions=true in the configuration file.")
48 cmd:flag("--force", "If --keep is not specified, force removal of "..
49 "previously installed versions if it would break dependencies.")
50 cmd:flag("--force-fast", "Like --force, but performs a forced removal "..
51 "without reporting dependency issues.")
52 cmd:option("--branch", "Override the `source.branch` field in the loaded "..
53 "rockspec. Allows to specify a different branch to fetch. Particularly "..
54 'for "dev" rocks.')
55 :argname("<name>")
56 cmd:flag("--verify", "Verify signature of the rockspec or src.rock being "..
57 "built. If the rockspec or src.rock is being downloaded, LuaRocks will "..
58 "attempt to download the signature as well. Otherwise, the signature "..
59 "file should be already available locally in the same directory.\n"..
60 "You need the signer’s public key in your local keyring for this "..
61 "option to work properly.")
62 cmd:flag("--sign", "To be used with --pack-binary-rock. Also produce a "..
63 "signature file for the generated .rock file.")
64 util.deps_mode_option(cmd)
65end 69end
66 70
67--- Driver function for "make" command. 71--- Driver function for "make" command.