Skip to content

Commit 131f62b

Browse files
committed
Rebar is now installed in the proper bin dir.
This fixes issue lfe-deprecated#28.
1 parent 00308f5 commit 131f62b

File tree

5 files changed

+36
-11
lines changed

5 files changed

+36
-11
lines changed

bash-complete

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ INSTALL='lfetool autocomplete lfe erlang kerl rebar relx expm erjang'
55
YAWS='default bootstrap'
66
TESTS='build unit integration system all'
77
UPDATE='lfetool deps'
8-
INFO='version erllibs path installdir'
8+
INFO='version erllibs path installdir bindir'
99
REPL='lfe erlang jlfe jerl'
1010

1111
_get-lfetool-opts-and-commands () {

doc/manual/info.rst

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
The ``info`` command supports the following sub-commands:
99

10+
* ``bindir``
11+
1012
* ``erllibs``
1113

1214
* ``path``
@@ -16,6 +18,17 @@ The ``info`` command supports the following sub-commands:
1618
* ``version``
1719

1820

21+
``info bindir``
22+
,,,,,,,,,,,,,,,
23+
24+
This command returns the ``bin`` directory for the installed/active version
25+
of Erlang:
26+
27+
.. code:: shell
28+
29+
$ lfetool info bindir
30+
31+
1932
``info erllibs``
2033
,,,,,,,,,,,,,,,
2134

@@ -38,8 +51,9 @@ any needed binaries. It also adds some default directories:
3851

3952
* ``/opt/erlang/erjang``
4053

41-
Due to the fact that obtaining the ``lfetool`` PATH settings can be useful for
42-
debugging or running commands manually, this is provided as a convenience:
54+
Due to the fact that obtaining the ``lfetool`` PATH settings can be useful
55+
for debugging or running commands manually, this is provided as a
56+
convenience:
4357

4458
.. code:: shell
4559
@@ -49,9 +63,8 @@ debugging or running commands manually, this is provided as a convenience:
4963
``info installdir``
5064
,,,,,,,,,,,,,,,,,,,
5165

52-
``lfetool install lfe`` finds the ``lib`` directory for the installed/active
53-
version of Erlang running and installs LFE there. This command returns the
54-
install dir for informational purposes:
66+
This command returns the ``lib`` directory for the installed/active version
67+
of Erlang:
5568

5669
.. code:: shell
5770

doc/manual/install.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,9 @@ used with LFE and LFE projects. Here's how you install it:
167167
168168
$ lfetool install rebar
169169
170+
By default, it is installed into the ``bin`` dir of the currently active
171+
version of Erlang.
172+
170173
.. code:: bash
171174
172175
$ lfetool install rebar ~/bin/

plugins/lfetool/templates/lfetool.tmpl

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -233,11 +233,17 @@ download_file () {
233233
echo "Download failed."
234234
}
235235

236-
get_install_dir () {
236+
get_erl_install_dir () {
237237
#erl -eval 'io:fwrite(code:lib_dir()), halt().' -run init stop -noshell
238238
erl -eval 'io:fwrite(re:replace(code:lib_dir(), "~", "~~", [global, {return,list}])), halt().' -run init stop -noshell
239239
}
240240

241+
get_erl_bin_dir () {
242+
installdir=`get_erl_install_dir`
243+
basedir=`dirname $installdir`
244+
echo "$basedir/bin"
245+
}
246+
241247
install_file () {
242248
src=$1
243249
directory=$2
@@ -294,7 +300,7 @@ install_lfe () {
294300
cd /tmp/ > /dev/null 2>&1 && \
295301
clone_repo $url && \
296302
cd $repo && make compile && \
297-
ERL_LIBS=`get_install_dir` make install && \
303+
ERL_LIBS=`get_erl_install_dir` make install && \
298304
cd .. > /dev/null 2>&1 && \
299305
rm -rf $repo && \
300306
cd startdir > /dev/null 2>&1
@@ -327,7 +333,7 @@ install_kerl () {
327333
install_rebar () {
328334
directory=$1
329335
if [ x"$directory" = x ]; then
330-
directory=/usr/local/bin
336+
directory=`get_erl_bin_dir`
331337
fi
332338
url="https://github.com/rebar/rebar.git"
333339
repo=rebar
@@ -1068,7 +1074,10 @@ do_info () {
10681074
get_erl_libs
10691075
;;
10701076
installdir)
1071-
get_install_dir
1077+
get_erl_install_dir
1078+
;;
1079+
bindir)
1080+
get_erl_bin_dir
10721081
;;
10731082
path)
10741083
get_path

plugins/lfetool/templates/usage.txt.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Currently, {{SCRIPT}} supports these commands (with subcommands nested):
2020
* repl
2121
* lfe (or no parameter/empty string), erlang, jlfe, jerl
2222
* info
23-
* erllibs, path, installdir, version
23+
* bindir, erllibs, path, installdir, version
2424

2525
Additionally, instead of passing a command, you may choose to run the script
2626
with one of the following options:

0 commit comments

Comments
 (0)