Package: hererocks
hererocksis a single file Python 2.7/3.x script for installingLua(orLuaJITormoonjitorRaptorJIT)
andLuaRocks, its package manager, into a local directory.
It configures Lua to only see packages installed by that bundled version of LuaRocks, so that the installation is isolated.Basic usagehererockslua53-l5.3-rlatest# Install Lua 5.3 with latest LuaRocks into 'lua53' directory.sourcelua53/bin/activate# Run activation script, adding 'lua53/bin' to $PATH.lua-v# Lua, LuaRocks, and programsluarocksinstallluacheck# installed using LuaRocksluacheck--version# can now be used.deactivate-lua# Remove 'lua53/bin' from $PATH.lua53/bin/lua-v# All the binaries can still be used directly.For more info see below or runhererocks--helpfor a complete listing of options.InstallationUsingpip: runpip installgit+https://github.com/luarocks/hererocks, usingsudoif necessary.Manually: download hererocks withwgethttps://raw.githubusercontent.com/luarocks/hererocks/latest/hererocks.py, then usepython hererocks.py ...to run it.RequirementsPython 2.7 or 3.xGit for installing from Git repositories.Compiler:Windows: MinGW with tools such asgccin PATH, or Visual Studio 2008 or later (see help message for--target).OS X:cc.Other systems:gcc.Activation scriptshererockswrites several activation scripts intobinsubdirectory of the installation directory.
When sourced (on Windows: simply executed) they add path to that subdirectory toPATHenvironment variable.
This allows one to uselua,luarocksand other programs installed in the created environment directly.
Additionally, activation scripts makedeactivate-luacommand available. It removes path to currently activated
environment fromPATH. Activating an environment deactivates the previous one automatically, if it exists.Several versions of activation scripts are installed to support various shells:Windows:Batch:activate.bat.PowerShell:activate.ps1.Other systems:Bash, Zsh, Dash:activate.Fish:activate.fish.Tcsh, csh:activate.csh.Command-line optionsInstallation locationThe first argument ofhererockscommand should be path to the directory where Lua and/or LuaRocks should be installed. If it does not exist, it will be created.If installation directory already has Lua installed, a new version of Lua or LuaRocks can be installed over it as a seamless upgrade (packages installed with LuaRocks will keep working) provided new and old Lua minor versions are same. E.g. Lua 5.1.5 and LuaJIT 2.1 can be installed over Lua 5.1.1, but not over Lua 5.2.1. Otherwise, when installing an incompatible Lua version, the installation directory should be removed prior to runninghererocks. Ifhererocksdetects that it has already installed requested version of Lua or LuaRocks built with same options into the directory, it will skip installation for that program, unless--ignore-installed/-iis used.After installation Lua and LuaRocks binaries will be in thebinsubdirectory of the installation directory. Scripts installed using LuaRocks will also turn up there. Lua binary is always namedlua, even if it’s LuaJIT under the hood, and LuaRocks binary is namedluarocksas usual.Version selection--lua/-l,--luajit/-j,--moonjit/-m,--raptorjitand--luarocks/-roptions select versions of programs to install.
There are three ways to specify how to fetch the sources:Using version number, such as5.1.5. If patch or minor versions are left out the latest possible version will be used, e.g. for Lua5.2is currently equivalent to5.2.4and for LuaJIT2.1is same as2.1.0-beta3.latestor^can be used to select the latest stable version.hererockswill fetch and unpack sources of the selected version from corresponding downloads location, verifying their SHA256 checksum.Using git URI plus reference to checkout, separated by@. Default reference ismaster, and there are default git URIs for Lua (https://github.com/lua/lua), LuaJIT (https://github.com/luajit/luajit) and LuaRocks (https://github.com/luarocks/luarocks). For instance,--luajit@458a40binstalls from a commit at the LuaJIT git repository and--luajit@installs from its master branch.hererockswill usegitcommand for cloning.Using path to a local directory.Compatibility flagsLua and LuaJIT have some flags that add compatibility with other Lua versions. Lua 5.1 has several options for compatibility with Lua 5.0 (on by default), Lua 5.2 has 5.1 compatibility flag (on by default), Lua 5.3 - both 5.1 and 5.2 compatibility flags (only 5.2 compatibility is on by default), and LuaJIT has 5.2 flag (off by default).hererockscan change these flags before building when using--compatoption. Possible arguments aredefault,none,all,5.1and5.2.Installing standard PUC-Rio LuaAvailable versions: 5.1 - 5.1.5, 5.2.0 - 5.2.4, 5.3.0 - 5.3.6, 5.4.0 - 5.4.4.latestand^version aliases point to5.4.4.Use5.1.0to install Lua5.1which was released without patch version for some reason.When building Lua,hererockstries to emulate a sensiblemaketarget. The default can be seen in the help message printed byhererocks--help. To select another target use--targetoption.Installing LuaJITAvailable versions: 2.0.0 - 2.0.5, 2.1.0-beta1 - 2.1.0-beta3.latestand^version aliases point to2.0.5.TheOpenRestyfork could be installed with the git URI option:--luajithttps://github.com/openresty/luajit2.git@v2.1-agentzh.Installing moonjitAvailable versions: 2.1.1 - 2.2.0.latestand^version aliases point to2.1.2.Installing RaptorJITAvailable versions: 1.0.0 - 1.0.3.latestand^version aliases point to1.0.3.Luarocks supports RaptorJIT since 3.2.0.Installing LuaRocksAvailable versions: 2.0.8 - 2.4.4, 3.0.0 - 3.8.0.latestand^version aliases point to3.8.0.Version 2.0.8 does not support Lua 5.2. Versions 2.0.8 - 2.1.2 do not support Lua 5.3.Using hererocks to set up automated testingPopular continuous integration services such asTravis-CIandDrone.iodo not support Lua out of the box. That can be solved using hererocks in just a couple of lines. Here is an example of Travis-CI configuration file (.travis.yml) using hererocks to install a rock and runBustedtest suite under Lua 5.1, 5.2, 5.3, LuaJIT 2.0 and 2.1:language:python# Can use any language here, but if it's not 'python'# it becomes necessary to pass '--user' to pip when installing hererocks.env:-LUA="lua 5.1"-LUA="lua 5.2"-LUA="lua 5.3"-LUA="lua 5.4"-LUA="luajit 2.0"-LUA="luajit 2.1"before_install:-pip install hererocks-hererocks env --$LUA -rlatest# Use latest LuaRocks, install into 'env' directory.-source env/bin/activate# Add directory with all installed binaries to PATH.-luarocks install bustedinstall:-luarocks make# Install the rock, assuming there is a rockspec# in the root of the repository.script:-bustedEquivalent configuration (appveyor.yml) forAppveyorthat allows testing on Windows:environment:matrix:-LUA:"lua5.1"-LUA:"lua5.2"-LUA:"lua5.3"-LUA:"lua5.4"-LUA:"luajit2.0"-LUA:"luajit2.1"before_build:-set PATH=C:\Python27\Scripts;%PATH%# Add directory containing 'pip' to PATH-pip install hererocks-hererocks env --%LUA% -rlatest-call env\bin\activate-luarocks install bustedbuild_script:-luarocks maketest_script:-busted