12

I hunted around but I couldn't determine if this is possible.

Basically, http://luarocks.org is down, and I already have a copy of luafilesystem installed on another machine locally here. With Ruby, it's possible to cross install ruby gems using the 'gem' command locally. I'm wondering if the same is possible with rocks and luarocks.

Is there any way to 'cross-install' a rock (for instance, luafilesystem), by using another local installation of that rock?

Something like:

luarocks install //10.0.1.123/machine/path/to/luafilesystem/on/other/machine

is what I'd like to be able to do.

UPDATE: I'd even be happy with how to install a rock from the .tar.gz or .zip, for instance, if I downloaded one of the images from this location (in the case of LuaFileSystem).

In which case, the 'source' for the install would / could be local to the machine, rather than remote (and wouldn't necessarily already be installed as a rock).

3 Answers 3

27

If you have the source zip, you can unpack it and point luarocks to the the rockspec file. Here is how I installed 'busted' from source.

git clone https://github.com/Olivine-Labs/busted.git
luarocks install busted/busted-1.3-1.rockspec

Or install it directly from source

cd busted
luarocks make
2
  • Thanks @Robert Wahler - You have answered my "UPDATE:" to the question, which is quite helpful. I was hoping to also get an answer for my original question too (which is to install a rock from one that's already installed--but perhaps that's not possible). In any case, you get an upvote from me!
    – likethesky
    Commented Nov 18, 2012 at 18:14
  • 1
    I don't know of an automatic way to do what you ask since on install, the code and bin wrappers can end up in different locations. For both gems and rocks, I create a vendor folder that is embedded in each project so deployments don't depend on 3dparty hosted services like rubygems.org or luarocks.org. Commented Nov 19, 2012 at 23:38
12

If Someone want an installation from the local source rock.

Just do this:

cd /path/to/source-rock
luarocks make source-rock.rockspec

NOTE:

Use make instead of install. The reason is here (quoted below).

LuaRocks offers this:

make Compile package in current directory using a rockspec.

install Install a rock.

However, install does not utilize the present make. It tries to download and recompile the same package from the server instead of the one I customized locally.

Any way round this?

The make command will actually build and install your customized rockspec. The poor naming choice causes confusion every now and then, I know.

11

LuaRocks has a pack subcommand that will create a binary rock (a zip file containing all files for an installed module). You can use that binary rock to install the same module on another computer, given that the architecture matches.

E.g.

luarocks pack luafilesystem

produces luafilesystem-1.6.2-2.linux-x86_64.rock on my machine, and

luarocks install luafilesystem-1.6.2-2.linux-x86_64.rock

will reinstall luafilesystem with no internet connection necessary.

Not the answer you're looking for? Browse other questions tagged or ask your own question.