ferron

Ferron is a fast and simple static website generator made with Lua.
Log | Files | Refs | Submodules | README | LICENSE

commit af7856bca82c6b977461aac01a14b7376a0f7b15
parent f950ac4968464931b98199e57adc1e1d7a0c2b0c
Author: Hugo Soucy <hsoucy@kronostechnologies.com>
Date:   Wed, 28 Mar 2018 13:58:18 -0400

Add a condition to test the presence of luarocks

Diffstat:
Mcornelius | 10++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/cornelius b/cornelius @@ -6,8 +6,14 @@ local config = require "config" if arg[1] == "install" and tonumber(_VERSION:match("%d+%.%d+")) >= config.dependencies.lua then - for i, dependency in ipairs(config.dependencies.modules) do - os.execute ("luarocks install --tree lua_modules " .. dependency) + -- First, check if luarocks is present in the env. + if pcall(require, "luarocks.loader") then + for i, dependency in ipairs(config.dependencies.modules) do + os.execute ("luarocks install --tree lua_modules " .. dependency) + end + else + print("Ferron needs Luarocks for installing his dependencies.") + print("Please install it on your system <https://luarocks.org/>.") end elseif arg[1] == "build" then os.execute("lua -l set_paths ferron.lua")