On Thu, Sep 2, 2010 at 3:00 PM, steve donovan <[email protected]> wrote:
> I like your idea of 'list --long' - let's see how 'show' goes!

Here's a first iteration: installation is simple [1]. Tested on Debian
Squeeze and Windows XP with LfW.

$ luarocks help show

luarocks show <argument>

show - Shows information about an installed rock.

<argument> is an existing package name.
Without any flags, show all module information.
With these flags, return only the desired information:
--home     home page of project
--modules  all modules provided by this package as used by require()
--deps     packages this package depends on
--rockspec the full path of the rockspec file
--mversion the package version

$ luarocks show alien
version:        0.5.0-1
summary:        Lua->C FFI
detailed:
Alien lets a Lua application call load dynamic libraries and call C functions
in a portable way, using libffi.

homepage:       http://alien.luaforge.net
directory:      /usr/local/lib/luarocks/rocks/alien/0.5.0-1
modules:        alien.struct alien.core alien
$ luarocks show alien --home
http://alien.luaforge.net
$ ls $(luarocks show alien --dir)
alien-0.5.0-1.rockspec  bin  doc  rock_manifest  samples  tests

The description information is read from the rockspec, and the module
information is extracted from the manifest.

There are a number of other flags that could be useful - like
'license' (I always forget this ;)).  The documentation directory for
a package is conventionally PACKAGE_DIR/doc and that could definitely
be useful, especially if we try to be a little clever and find a
suitable index.html or readme.txt, etc.

 We could also make 'luarocks show --info' present a useful summary of
the important global configuration parameters, like where the
configuration files are currently living.

I am unsure how to handle the multiple-version-and-repo issues:  it
picks the latest version from the last repo, which is _generally_ what
you want.  Here some guidance is needed...

steve d.

[1]
To install this (or any new command) put it in the luarocks module
directory (that is, something like /usr/local/share/lua/5.1/luarocks
or c:\Program Files\Lua\5.1\lua\luarocks).  For Unix, edit the
luarocks command, which is an executable Lua script and add

commands.show = require("luarocks.show")

to the end of the commands list.

On Windows, do the same but with luarocks.lua (which for LfW at least
sits in the Lua executable directory

Attachment: show.lua
Description: Binary data

_______________________________________________
Luarocks-developers mailing list
[email protected]
http://lists.luaforge.net/cgi-bin/mailman/listinfo/luarocks-developers

Reply via email to