aboutsummaryrefslogtreecommitdiff
path: root/docs/luarocks_unpack.md
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--docs/luarocks_unpack.md61
1 files changed, 61 insertions, 0 deletions
diff --git a/docs/luarocks_unpack.md b/docs/luarocks_unpack.md
new file mode 100644
index 00000000..4fa8754a
--- /dev/null
+++ b/docs/luarocks_unpack.md
@@ -0,0 +1,61 @@
1# luarocks unpack
2
3Unpack the contents of a rock.
4
5## Usage
6
7`luarocks unpack [--force] {<rock> | <rockspec> | <name> [<version>]}`
8
9Unpacks the contents of a rock in a newly created directory under the current
10directory. Argument may be a rock file, a rockspec file, or the name of a
11rock/rockspec in a remote repository.
12
13If `--force` is passed, files are unpacked even if the output directory
14already exists.
15
16When a rock is given, LuaRocks creates a directory and extracts the contents
17of a rock inside it. If it is a `.src.rock` file, it also extracts the
18sources, and copies the rock's rockspec to the root of the sources directory,
19so that you can run [luarocks make](luarocks_make.md).
20
21When a rockspec is given, LuaRocks creates a directory and then fetches and
22extracts the sources for the module inside it. It also copies the rockspec to
23the root of the sources directory.
24
25When a binary rock is given, it just extracts the contents of the rock in the
26created directory for further inspection. To fetch the sources, you can run
27`luarocks unpack` again on the rockspec file that will be extracted from the
28binary rock.
29
30When a name (and optionally a version) is given, LuaRocks tries to download a
31source rock or a rockspec from remote repositories, and then proceeds as if
32the obtained file was provided locally.
33
34## Examples
35
36```
37luarocks unpack luafilesystem 1.4.0
38```
39
40This fetches `luafilesystem-1.4.0-1.src.rock` from the remote repository and
41creates in the current directory a directory called `luafilesystem-1.4.0-1`
42with the contents of the rock, including the LuaFileSystem sources unpacked.
43You will then be able to go into the
44`luafilesystem-1.4.0-1/luafilesystem-1.4.0` directory and run [luarocks
45make](luarocks_make.md).
46
47```
48luarocks unpack copas-1.1.1-1.rockspec
49```
50
51Assuming you have `copas-1.1.1-1.rockspec` in the current directory, this
52creates in the current directory a directory called `copas-1.1.1-1` with the
53rockspec and the Copas sources unpacked. You will then be able to go into the
54`copas-1.1.1-1/copas-1.1.1` directory and run [luarocks
55make](luarocks_make.md).
56
57While the extracted directory names may look repetitive, note that the first
58directory is a directory in a LuaRocks "name-version-revision" format, and the
59second directory is the directory contained inside the sources archives, which
60may be in any format, and in some cases may not even exist.
61