Last active
December 20, 2015 23:08
-
-
Save rpip/6209769 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%% @doc Install the given module | |
install({Name, Repository}, Context) -> | |
Site = m_site:get(site, Context), | |
PrivDir = z_utils:lib_dir(priv), | |
SiteModulesDir = filename:join([PrivDir, "sites", Site, "modules"]), | |
ModuleDirname = SiteModulesDir ++ Site ++ Name, | |
case filelib:is_file(ModuleDirname) of | |
true -> | |
z_render:growl(?__("***ERROR: " ++ Name ++ " already installed.", Context), Context); | |
false -> | |
ZMM = filename:join([PrivDir, "bin", "zmm"]), | |
CMD = ZMM ++ " install -s " ++ Site, | |
os:cmd(CMD), | |
z_render:growl(?__(Name ++ " successfully installed.", Context), Context) | |
end. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment