Skip to content

Commit

Permalink
passes non-parsed dependencies directly into luarocks install
Browse files Browse the repository at this point in the history
  • Loading branch information
leafo committed Feb 9, 2012
1 parent 53d5886 commit c6e84ed
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 3 deletions.
18 changes: 17 additions & 1 deletion opt/prepare.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,19 @@ local rockspec = {
setfenv(fn, rockspec)()
local path = require("luarocks.path")
local deps = require("luarocks.deps")
local install = require("luarocks.install")
local extras = { }
rockspec.dependencies = (function()
local _accum_0 = { }
local _len_0 = 0
local _list_0 = rockspec.dependencies
for _index_0 = 1, #_list_0 do
local dep = _list_0[_index_0]
local _value_0 = deps.parse_dep(dep)
local parsed = deps.parse_dep(dep)
if not parsed then
table.insert(extras, dep)
end
local _value_0 = parsed
if _value_0 ~= nil then
_len_0 = _len_0 + 1
_accum_0[_len_0] = _value_0
Expand All @@ -54,3 +60,13 @@ local success, msg = deps.fulfill_dependencies(rockspec)
if not success then
error(msg)
end
local p
do
local _table_0 = require("moon")
p = _table_0.p
end
local _list_0 = extras
for _index_0 = 1, #_list_0 do
local extra = _list_0[_index_0]
install.run(extra)
end
11 changes: 10 additions & 1 deletion opt/prepare.moon
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,20 @@ setfenv(fn, rockspec)!

path = require"luarocks.path"
deps = require"luarocks.deps"
install = require"luarocks.install"

extras = {}
rockspec.dependencies = for dep in *rockspec.dependencies
deps.parse_dep dep
parsed = deps.parse_dep dep
if not parsed
table.insert extras, dep
parsed

path.use_tree tree
success, msg = deps.fulfill_dependencies rockspec
error msg if not success

import p from require "moon"

for extra in *extras
install.run extra
2 changes: 1 addition & 1 deletion test/package.rockspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

dependencies = {
"alt-getopt >= 0.7",
"http://moonscript.org/rocks/moonscript-dev-1.src.rock", -- this doesn't work...
"http://moonscript.org/rocks/moonscript-dev-1.src.rock",
"lua-cjson"
}

0 comments on commit c6e84ed

Please sign in to comment.