jex: add -w/-f options to dwim(-|+|++)/install, make extinstall its own command

This commit is contained in:
2023-10-18 22:30:57 -06:00
parent 76092fc43d
commit 0f337f1519
+26 -18
View File
@@ -9,7 +9,7 @@
%%% @end %%% @end
-module(jex). -module(jex).
-vsn("0.1.0"). -vsn("0.2.0").
-export([start/1]). -export([start/1]).
-compile([export_all, nowarn_export_all]). -compile([export_all, nowarn_export_all]).
@@ -64,10 +64,18 @@ help_screen() ->
"\n" "\n"
"PORCELAIN COMMANDS:\n" "PORCELAIN COMMANDS:\n"
" dwim- build project but don't make a release (init, clean, pull, build)\n" " dwim- build project but don't make a release (init, clean, pull, build)\n"
" -w, --weak (on `jex build` step) continue building even if tsc fails\n"
" -f, --force (on `jex build` step) use cp -rf instead of cp -r\n"
" dwim+ build and make a minimal release (init, clean, pull, build, mindist, push)\n" " dwim+ build and make a minimal release (init, clean, pull, build, mindist, push)\n"
" -w, --weak (on `jex build` step) continue building even if tsc fails\n"
" -f, --force (on `jex build` step) use cp -rf instead of cp -r\n"
" dwim++ build and make a full release (init, clean, pull, build, mindist, push, mkdocs, pushdocs)\n" " dwim++ build and make a full release (init, clean, pull, build, mindist, push, mkdocs, pushdocs)\n"
" -w, --weak (on `jex build` step) continue building even if tsc fails\n"
" -f, --force (on `jex build` step) use cp -rf instead of cp -r\n"
" install synonym for dwim++\n" " install synonym for dwim++\n"
" install [TARBALL_PATH] install the given package\n" " -w, --weak (on `jex build` step) continue building even if tsc fails\n"
" -f, --force (on `jex build` step) use cp -rf instead of cp -r\n"
" extinstall TARGZ_PATH install a prebuilt jex package\n"
" ls list installed packages\n" " ls list installed packages\n"
" viewdocs [PKG [PORT]] view package docs for PKG in browser\n" " viewdocs [PKG [PORT]] view package docs for PKG in browser\n"
" get_mindist [PKG] get the mindist tarball for an installed package\n" " get_mindist [PKG] get the mindist tarball for an installed package\n"
@@ -110,11 +118,11 @@ help_screen() ->
%% Porcelain %% Porcelain
dispatch(["dwim-"]) -> dwim(minus); dispatch(["dwim-" | BuildOpts]) -> dwim(minus, BuildOpts);
dispatch(["dwim+"]) -> dwim(plus); dispatch(["dwim+" | BuildOpts]) -> dwim(plus, BuildOpts);
dispatch(["dwim++"]) -> dwim(plus_plus); dispatch(["dwim++" | BuildOpts]) -> dwim(plus_plus, BuildOpts);
dispatch(["install"]) -> install(); dispatch(["install" | BuildOpts]) -> install(BuildOpts);
dispatch(["install", Path]) -> install(Path); dispatch(["extinstall", Path]) -> extinstall(Path);
dispatch(["ls"]) -> ls(); dispatch(["ls"]) -> ls();
dispatch(["viewdocs"]) -> viewdocs(); dispatch(["viewdocs"]) -> viewdocs();
dispatch(["viewdocs", Pkg]) -> viewdocs(Pkg); dispatch(["viewdocs", Pkg]) -> viewdocs(Pkg);
@@ -166,23 +174,25 @@ man() ->
%%----------------------------------------------------------------------------- %%-----------------------------------------------------------------------------
%% jex dwim %% jex dwim(-|+|++) / jex install
%%----------------------------------------------------------------------------- %%-----------------------------------------------------------------------------
dwim(minus) -> dwim(minus, BuildOpts) ->
init(), init(),
clean(), clean(),
pull(), pull(),
build([]); build(BuildOpts);
dwim(plus) -> dwim(plus, BuildOpts) ->
dwim(minus), dwim(minus, BuildOpts),
mindist([]), mindist([]),
push(); push();
dwim(plus_plus) -> dwim(plus_plus, BuildOpts) ->
dwim(plus), dwim(plus, BuildOpts),
mkdocs(), mkdocs(),
pushdocs(). pushdocs().
install(BuildOpts) ->
dwim(plus_plus, BuildOpts).
%%----------------------------------------------------------------------------- %%-----------------------------------------------------------------------------
%% jex cfgbarf %% jex cfgbarf
@@ -676,13 +686,11 @@ srsly_readme_path() ->
%%----------------------------------------------------------------------------- %%-----------------------------------------------------------------------------
%% jex install TARBALL_PATH %% jex extinstall TARBALL_PATH
%%----------------------------------------------------------------------------- %%-----------------------------------------------------------------------------
install() ->
dwim(plus_plus).
install(TarballPath) -> extinstall(TarballPath) ->
case file_exists(TarballPath) of case file_exists(TarballPath) of
false -> error({file_dne, TarballPath}); false -> error({file_dne, TarballPath});
true -> install2(TarballPath) true -> install2(TarballPath)