On Sun, May 8, 2011 at 7:46 PM, steve donovan <[email protected]> wrote:
> https://github.com/stevedonovan/LuaRocksTools/tree/master/api
Minor changes, hopefully more consistent. Certain serious quality
control issues have been dealt with, and there is now an install
function()
One of the use cases for an API is something like this:
local api = require 'luarocks.api'
local installed = api.list_map()
local available = api.search_map()
for package,info in pairs(available) do
local linfo = installed[package]
if linfo and api.updated(linfo,info) then
print(package,info.version,linfo.version)
end
end
Yep, it gives you a list of installed rocks that should be updated.
That made an install() function the next step. It seems to work OK,
and I'm working on how to make it less verbose.
local api = require 'luarocks.api'
local fs = require 'luarocks.fs'
function fs.execute_string(cmd) -- fs
cmd = cmd ..' >> /tmp/log.tmp 2>&1'
if os.execute(cmd) == 0 then
return true
else
return false
end
end
print(api.install(arg[1],nil,{quiet=true}))
With a monkey-patched fs.execute(), and the quiet flag redirecting
_G.print to nowhere, we get really quiet installs:
~/lua/api$ sudo lua install.lua stringy
gcc -O2 -fPIC -I/usr/include/lua5.1 -c stringy.c -o stringy.o
gcc -shared -o stringy.so -L/usr/local/lib stringy.o
true nil
I think there should be a 'logging' flag to formalize this, so that
each install can generate a log file. This can be useful when
something goes wrong and gives the user something to send us.
steve d.
_______________________________________________
Luarocks-developers mailing list
[email protected]
http://lists.luaforge.net/cgi-bin/mailman/listinfo/luarocks-developers