diff options
Diffstat (limited to 'docs/luarocks_write_rockspec.md')
-rw-r--r-- | docs/luarocks_write_rockspec.md | 75 |
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 | |||
3 | Write a template for a rockspec file. | ||
4 | |||
5 | ## Usage | ||
6 | |||
7 | `[--output=<file>] [...] [<name>] [<version>] [<url>|<path>]` | ||
8 | |||
9 | This commands creates an initial version of a rockspec for a rock | ||
10 | based on name, version, and location of its sources. The resulting | ||
11 | rockspec is just a template: several fields, such as `dependencies`, | ||
12 | have to be filled by hand. | ||
13 | |||
14 | If only two arguments are given, the first one is considered the name and the | ||
15 | second one is the location. | ||
16 | If only one argument is given, it must be the location. | ||
17 | If no arguments are given, current directory is used as location. | ||
18 | LuaRocks will attempt to infer name and version if not given, | ||
19 | using "scm" as default version. | ||
20 | |||
21 | If location is a local directory and a Git or Mercurial repository, | ||
22 | source URL will be inferred from it. | ||
23 | |||
24 | Resulting rockspec is created in current directory, with file name | ||
25 | based on rock name and version. Output location can be changed using `--output` option. | ||
26 | |||
27 | Several 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 | |||
42 | LuaRocks will attempt to fill `build` table of the rockspec using | ||
43 | [builtin build back-end](rockspec_format.md#builtin), listing files from `src` | ||
44 | and `lua` directories in project sources. | ||
45 | |||
46 | ## Example | ||
47 | |||
48 | Creating an scm rockspec for a project hosted in a Git repository: | ||
49 | |||
50 | ``` | ||
51 | mkdir my-rock | ||
52 | cd my-rock | ||
53 | git init . | ||
54 | git remote add origin https://github.com/my-username/my-rock | ||
55 | luarocks write-rockspec | ||
56 | ``` | ||
57 | |||
58 | This creates `my-rock-scm-1.rockspec` file: | ||
59 | |||
60 | ```lua | ||
61 | package = "my-rock" | ||
62 | version = "scm-1" | ||
63 | source = { | ||
64 | url = "git+https://github.com/my-username/my-rock" | ||
65 | } | ||
66 | description = { | ||
67 | homepage = "https://github.com/my-username/my-rock", | ||
68 | license = "*** please specify a license ***" | ||
69 | } | ||
70 | dependencies = {} | ||
71 | build = { | ||
72 | type = "builtin", | ||
73 | modules = {} | ||
74 | } | ||
75 | ``` | ||