aboutsummaryrefslogtreecommitdiff
path: root/docs/luarocks_write_rockspec.md
diff options
context:
space:
mode:
Diffstat (limited to 'docs/luarocks_write_rockspec.md')
-rw-r--r--docs/luarocks_write_rockspec.md75
1 files changed, 75 insertions, 0 deletions
diff --git a/docs/luarocks_write_rockspec.md b/docs/luarocks_write_rockspec.md
new file mode 100644
index 00000000..59b3fbe0
--- /dev/null
+++ b/docs/luarocks_write_rockspec.md
@@ -0,0 +1,75 @@
1# luarocks write_rockspec
2
3Write a template for a rockspec file.
4
5## Usage
6
7`[--output=<file>] [...] [<name>] [<version>] [<url>|<path>]`
8
9This commands creates an initial version of a rockspec for a rock
10based on name, version, and location of its sources. The resulting
11rockspec is just a template: several fields, such as `dependencies`,
12have to be filled by hand.
13
14If only two arguments are given, the first one is considered the name and the
15second one is the location.
16If only one argument is given, it must be the location.
17If no arguments are given, current directory is used as location.
18LuaRocks will attempt to infer name and version if not given,
19using "scm" as default version.
20
21If location is a local directory and a Git or Mercurial repository,
22source URL will be inferred from it.
23
24Resulting rockspec is created in current directory, with file name
25based on rock name and version. Output location can be changed using `--output` option.
26
27Several fields of the rockspec can be set explicitly:
28
29* `--license=<license>` sets license name, such as `MIT/X11` (by default inferred
30 from `COPYING`, `LICENSE`, or `MIT-LICENSE.txt` files, if they exist).
31* `--summary=<text>` sets short description (by default inferred from
32 `README.md` or `README` files, if they exist).
33* `--detailed=<text>` sets detailed description (by default inferred
34 from `README.md` or `README` files, if they exist).
35* `--homepage` sets project home page URL (by default may be inferred from source URL).
36* `--lua-version=<versions>` sets supported Lua versions. `<versions>` must be one of
37 "5.1", "5.2", "5.3", "5.1,5.2", "5.2,5.3", or "5.1,5.2,5.3".
38* `--rockspec-format=<version>` sets rockspec format version.
39* `--tag=<tag>` sets tag to use. Will attempt to extract version number from it.
40* `--lib=<lib>[,<lib>]` sets libraries that C files need to link with, filling [external_dependencies](rockspec_format.md#dependency-information) table. The argument should be a comma delimited list of names.
41
42LuaRocks will attempt to fill `build` table of the rockspec using
43[builtin build back-end](rockspec_format.md#builtin), listing files from `src`
44and `lua` directories in project sources.
45
46## Example
47
48Creating an scm rockspec for a project hosted in a Git repository:
49
50```
51mkdir my-rock
52cd my-rock
53git init .
54git remote add origin https://github.com/my-username/my-rock
55luarocks write-rockspec
56```
57
58This creates `my-rock-scm-1.rockspec` file:
59
60```lua
61package = "my-rock"
62version = "scm-1"
63source = {
64 url = "git+https://github.com/my-username/my-rock"
65}
66description = {
67 homepage = "https://github.com/my-username/my-rock",
68 license = "*** please specify a license ***"
69}
70dependencies = {}
71build = {
72 type = "builtin",
73 modules = {}
74}
75```