From 8d3699b9902169022e1f8ee826617bc07a7f1062 Mon Sep 17 00:00:00 2001 From: Radek Szymczyszyn Date: Thu, 15 Jun 2017 14:24:38 +0200 Subject: Sketch docsh install procedure --- kerl | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/kerl b/kerl index c250983..4de218c 100755 --- a/kerl +++ b/kerl @@ -29,6 +29,8 @@ KERL_VERSION="1.7.0" #Grep fix for mac pcre errors GREP_OPTIONS='' +# TODO: make DOCSH_GITHUB_URL configurable +DOCSH_GITHUB_URL="https://github.com/erszcz/docsh.git" ERLANG_DOWNLOAD_URL="http://www.erlang.org/download" KERL_CONFIG_STORAGE_FILENAME=".kerl_config" @@ -1082,6 +1084,65 @@ ACTIVATE_CSH echo "kerl_deactivate" } +install_docsh() { + # TODO: check version compatibility + + REPO_URL=$DOCSH_GITHUB_URL + GIT=$(echo -n $REPO_URL | $MD5SUM | cut -d ' ' -f $MD5SUM_FIELD) + BUILDNAME=$1 + DOCSH_DIR="$KERL_BUILD_DIR/$BUILDNAME/docsh" + DOCSH_REF=master + + mkdir -p "$KERL_GIT_DIR" || exit 1 + cd "$KERL_GIT_DIR" || exit 1 + echo "Checking out docsh git repository from ${REPO_URL}..." + if [ ! -d "$GIT" ]; then + git clone -q --mirror "$REPO_URL" "$GIT" > /dev/null 2>&1 + if [ $? -ne 0 ]; then + echo "Error mirroring remote git repository" + exit 1 + fi + fi + cd "$GIT" || exit 1 + git remote update --prune > /dev/null 2>&1 + if [ $? -ne 0 ]; then + echo "Error updating remote git repository" + exit 1 + fi + + rm -Rf "$DOCSH_DIR" + mkdir -p "$DOCSH_DIR" || exit 1 + cd "$DOCSH_DIR" || exit 1 + git clone -l "$KERL_GIT_DIR/$GIT" $DOCSH_DIR > /dev/null 2>&1 + if [ $? -ne 0 ]; then + echo "Error cloning local git repository" + exit 1 + fi + cd $DOCSH_DIR || exit 1 + git checkout "$DOCSH_REF" > /dev/null 2>&1 + if [ $? -ne 0 ]; then + git checkout -b "$DOCSH_REF" "$DOCSH_REF" > /dev/null 2>&1 + fi + if [ $? -ne 0 ]; then + echo "Couldn't checkout specified version" + rm -Rf "$DOCSH_DIR" + exit 1 + fi + if [ ! -f ./install.sh ]; then + echo "docsh install script not found" + rm -Rf "$DOCSH_DIR" + exit 1 + fi + + echo "Installing docsh for $BUILDNAME from git, please wait..." + yes | ./install.sh > /dev/null 2>&1 + if [ $? -ne 0 ]; then + echo "Couldn't install docsh" + rm -Rf "$DOCSH_DIR" + exit 1 + fi +} + download_manpages() { FILENAME=otp_doc_man_$1.tar.gz -- cgit v1.2.3 From e70ffac8668fe7c20f8699f1a67c57d80212a250 Mon Sep 17 00:00:00 2001 From: Radek Szymczyszyn Date: Thu, 15 Jun 2017 14:35:07 +0200 Subject: Edit console printout --- kerl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kerl b/kerl index 4de218c..20f4b04 100755 --- a/kerl +++ b/kerl @@ -404,7 +404,7 @@ do_git_build() GIT=$(echo -n "$1" | $MD5SUM | cut -d ' ' -f $MD5SUM_FIELD) mkdir -p "$KERL_GIT_DIR" || exit 1 cd "$KERL_GIT_DIR" || exit 1 - echo "Checking Erlang/OTP git repository from $1..." + echo "Checking out Erlang/OTP git repository from $1..." if [ ! -d "$GIT" ]; then git clone -q --mirror "$1" "$GIT" > /dev/null 2>&1 if [ $? -ne 0 ]; then -- cgit v1.2.3 From 3582073a39044212c568a9b314fa3ab816b56231 Mon Sep 17 00:00:00 2001 From: Radek Szymczyszyn Date: Thu, 15 Jun 2017 16:28:45 +0200 Subject: wip: Troubleshoot rebar3 compile failure ./install.sh fails due to rebar3 compile failure: $ KERL_INSTALL_DOCSH=yes KERL_BUILD_BACKEND=git ./kerl install git-19.3.6 ~/apps/erlang/git-19.3.6 Installing Erlang/OTP 19.3.6 (git-19.3.6) in /home/erszcz/apps/erlang/git-19.3.6... Checking out docsh git repository from https://github.com/erszcz/docsh.git... Installing docsh for git-19.3.6 from git, please wait... + : yes + ./install.sh + yes + DEBUG=1 ./install.sh Installing docsh This install script will make docsh globally available in your user environment. It will install the following files: /home/erszcz/.erlang /home/erszcz/.erlang.d/user_default.erl To know more about these files please refer to: man erl - sections about 'The .erlang startup file' and 'user_default and shell_default' man shell_default - parts about user_default ===> Load global config file /home/erszcz/.config/rebar3/rebar.config ===> Expanded command sequence to be run: [{default,app_discovery}, {default,install_deps}, {default,lock}, {default,compile}] ===> Verifying dependencies... ===> Fetching parse_trans ({git, "https://github.com/uwiger/parse_trans.git", {ref, "4fadce8a5242479b4ebc0d2b5825bdfe1de0af1c"}}) ===> sh info: cwd: "/home/erszcz/.kerl/builds/git-19.3.6/docsh" cmd: git --version ===> opts: [] ===> Port Cmd: git --version Port Opts: [exit_status,{line,16384},use_stdio,stderr_to_stdout,hide,eof] ===> sh info: cwd: "/home/erszcz/.kerl/builds/git-19.3.6/docsh" cmd: git clone -n https://github.com/uwiger/parse_trans.git .tmp_dir987767996134 ===> opts: [{cd,"/tmp"}] ===> Port Cmd: git clone -n https://github.com/uwiger/parse_trans.git .tmp_dir987767996134 Port Opts: [{cd,"/tmp"}, exit_status, {line,16384}, use_stdio,stderr_to_stdout,hide,eof] ===> sh info: cwd: "/home/erszcz/.kerl/builds/git-19.3.6/docsh" cmd: git checkout -q 4fadce8a5242479b4ebc0d2b5825bdfe1de0af1c ===> opts: [{cd,"/tmp/.tmp_dir987767996134"}] ===> Port Cmd: git checkout -q 4fadce8a5242479b4ebc0d2b5825bdfe1de0af1c Port Opts: [{cd,"/tmp/.tmp_dir987767996134"}, exit_status, {line,16384}, use_stdio,stderr_to_stdout,hide,eof] ===> Moving checkout "/tmp/.tmp_dir987767996134" to "/home/erszcz/.kerl/builds/git-19.3.6/docsh/_build/default/lib/parse_trans" ===> sh info: cwd: "/home/erszcz/.kerl/builds/git-19.3.6/docsh" cmd: mv /tmp/.tmp_dir987767996134 /home/erszcz/.kerl/builds/git-19.3.6/docsh/_build/default/lib/parse_trans ===> opts: [{use_stdout,false},abort_on_error] ===> Port Cmd: mv /tmp/.tmp_dir987767996134 /home/erszcz/.kerl/builds/git-19.3.6/docsh/_build/default/lib/parse_trans Port Opts: [exit_status,{line,16384},use_stdio,stderr_to_stdout,hide,eof] ===> Fetching edown ({git,"git://github.com/uwiger/edown.git", {ref,"abd9f5bbf9265a0a25640a677824386e199e91a6"}}) ===> sh info: cwd: "/home/erszcz/.kerl/builds/git-19.3.6/docsh" cmd: git clone -n git://github.com/uwiger/edown.git .tmp_dir51298746757 ===> opts: [{cd,"/tmp"}] ===> Port Cmd: git clone -n git://github.com/uwiger/edown.git .tmp_dir51298746757 Port Opts: [{cd,"/tmp"}, exit_status, {line,16384}, use_stdio,stderr_to_stdout,hide,eof] ===> sh info: cwd: "/home/erszcz/.kerl/builds/git-19.3.6/docsh" cmd: git checkout -q abd9f5bbf9265a0a25640a677824386e199e91a6 ===> Port Cmd: git checkout -q abd9f5bbf9265a0a25640a677824386e199e91a6 Port Opts: [{cd,"/tmp/.tmp_dir51298746757"}, exit_status, {line,16384}, use_stdio,stderr_to_stdout,hide,eof] ===> Moving checkout "/tmp/.tmp_dir51298746757" to "/home/erszcz/.kerl/builds/git-19.3.6/docsh/_build/default/lib/edown" ===> sh info: cwd: "/home/erszcz/.kerl/builds/git-19.3.6/docsh" cmd: mv /tmp/.tmp_dir51298746757 /home/erszcz/.kerl/builds/git-19.3.6/docsh/_build/default/lib/edown ===> opts: [{use_stdout,false},abort_on_error] ===> Port Cmd: mv /tmp/.tmp_dir51298746757 /home/erszcz/.kerl/builds/git-19.3.6/docsh/_build/default/lib/edown Port Opts: [exit_status,{line,16384},use_stdio,stderr_to_stdout,hide,eof] ===> sh info: cwd: "/home/erszcz/.kerl/builds/git-19.3.6/docsh" cmd: git --git-dir="/home/erszcz/.kerl/builds/git-19.3.6/docsh/_build/default/lib/edown/.git" rev-parse --verify HEAD ===> opts: [{use_stdout,false}, {debug_abort_on_error, "Locking of git dependency failed in /home/erszcz/.kerl/builds/git-19.3.6/docsh/_build/default/lib/edown"}] ===> Port Cmd: git --git-dir="/home/erszcz/.kerl/builds/git-19.3.6/docsh/_build/default/lib/edown/.git" rev-parse --verify HEAD Port Opts: [exit_status,{line,16384},use_stdio,stderr_to_stdout,hide,eof] ===> sh info: cwd: "/home/erszcz/.kerl/builds/git-19.3.6/docsh" cmd: git --git-dir="/home/erszcz/.kerl/builds/git-19.3.6/docsh/_build/default/lib/parse_trans/.git" rev-parse --verify HEAD ===> opts: [{use_stdout,false}, {debug_abort_on_error, "Locking of git dependency failed in /home/erszcz/.kerl/builds/git-19.3.6/docsh/_build/default/lib/parse_trans"}] ===> Port Cmd: git --git-dir="/home/erszcz/.kerl/builds/git-19.3.6/docsh/_build/default/lib/parse_trans/.git" rev-parse --verify HEAD Port Opts: [exit_status,{line,16384},use_stdio,stderr_to_stdout,hide,eof] ===> Compiling edown ===> run_hooks("/home/erszcz/.kerl/builds/git-19.3.6/docsh/_build/default/lib/edown", pre_hooks, compile) -> no hooks defined ===> run_hooks("/home/erszcz/.kerl/builds/git-19.3.6/docsh/_build/default/lib/edown", pre_hooks, erlc_compile) -> no hooks defined ===> erlopts [debug_info,debug_info] ===> files to compile ["/home/erszcz/.kerl/builds/git-19.3.6/docsh/_build/default/lib/edown/src/edown_lib.erl", "/home/erszcz/.kerl/builds/git-19.3.6/docsh/_build/default/lib/edown/src/edown_layout.erl", "/home/erszcz/.kerl/builds/git-19.3.6/docsh/_build/default/lib/edown/src/edown_xmerl.erl", "/home/erszcz/.kerl/builds/git-19.3.6/docsh/_build/default/lib/edown/src/edown_doclet.erl", "/home/erszcz/.kerl/builds/git-19.3.6/docsh/_build/default/lib/edown/src/edown_make.erl"] ./install.sh: line 57: 25278 Killed ./rebar3 compile Couldn't compile docsh + [ 1 -ne 0 ] + echo Couldn't install docsh Couldn't install docsh + exit 1 --- kerl | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/kerl b/kerl index 20f4b04..44b9574 100755 --- a/kerl +++ b/kerl @@ -1135,10 +1135,14 @@ install_docsh() { fi echo "Installing docsh for $BUILDNAME from git, please wait..." - yes | ./install.sh > /dev/null 2>&1 + # TODO: MUST troubleshoot the install script failure + set -x + : yes | ./install.sh > /dev/null 2>&1 + : yes | DEBUG=1 ./install.sh + yes | ./install.sh if [ $? -ne 0 ]; then echo "Couldn't install docsh" - rm -Rf "$DOCSH_DIR" + #rm -Rf "$DOCSH_DIR" exit 1 fi } -- cgit v1.2.3 From e7b4e8cc2451e719c6cae3b57932d869b5ea4c97 Mon Sep 17 00:00:00 2001 From: Radek Szymczyszyn Date: Thu, 15 Jun 2017 16:30:45 +0200 Subject: Prioritize TODO items --- kerl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kerl b/kerl index 44b9574..621d0c3 100755 --- a/kerl +++ b/kerl @@ -29,7 +29,7 @@ KERL_VERSION="1.7.0" #Grep fix for mac pcre errors GREP_OPTIONS='' -# TODO: make DOCSH_GITHUB_URL configurable +# TODO: COULD make DOCSH_GITHUB_URL configurable DOCSH_GITHUB_URL="https://github.com/erszcz/docsh.git" ERLANG_DOWNLOAD_URL="http://www.erlang.org/download" KERL_CONFIG_STORAGE_FILENAME=".kerl_config" @@ -1085,7 +1085,7 @@ ACTIVATE_CSH } install_docsh() { - # TODO: check version compatibility + # TODO: SHOULD check version compatibility REPO_URL=$DOCSH_GITHUB_URL GIT=$(echo -n $REPO_URL | $MD5SUM | cut -d ' ' -f $MD5SUM_FIELD) -- cgit v1.2.3 From d69c59fda57d906c8178c97fc02860f8a59f9a22 Mon Sep 17 00:00:00 2001 From: Radek Szymczyszyn Date: Thu, 10 Aug 2017 14:27:35 +0200 Subject: Unify the 'no active installation' message --- kerl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kerl b/kerl index 621d0c3..2032b58 100755 --- a/kerl +++ b/kerl @@ -1198,7 +1198,7 @@ do_plt() return 1 fi else - echo "No Erlang/OTP kerl installation is currently active" + echo "No Erlang/OTP installation is currently active" return 2 fi } @@ -1503,7 +1503,7 @@ do_active() echo "$ACTIVE_PATH" return 0 else - echo "No Erlang/OTP kerl installation is currently active" + echo "No Erlang/OTP installation is currently active" return 1 fi } @@ -1926,7 +1926,7 @@ case "$1" in do_plt "$ACTIVE_PATH" print_buildopts "$ACTIVE_PATH" else - echo "No Erlang/OTP installation is currently active." + echo "No Erlang/OTP installation is currently active" exit 1 fi fi -- cgit v1.2.3 From 22f3dd1649d2f90a959e965712bfa395067bdccd Mon Sep 17 00:00:00 2001 From: Radek Szymczyszyn Date: Thu, 10 Aug 2017 17:51:04 +0200 Subject: Switch to a WIP docsh branch --- kerl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kerl b/kerl index 2032b58..e5dc056 100755 --- a/kerl +++ b/kerl @@ -1091,7 +1091,7 @@ install_docsh() { GIT=$(echo -n $REPO_URL | $MD5SUM | cut -d ' ' -f $MD5SUM_FIELD) BUILDNAME=$1 DOCSH_DIR="$KERL_BUILD_DIR/$BUILDNAME/docsh" - DOCSH_REF=master + DOCSH_REF=kerl-install-docsh mkdir -p "$KERL_GIT_DIR" || exit 1 cd "$KERL_GIT_DIR" || exit 1 -- cgit v1.2.3 From e7fd9e02368494518bfdc1063939dadeef00cef2 Mon Sep 17 00:00:00 2001 From: Radek Szymczyszyn Date: Thu, 10 Aug 2017 17:52:29 +0200 Subject: Install docsh via a separate command --- kerl | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/kerl b/kerl index e5dc056..926c945 100755 --- a/kerl +++ b/kerl @@ -1779,6 +1779,25 @@ case "$1" in fi fi ;; + install-docsh) + ACTIVE_PATH="$(get_active_path)" + if [ -n "$ACTIVE_PATH" ]; then + ACTIVE_NAME="$(get_name_from_install_path "$ACTIVE_PATH")" + if [ -z "$ACTIVE_NAME" ]; then + ## TODO: Are git builds installed the usual way + ## or do we need this clause to provide a fallback? + #BUILDNAME="$(basename "$ACTIVE_PATH")" + echo "$ACTIVE_PATH is not a kerl installation" + exit 1 + else + BUILDNAME="$ACTIVE_NAME" + fi + install_docsh $BUILDNAME + else + echo "No Erlang/OTP installation is currently active - can't install docsh" + exit 1 + fi + ;; deploy) if [ $# -lt 2 ]; then echo "usage: $0 $1 <[user@]host> [directory] [remote_directory]" -- cgit v1.2.3 From 3303b7b0e61d72fb19d6189ed3636c17149aeea9 Mon Sep 17 00:00:00 2001 From: Radek Szymczyszyn Date: Thu, 10 Aug 2017 17:57:19 +0200 Subject: Install .erlang and stub installing user_default --- kerl | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/kerl b/kerl index 926c945..c8131b5 100755 --- a/kerl +++ b/kerl @@ -1125,26 +1125,28 @@ install_docsh() { fi if [ $? -ne 0 ]; then echo "Couldn't checkout specified version" - rm -Rf "$DOCSH_DIR" - exit 1 - fi - if [ ! -f ./install.sh ]; then - echo "docsh install script not found" - rm -Rf "$DOCSH_DIR" + : rm -Rf "$DOCSH_DIR" exit 1 fi - echo "Installing docsh for $BUILDNAME from git, please wait..." - # TODO: MUST troubleshoot the install script failure - set -x - : yes | ./install.sh > /dev/null 2>&1 - : yes | DEBUG=1 ./install.sh - yes | ./install.sh - if [ $? -ne 0 ]; then - echo "Couldn't install docsh" - #rm -Rf "$DOCSH_DIR" + ./rebar3 compile + if [ $? -ne 0 ]; then + echo "Couldn't compile docsh" + : rm -Rf "$DOCSH_DIR" + exit 1 + fi + + ## Install $HOME/.erlang + if [ if $HOME/.erlang ]; then + echo "Couldn't install $HOME/.erlang - the file already exists" + : rm -Rf "$DOCSH_DIR" exit 1 + else + cat $DOCSH_DIR/templates/dot.erlang > $HOME/.erlang fi + ## Install docsh user_default + echo "not done yet, fail intentionally" + exit 1 } download_manpages() -- cgit v1.2.3 From 496521692b5e332222c5dd5f2375c8cdc7dd7940 Mon Sep 17 00:00:00 2001 From: Radek Szymczyszyn Date: Thu, 31 Aug 2017 18:15:17 +0200 Subject: Fix .erlang existence test --- kerl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kerl b/kerl index c8131b5..84d794a 100755 --- a/kerl +++ b/kerl @@ -1137,7 +1137,7 @@ install_docsh() { fi ## Install $HOME/.erlang - if [ if $HOME/.erlang ]; then + if [ -f $HOME/.erlang ]; then echo "Couldn't install $HOME/.erlang - the file already exists" : rm -Rf "$DOCSH_DIR" exit 1 -- cgit v1.2.3 From d6b407ee43343bb9ad4078b2e81818e47b5f92bd Mon Sep 17 00:00:00 2001 From: Radek Szymczyszyn Date: Thu, 31 Aug 2017 18:15:27 +0200 Subject: Install user_default --- kerl | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/kerl b/kerl index 84d794a..8d60f1b 100755 --- a/kerl +++ b/kerl @@ -1145,8 +1145,13 @@ install_docsh() { cat $DOCSH_DIR/templates/dot.erlang > $HOME/.erlang fi ## Install docsh user_default - echo "not done yet, fail intentionally" - exit 1 + if [ -f $DOCSH_DIR/user_default.beam ]; then + echo "Couldn't install $DOCSH_DIR/user_default.beam - the file already exists" + : rm -Rf "$DOCSH_DIR" + exit 1 + else + erlc -I $DOCSH_DIR/include -o $DOCSH_DIR/ ~/work/erszcz/docsh/templates/user_default.erl + fi } download_manpages() -- cgit v1.2.3 From b6a58f69fad55783c6104bf931af55a121f38b88 Mon Sep 17 00:00:00 2001 From: Radek Szymczyszyn Date: Thu, 31 Aug 2017 18:16:45 +0200 Subject: Remove DOCSH_DIR on docsh installation error --- kerl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/kerl b/kerl index 8d60f1b..efe86a2 100755 --- a/kerl +++ b/kerl @@ -1125,21 +1125,21 @@ install_docsh() { fi if [ $? -ne 0 ]; then echo "Couldn't checkout specified version" - : rm -Rf "$DOCSH_DIR" + rm -Rf "$DOCSH_DIR" exit 1 fi ./rebar3 compile if [ $? -ne 0 ]; then echo "Couldn't compile docsh" - : rm -Rf "$DOCSH_DIR" + rm -Rf "$DOCSH_DIR" exit 1 fi ## Install $HOME/.erlang if [ -f $HOME/.erlang ]; then echo "Couldn't install $HOME/.erlang - the file already exists" - : rm -Rf "$DOCSH_DIR" + rm -Rf "$DOCSH_DIR" exit 1 else cat $DOCSH_DIR/templates/dot.erlang > $HOME/.erlang @@ -1147,7 +1147,7 @@ install_docsh() { ## Install docsh user_default if [ -f $DOCSH_DIR/user_default.beam ]; then echo "Couldn't install $DOCSH_DIR/user_default.beam - the file already exists" - : rm -Rf "$DOCSH_DIR" + rm -Rf "$DOCSH_DIR" exit 1 else erlc -I $DOCSH_DIR/include -o $DOCSH_DIR/ ~/work/erszcz/docsh/templates/user_default.erl -- cgit v1.2.3 From 24b26eb210e4ae88d418a22617aa5a4de4393c57 Mon Sep 17 00:00:00 2001 From: Radek Szymczyszyn Date: Fri, 1 Sep 2017 12:39:07 +0200 Subject: Install docsh --- kerl | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/kerl b/kerl index efe86a2..0e4ec96 100755 --- a/kerl +++ b/kerl @@ -1092,6 +1092,7 @@ install_docsh() { BUILDNAME=$1 DOCSH_DIR="$KERL_BUILD_DIR/$BUILDNAME/docsh" DOCSH_REF=kerl-install-docsh + ACTIVE_PATH=$2 mkdir -p "$KERL_GIT_DIR" || exit 1 cd "$KERL_GIT_DIR" || exit 1 @@ -1152,6 +1153,14 @@ install_docsh() { else erlc -I $DOCSH_DIR/include -o $DOCSH_DIR/ ~/work/erszcz/docsh/templates/user_default.erl fi + ## Install docsh + if [ -f $ACTIVE_PATH/lib/docsh ]; then + echo "Couldn't install $ACTIVE_PATH/lib/docsh - the directory already exists" + rm -Rf "$DOCSH_DIR" + exit 1 + else + cp -R $DOCSH_DIR/_build/default/lib/docsh $ACTIVE_PATH/lib/ + fi } download_manpages() @@ -1799,7 +1808,7 @@ case "$1" in else BUILDNAME="$ACTIVE_NAME" fi - install_docsh $BUILDNAME + install_docsh "$BUILDNAME" "$ACTIVE_PATH" else echo "No Erlang/OTP installation is currently active - can't install docsh" exit 1 -- cgit v1.2.3 From 2d8f0b7f2ae4e7445eaff8013c600e2478e80e6d Mon Sep 17 00:00:00 2001 From: Radek Szymczyszyn Date: Fri, 1 Sep 2017 15:05:59 +0200 Subject: Install user_default to the Erlang installation not the build --- kerl | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/kerl b/kerl index 0e4ec96..8c6df86 100755 --- a/kerl +++ b/kerl @@ -1145,14 +1145,6 @@ install_docsh() { else cat $DOCSH_DIR/templates/dot.erlang > $HOME/.erlang fi - ## Install docsh user_default - if [ -f $DOCSH_DIR/user_default.beam ]; then - echo "Couldn't install $DOCSH_DIR/user_default.beam - the file already exists" - rm -Rf "$DOCSH_DIR" - exit 1 - else - erlc -I $DOCSH_DIR/include -o $DOCSH_DIR/ ~/work/erszcz/docsh/templates/user_default.erl - fi ## Install docsh if [ -f $ACTIVE_PATH/lib/docsh ]; then echo "Couldn't install $ACTIVE_PATH/lib/docsh - the directory already exists" @@ -1161,6 +1153,14 @@ install_docsh() { else cp -R $DOCSH_DIR/_build/default/lib/docsh $ACTIVE_PATH/lib/ fi + ## Install docsh user_default + if [ -f $ACTIVE_PATH/lib/docsh/user_default.beam ]; then + echo "Couldn't install $ACTIVE_PATH/lib/docsh/user_default.beam - the file already exists" + rm -Rf "$DOCSH_DIR" + exit 1 + else + erlc -I $DOCSH_DIR/include -o $ACTIVE_PATH/lib/docsh/ $DOCSH_DIR/templates/user_default.erl + fi } download_manpages() -- cgit v1.2.3 From b3c73bdc33b7e828d0de60ea89770b1f55957948 Mon Sep 17 00:00:00 2001 From: Radek Szymczyszyn Date: Fri, 1 Sep 2017 15:06:40 +0200 Subject: Set DOCSH_USER_DEFAULT when activating --- kerl | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/kerl b/kerl index 8c6df86..afb9bb6 100755 --- a/kerl +++ b/kerl @@ -865,6 +865,10 @@ kerl_deactivate() export PS1 unset _KERL_SAVED_PS1 fi + if [ -n "\$_KERL_DOCSH_USER_DEFAULT" ]; then + unset DOCSH_USER_DEFAULT + unset _KERL_DOCSH_USER_DEFAULT + fi if [ -n "\$BASH" -o -n "\$ZSH_VERSION" ]; then hash -r fi @@ -907,11 +911,16 @@ if [ -n "\$KERL_ENABLE_PROMPT" ]; then PS1="\$PRMPT\$PS1" export PS1 fi +if [ -d "$absdir/lib/docsh" ]; then + export DOCSH_USER_DEFAULT="$absdir/lib/docsh/user_default" + export _KERL_DOCSH_USER_DEFAULT=yes +fi if [ -n "\$BASH" -o -n "\$ZSH_VERSION" ]; then hash -r fi ACTIVATE +## TODO: add docsh vars cat < "$absdir/activate.fish" # credits to virtualenv function _kerl_remove_el --description 'remove element from array' @@ -976,6 +985,7 @@ if set --query KERL_ENABLE_PROMPT end ACTIVATE_FISH +## TODO: add docsh vars cat < "$absdir/activate.csh" # This file must be used with "source bin/activate.csh" *from csh*. # You cannot run it directly. -- cgit v1.2.3 From 2a7047b16f8773c0837db850c676571f6993647c Mon Sep 17 00:00:00 2001 From: Radek Szymczyszyn Date: Sat, 14 Oct 2017 21:50:26 -0400 Subject: Remove TODO about docsh url configurability --- kerl | 1 - 1 file changed, 1 deletion(-) diff --git a/kerl b/kerl index afb9bb6..3e5b981 100755 --- a/kerl +++ b/kerl @@ -29,7 +29,6 @@ KERL_VERSION="1.7.0" #Grep fix for mac pcre errors GREP_OPTIONS='' -# TODO: COULD make DOCSH_GITHUB_URL configurable DOCSH_GITHUB_URL="https://github.com/erszcz/docsh.git" ERLANG_DOWNLOAD_URL="http://www.erlang.org/download" KERL_CONFIG_STORAGE_FILENAME=".kerl_config" -- cgit v1.2.3 From 5202a95886655db4230b044e2c46a7bd085a7048 Mon Sep 17 00:00:00 2001 From: Radek Szymczyszyn Date: Sat, 14 Oct 2017 21:50:49 -0400 Subject: Enable docsh in activate.fish --- kerl | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/kerl b/kerl index 3e5b981..e7107ec 100755 --- a/kerl +++ b/kerl @@ -919,7 +919,6 @@ if [ -n "\$BASH" -o -n "\$ZSH_VERSION" ]; then fi ACTIVATE -## TODO: add docsh vars cat < "$absdir/activate.fish" # credits to virtualenv function _kerl_remove_el --description 'remove element from array' @@ -958,6 +957,10 @@ function kerl_deactivate --description "deactivate erlang environment" end | psub ) functions --erase _kerl_saved_prompt end + if set --query _KERL_DOCSH_USER_DEFAULT + set --erase DOCSH_USER_DEFAULT + set --erase _KERL_DOCSH_USER_DEFAULT + end if test "\$argv[1]" != "nondestructive" functions --erase kerl_deactivate functions --erase _kerl_remove_el @@ -982,6 +985,10 @@ if set --query KERL_ENABLE_PROMPT _kerl_saved_prompt end end +if test -d "$absdir/lib/docsh" + set -x DOCSH_USER_DEFAULT "$absdir/lib/docsh/user_default" + set -x _KERL_DOCSH_USER_DEFAULT yes +end ACTIVATE_FISH ## TODO: add docsh vars -- cgit v1.2.3 From 5404bf5769c197a5656f8f865d57c220dbae22b4 Mon Sep 17 00:00:00 2001 From: Radek Szymczyszyn Date: Sat, 14 Oct 2017 21:52:51 -0400 Subject: Fix likely typo: _KERL_SAVED_PROMP -> _KERL_SAVED_PROMPT --- kerl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kerl b/kerl index e7107ec..94a303f 100755 --- a/kerl +++ b/kerl @@ -996,7 +996,7 @@ ACTIVATE_FISH # This file must be used with "source bin/activate.csh" *from csh*. # You cannot run it directly. -alias kerl_deactivate 'test \$?_KERL_SAVED_PATH != 0 && setenv PATH "\$_KERL_SAVED_PATH" && unset _KERL_SAVED_PATH; rehash; test \$?_KERL_SAVED_MANPATH != 0 && setenv MANPATH "\$_KERL_SAVED_MANPATH" && unset _KERL_SAVED_MANPATH; test \$?_KERL_SAVED_REBAR_PLT_DIR != 0 && setenv REBAR_PLT_DIR "\$_KERL_SAVED_REBAR_PLT_DIR" && unset _KERL_SAVED_REBAR_PLT_DIR; test \$?_KERL_ACTIVE_DIR != 0 && unset _KERL_ACTIVE_DIR; test \$?_KERL_SAVED_PROMP != 0 && set prompt="\$_KERL_SAVED_PROMP" && unset _KERL_SAVED_PROMP; test "\!:*" != "nondestructive" && unalias deactivate' +alias kerl_deactivate 'test \$?_KERL_SAVED_PATH != 0 && setenv PATH "\$_KERL_SAVED_PATH" && unset _KERL_SAVED_PATH; rehash; test \$?_KERL_SAVED_MANPATH != 0 && setenv MANPATH "\$_KERL_SAVED_MANPATH" && unset _KERL_SAVED_MANPATH; test \$?_KERL_SAVED_REBAR_PLT_DIR != 0 && setenv REBAR_PLT_DIR "\$_KERL_SAVED_REBAR_PLT_DIR" && unset _KERL_SAVED_REBAR_PLT_DIR; test \$?_KERL_ACTIVE_DIR != 0 && unset _KERL_ACTIVE_DIR; test \$?_KERL_SAVED_PROMPT != 0 && set prompt="\$_KERL_SAVED_PROMPT" && unset _KERL_SAVED_PROMPT; test "\!:*" != "nondestructive" && unalias deactivate' # Unset irrelevant variables. kerl_deactivate nondestructive -- cgit v1.2.3 From 14f8e2cb95600a2e133897053d699f51112b9bbd Mon Sep 17 00:00:00 2001 From: Radek Szymczyszyn Date: Sat, 14 Oct 2017 22:13:38 -0400 Subject: Enable docsh in activate.csh --- kerl | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/kerl b/kerl index 94a303f..7964756 100755 --- a/kerl +++ b/kerl @@ -991,12 +991,11 @@ if test -d "$absdir/lib/docsh" end ACTIVATE_FISH -## TODO: add docsh vars cat < "$absdir/activate.csh" # This file must be used with "source bin/activate.csh" *from csh*. # You cannot run it directly. -alias kerl_deactivate 'test \$?_KERL_SAVED_PATH != 0 && setenv PATH "\$_KERL_SAVED_PATH" && unset _KERL_SAVED_PATH; rehash; test \$?_KERL_SAVED_MANPATH != 0 && setenv MANPATH "\$_KERL_SAVED_MANPATH" && unset _KERL_SAVED_MANPATH; test \$?_KERL_SAVED_REBAR_PLT_DIR != 0 && setenv REBAR_PLT_DIR "\$_KERL_SAVED_REBAR_PLT_DIR" && unset _KERL_SAVED_REBAR_PLT_DIR; test \$?_KERL_ACTIVE_DIR != 0 && unset _KERL_ACTIVE_DIR; test \$?_KERL_SAVED_PROMPT != 0 && set prompt="\$_KERL_SAVED_PROMPT" && unset _KERL_SAVED_PROMPT; test "\!:*" != "nondestructive" && unalias deactivate' +alias kerl_deactivate 'test \$?_KERL_SAVED_PATH != 0 && setenv PATH "\$_KERL_SAVED_PATH" && unset _KERL_SAVED_PATH; rehash; test \$?_KERL_SAVED_MANPATH != 0 && setenv MANPATH "\$_KERL_SAVED_MANPATH" && unset _KERL_SAVED_MANPATH; test \$?_KERL_SAVED_REBAR_PLT_DIR != 0 && setenv REBAR_PLT_DIR "\$_KERL_SAVED_REBAR_PLT_DIR" && unset _KERL_SAVED_REBAR_PLT_DIR; test \$?_KERL_ACTIVE_DIR != 0 && unset _KERL_ACTIVE_DIR; test \$?_KERL_DOCSH_USER_DEFAULT != 0 && unsetenv DOCSH_USER_DEFAULT && unset _KERL_DOCSH_USER_DEFAULT; test \$?_KERL_SAVED_PROMPT != 0 && set prompt="\$_KERL_SAVED_PROMPT" && unset _KERL_SAVED_PROMPT; test "\!:*" != "nondestructive" && unalias deactivate' # Unset irrelevant variables. kerl_deactivate nondestructive @@ -1039,6 +1038,11 @@ if ( \$?KERL_ENABLE_PROMPT ) then set prompt = "\$PROMPT\$prompt" endif +if ( -d "$absdir/lib/docsh" ) then + setenv DOCSH_USER_DEFAULT "$absdir/lib/docsh/user_default" + set _KERL_DOCSH_USER_DEFAULT = "yes" +endif + rehash ACTIVATE_CSH -- cgit v1.2.3 From 238ceb2df1b16cc1c34237b64b9223bae99933a9 Mon Sep 17 00:00:00 2001 From: Radek Szymczyszyn Date: Sat, 14 Oct 2017 22:37:19 -0400 Subject: Check OTP / docsh version compatibility --- kerl | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/kerl b/kerl index 7964756..07452ef 100755 --- a/kerl +++ b/kerl @@ -1105,8 +1105,6 @@ ACTIVATE_CSH } install_docsh() { - # TODO: SHOULD check version compatibility - REPO_URL=$DOCSH_GITHUB_URL GIT=$(echo -n $REPO_URL | $MD5SUM | cut -d ' ' -f $MD5SUM_FIELD) BUILDNAME=$1 @@ -1114,6 +1112,15 @@ install_docsh() { DOCSH_REF=kerl-install-docsh ACTIVE_PATH=$2 + OTP_VERSION=$(get_otp_version $1) + # This has to be updated with docsh updates + DOCSH_SUPPORTED="^1[89]$" + echo $OTP_VERSION | grep "$DOCSH_SUPPORTED" > /dev/null 2>&1 + if [ $? -ne 0 ]; then + echo "Erlang/OTP version $OTP_VERSION not supported by docsh (does not match regex $DOCSH_SUPPORTED)" + exit 1 + fi + mkdir -p "$KERL_GIT_DIR" || exit 1 cd "$KERL_GIT_DIR" || exit 1 echo "Checking out docsh git repository from ${REPO_URL}..." -- cgit v1.2.3 From 84324a0c44fc614d892898b33b2f4e4869dae8cf Mon Sep 17 00:00:00 2001 From: Radek Szymczyszyn Date: Sat, 14 Oct 2017 23:27:42 -0400 Subject: Use a tagged version of docsh --- kerl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kerl b/kerl index 07452ef..80c34f9 100755 --- a/kerl +++ b/kerl @@ -1109,7 +1109,7 @@ install_docsh() { GIT=$(echo -n $REPO_URL | $MD5SUM | cut -d ' ' -f $MD5SUM_FIELD) BUILDNAME=$1 DOCSH_DIR="$KERL_BUILD_DIR/$BUILDNAME/docsh" - DOCSH_REF=kerl-install-docsh + DOCSH_REF="0.3.0" ACTIVE_PATH=$2 OTP_VERSION=$(get_otp_version $1) -- cgit v1.2.3 From 7ccfed075dc12b8360a3afb93db28a6b9dad6985 Mon Sep 17 00:00:00 2001 From: Radek Szymczyszyn Date: Sat, 14 Oct 2017 23:34:03 -0400 Subject: [skip ci] Ask user to reactivate after docsh installation --- kerl | 1 + 1 file changed, 1 insertion(+) diff --git a/kerl b/kerl index 80c34f9..4baaca9 100755 --- a/kerl +++ b/kerl @@ -1836,6 +1836,7 @@ case "$1" in BUILDNAME="$ACTIVE_NAME" fi install_docsh "$BUILDNAME" "$ACTIVE_PATH" + echo "Please kerl_deactivate and activate again to enable docsh" else echo "No Erlang/OTP installation is currently active - can't install docsh" exit 1 -- cgit v1.2.3 From 5a4471530d0b53a31631c18b0f394459e4d795a8 Mon Sep 17 00:00:00 2001 From: Radek Szymczyszyn Date: Mon, 16 Oct 2017 17:44:16 -0400 Subject: Use docsh 0.4.0 --- kerl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kerl b/kerl index 4baaca9..47ae798 100755 --- a/kerl +++ b/kerl @@ -1109,7 +1109,7 @@ install_docsh() { GIT=$(echo -n $REPO_URL | $MD5SUM | cut -d ' ' -f $MD5SUM_FIELD) BUILDNAME=$1 DOCSH_DIR="$KERL_BUILD_DIR/$BUILDNAME/docsh" - DOCSH_REF="0.3.0" + DOCSH_REF="0.4.0" ACTIVE_PATH=$2 OTP_VERSION=$(get_otp_version $1) -- cgit v1.2.3 From 616d844cd3b2a5dbc729d468cf4f3298fb21dbf2 Mon Sep 17 00:00:00 2001 From: Radek Szymczyszyn Date: Wed, 1 Nov 2017 16:00:42 +0100 Subject: Fix indentation --- kerl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/kerl b/kerl index 47ae798..1b1bb00 100755 --- a/kerl +++ b/kerl @@ -1157,12 +1157,12 @@ install_docsh() { exit 1 fi - ./rebar3 compile - if [ $? -ne 0 ]; then - echo "Couldn't compile docsh" + ./rebar3 compile + if [ $? -ne 0 ]; then + echo "Couldn't compile docsh" rm -Rf "$DOCSH_DIR" - exit 1 - fi + exit 1 + fi ## Install $HOME/.erlang if [ -f $HOME/.erlang ]; then -- cgit v1.2.3 From 6fcc12ee7ae0f2d58c113d2ced8a02fbe5a9bd7d Mon Sep 17 00:00:00 2001 From: Radek Szymczyszyn Date: Wed, 1 Nov 2017 17:29:05 +0100 Subject: Symlink $HOME/.erlang instead of installing a fixed one in bash --- kerl | 38 ++++++++++++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 8 deletions(-) diff --git a/kerl b/kerl index 1b1bb00..96e9a4c 100755 --- a/kerl +++ b/kerl @@ -864,6 +864,10 @@ kerl_deactivate() export PS1 unset _KERL_SAVED_PS1 fi + if [ -n "\$_KERL_DOCSH_DOT_ERLANG" ]; then + rm "\$HOME/.erlang" + unset _KERL_DOCSH_DOT_ERLANG + fi if [ -n "\$_KERL_DOCSH_USER_DEFAULT" ]; then unset DOCSH_USER_DEFAULT unset _KERL_DOCSH_USER_DEFAULT @@ -913,6 +917,17 @@ fi if [ -d "$absdir/lib/docsh" ]; then export DOCSH_USER_DEFAULT="$absdir/lib/docsh/user_default" export _KERL_DOCSH_USER_DEFAULT=yes + if [ -f "\$HOME/.erlang" ]; then + if [ ! x"\$KERL_DOCSH_DOT_ERLANG" = x"exists" ]; then + echo "Couldn't symlink correct \$HOME/.erlang - file exists - docsh might not work." + echo "Please make sure \$HOME/.erlang contains code" + echo "from $absdir/lib/docsh/dot.erlang" + echo "and export KERL_DOCSH_DOT_ERLANG=exists to suppress this warning." + fi + else + ln -s "$absdir/lib/docsh/dot.erlang" "\$HOME/.erlang" + export _KERL_DOCSH_DOT_ERLANG=yes + fi fi if [ -n "\$BASH" -o -n "\$ZSH_VERSION" ]; then hash -r @@ -1164,14 +1179,6 @@ install_docsh() { exit 1 fi - ## Install $HOME/.erlang - if [ -f $HOME/.erlang ]; then - echo "Couldn't install $HOME/.erlang - the file already exists" - rm -Rf "$DOCSH_DIR" - exit 1 - else - cat $DOCSH_DIR/templates/dot.erlang > $HOME/.erlang - fi ## Install docsh if [ -f $ACTIVE_PATH/lib/docsh ]; then echo "Couldn't install $ACTIVE_PATH/lib/docsh - the directory already exists" @@ -1180,6 +1187,21 @@ install_docsh() { else cp -R $DOCSH_DIR/_build/default/lib/docsh $ACTIVE_PATH/lib/ fi + ## Prepare dot.erlang for linking as $HOME/.erlang + if [ -f $ACTIVE_PATH/lib/docsh/dot.erlang ]; then + echo "Couldn't install $ACTIVE_PATH/lib/docsh/dot.erlang - the file already exists" + rm -Rf "$DOCSH_DIR" + exit 1 + else + cat $DOCSH_DIR/templates/dot.erlang > $ACTIVE_PATH/lib/docsh/dot.erlang + fi + ## Warn if $HOME/.erlang exists + if [ -f $HOME/.erlang ]; then + echo "$HOME/.erlang exists - kerl won't be able to symlink a docsh-compatible version." + echo "Please make sure your $HOME/.erlang contains code" + echo "from $ACTIVE_PATH/lib/docsh/dot.erlang" + echo "and export KERL_DOCSH_DOT_ERLANG=exists to suppress further warnings" + fi ## Install docsh user_default if [ -f $ACTIVE_PATH/lib/docsh/user_default.beam ]; then echo "Couldn't install $ACTIVE_PATH/lib/docsh/user_default.beam - the file already exists" -- cgit v1.2.3 From 12d0bd8c1f090bd16b3180744bb70da25492e914 Mon Sep 17 00:00:00 2001 From: Radek Szymczyszyn Date: Wed, 1 Nov 2017 17:53:23 +0100 Subject: Add install-docsh to the list of valid commands --- kerl | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/kerl b/kerl index 96e9a4c..a4b70f5 100755 --- a/kerl +++ b/kerl @@ -174,19 +174,20 @@ usage() echo "usage: $0 [options ...]" printf "\n Command to be executed\n\n" echo "Valid commands are:" - echo " build Build specified release or git repository" - echo " install Install the specified release at the given location" - echo " deploy Deploy the specified installation to the given host and location" - echo " update Update the list of available releases from your source provider" - echo " list List releases, builds and installations" - echo " delete Delete builds and installations" - echo " path Print the path of a given installation" - echo " active Print the path of the active installation" - echo " plt Print Dialyzer PLT path for the active installation" - echo " status Print available builds and installations" - echo " prompt Print a string suitable for insertion in prompt" - echo " cleanup Remove compilation artifacts (use after installation)" - echo " version Print current version (current: $KERL_VERSION)" + echo " build Build specified release or git repository" + echo " install Install the specified release at the given location" + echo " deploy Deploy the specified installation to the given host and location" + echo " update Update the list of available releases from your source provider" + echo " list List releases, builds and installations" + echo " delete Delete builds and installations" + echo " install-docsh Install erl shell documentation access extension - docsh" + echo " path Print the path of a given installation" + echo " active Print the path of the active installation" + echo " plt Print Dialyzer PLT path for the active installation" + echo " status Print available builds and installations" + echo " prompt Print a string suitable for insertion in prompt" + echo " cleanup Remove compilation artifacts (use after installation)" + echo " version Print current version (current: $KERL_VERSION)" exit 1 } -- cgit v1.2.3 From 1c6ae608c4d19cbaf8e2a3af3a4c6a0de2e02fe9 Mon Sep 17 00:00:00 2001 From: Radek Szymczyszyn Date: Wed, 1 Nov 2017 18:10:31 +0100 Subject: Symlink $HOME/.erlang instead of installing a fixed one in fish --- kerl | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/kerl b/kerl index a4b70f5..ac88fca 100755 --- a/kerl +++ b/kerl @@ -973,6 +973,10 @@ function kerl_deactivate --description "deactivate erlang environment" end | psub ) functions --erase _kerl_saved_prompt end + if set --query _KERL_DOCSH_DOT_ERLANG + rm "\$HOME/.erlang" + set --erase _KERL_DOCSH_DOT_ERLANG + end if set --query _KERL_DOCSH_USER_DEFAULT set --erase DOCSH_USER_DEFAULT set --erase _KERL_DOCSH_USER_DEFAULT @@ -1004,6 +1008,17 @@ end if test -d "$absdir/lib/docsh" set -x DOCSH_USER_DEFAULT "$absdir/lib/docsh/user_default" set -x _KERL_DOCSH_USER_DEFAULT yes + if test -f "\$HOME/.erlang" + if test ! x"\$KERL_DOCSH_DOT_ERLANG" = x"exists" + echo "Couldn't symlink correct \$HOME/.erlang - file exists - docsh might not work." + echo "Please make sure \$HOME/.erlang contains code" + echo "from $absdir/lib/docsh/dot.erlang" + echo "and export KERL_DOCSH_DOT_ERLANG=exists to suppress this warning." + end + else + ln -s "$absdir/lib/docsh/dot.erlang" "\$HOME/.erlang" + set -x _KERL_DOCSH_DOT_ERLANG yes + end end ACTIVATE_FISH -- cgit v1.2.3 From 1a4144baffa264f0d338b74c32702a809169cd9b Mon Sep 17 00:00:00 2001 From: Radek Szymczyszyn Date: Wed, 1 Nov 2017 18:41:37 +0100 Subject: Symlink $HOME/.erlang instead of installing a fixed one in tcsh --- kerl | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/kerl b/kerl index ac88fca..8e8fca8 100755 --- a/kerl +++ b/kerl @@ -1026,7 +1026,7 @@ ACTIVATE_FISH # This file must be used with "source bin/activate.csh" *from csh*. # You cannot run it directly. -alias kerl_deactivate 'test \$?_KERL_SAVED_PATH != 0 && setenv PATH "\$_KERL_SAVED_PATH" && unset _KERL_SAVED_PATH; rehash; test \$?_KERL_SAVED_MANPATH != 0 && setenv MANPATH "\$_KERL_SAVED_MANPATH" && unset _KERL_SAVED_MANPATH; test \$?_KERL_SAVED_REBAR_PLT_DIR != 0 && setenv REBAR_PLT_DIR "\$_KERL_SAVED_REBAR_PLT_DIR" && unset _KERL_SAVED_REBAR_PLT_DIR; test \$?_KERL_ACTIVE_DIR != 0 && unset _KERL_ACTIVE_DIR; test \$?_KERL_DOCSH_USER_DEFAULT != 0 && unsetenv DOCSH_USER_DEFAULT && unset _KERL_DOCSH_USER_DEFAULT; test \$?_KERL_SAVED_PROMPT != 0 && set prompt="\$_KERL_SAVED_PROMPT" && unset _KERL_SAVED_PROMPT; test "\!:*" != "nondestructive" && unalias deactivate' +alias kerl_deactivate 'test \$?_KERL_SAVED_PATH != 0 && setenv PATH "\$_KERL_SAVED_PATH" && unset _KERL_SAVED_PATH; rehash; test \$?_KERL_SAVED_MANPATH != 0 && setenv MANPATH "\$_KERL_SAVED_MANPATH" && unset _KERL_SAVED_MANPATH; test \$?_KERL_SAVED_REBAR_PLT_DIR != 0 && setenv REBAR_PLT_DIR "\$_KERL_SAVED_REBAR_PLT_DIR" && unset _KERL_SAVED_REBAR_PLT_DIR; test \$?_KERL_ACTIVE_DIR != 0 && unset _KERL_ACTIVE_DIR; test \$?_KERL_DOCSH_USER_DEFAULT != 0 && unsetenv DOCSH_USER_DEFAULT && unset _KERL_DOCSH_USER_DEFAULT; test \$?_KERL_DOCSH_DOT_ERLANG != 0 && rm "\$HOME/.erlang" && unset _KERL_DOCSH_DOT_ERLANG; test \$?_KERL_SAVED_PROMPT != 0 && set prompt="\$_KERL_SAVED_PROMPT" && unset _KERL_SAVED_PROMPT; test "\!:*" != "nondestructive" && unalias deactivate' # Unset irrelevant variables. kerl_deactivate nondestructive @@ -1072,6 +1072,17 @@ endif if ( -d "$absdir/lib/docsh" ) then setenv DOCSH_USER_DEFAULT "$absdir/lib/docsh/user_default" set _KERL_DOCSH_USER_DEFAULT = "yes" + if ( -f "\$HOME/.erlang" ) then + if ( \$?KERL_DOCSH_DOT_ERLANG == 0 ) then + echo "Couldn't symlink correct \$HOME/.erlang - file exists - docsh might not work." + echo "Please make sure \$HOME/.erlang contains code" + echo "from $absdir/lib/docsh/dot.erlang" + echo "and export KERL_DOCSH_DOT_ERLANG=exists to suppress this warning." + endif + else + ln -s "$absdir/lib/docsh/dot.erlang" "\$HOME/.erlang" + set _KERL_DOCSH_DOT_ERLANG = "yes" + endif endif rehash -- cgit v1.2.3 From 2f2a4907dee9ee0f3a87f089bbf9a7bfdc1c98cb Mon Sep 17 00:00:00 2001 From: Radek Szymczyszyn Date: Sat, 4 Nov 2017 18:51:11 +0100 Subject: Describe install-docsh command in the README --- README.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/README.md b/README.md index 8cdcc54..6f45f3c 100644 --- a/README.md +++ b/README.md @@ -614,6 +614,29 @@ other tools to extract to path information. $ kerl path 19.2.3 /aux/erlangs/19.2.3 +### install-docsh + + kerl install-docsh + +Install `erl` shell documentation access +extension - [docsh](https://github.com/erszcz/docsh). +This extends the shell with new helpers, which enable access to full +function help (via `h/{1,2,3}`), function specs (`s/{1,2,3}`) and type +information (`t/{1,2,3}`). + +Activating a docsh-enabled Erlang installation will try to create +a `$HOME/.erlang` symlink. +If this file exists (i.e. you have created it manually), +please consider removing it - otherwise, docsh won't work. +Deactivating the kerl Erlang installation will remove the symlink. + +Alternatively, if the file exists and you have to keep it you can extend +it with the content of [a docsh-specific `.erlang`][docsh-dot-erlang] - this +task is left as an exercise for the reader - and export +`KERL_DOCSH_DOT_ERLANG=exists` to silence unwanted warnings. + +[docsh-dot-erlang]: https://github.com/erszcz/docsh/blob/2d9843bce794e726f591bbca49c88aedbb435f8c/templates/dot.erlang + Compiling crypto on Macs ------------------------ Apple stopped shipping OpenSSL in OS X 10.11 (El Capitan) in favor of Apple's -- cgit v1.2.3 From 578b6200e35a19b0d7473a267f7b0b1d557e724f Mon Sep 17 00:00:00 2001 From: Radek Szymczyszyn Date: Sat, 4 Nov 2017 23:36:56 +0100 Subject: Extend install-docsh command description --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 6f45f3c..39a67b9 100644 --- a/README.md +++ b/README.md @@ -624,6 +624,11 @@ This extends the shell with new helpers, which enable access to full function help (via `h/{1,2,3}`), function specs (`s/{1,2,3}`) and type information (`t/{1,2,3}`). +If you already have an OTP installation, you will need to remove it and +re-install it **before** you execute `install-docsh`, +since docsh needs some environment variables of its own to be set up +and managed by the activate script. + Activating a docsh-enabled Erlang installation will try to create a `$HOME/.erlang` symlink. If this file exists (i.e. you have created it manually), @@ -634,8 +639,11 @@ Alternatively, if the file exists and you have to keep it you can extend it with the content of [a docsh-specific `.erlang`][docsh-dot-erlang] - this task is left as an exercise for the reader - and export `KERL_DOCSH_DOT_ERLANG=exists` to silence unwanted warnings. +The [manual setup guide][docsh-manual-setup] will probably come in handy +if you decide to take this route. [docsh-dot-erlang]: https://github.com/erszcz/docsh/blob/2d9843bce794e726f591bbca49c88aedbb435f8c/templates/dot.erlang +[docsh-manual-setup]: https://github.com/erszcz/docsh/blob/ecf35821610977e36b04c0c256990a5b0dab4870/doc/manual-setup.md Compiling crypto on Macs ------------------------ -- cgit v1.2.3