diff --git a/makefile b/makefile index d01d450..ca14dbf 100644 --- a/makefile +++ b/makefile @@ -10,4 +10,7 @@ examples: force clean: ./priv/jsx clean +install: clean compile + ./priv/jsx install + force: \ No newline at end of file diff --git a/priv/jsx b/priv/jsx index b1b2136..67c0291 100755 --- a/priv/jsx +++ b/priv/jsx @@ -6,6 +6,8 @@ main(Args) -> ; ["examples"|Opts] -> examples(Opts) ; ["test"|Opts] -> test(Opts) ; ["clean"|Opts] -> clean(Opts) + ; ["install"|Opts] -> install(Opts) + ; ["uninstall"|Opts] -> uninstall(Opts) end. compile([]) -> @@ -50,6 +52,17 @@ test(Path) -> clean([]) -> [ file:delete(Filename) || Filename <- filelib:wildcard("ebin/*.beam") ]. - +install([]) -> + os:cmd("mkdir -p " ++ appdir()), + os:cmd("cp -r " ++ "ebin " ++ appdir()). + +uninstall([]) -> + os:cmd("rm -rf " ++ appdir()). + +appdir() -> + {ok, [{application, jsx, AppInfo}]} = file:consult("ebin/jsx.app"), + code:lib_dir() ++ "/jsx-" ++ proplists:get_value(vsn, AppInfo). + + \ No newline at end of file