blob: 6239b75cec515fa3a6d501415c86cf288c884dfc (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
gbpm (<generic binary> path mangler)
https://git.potato.am/gbpm.git/
Manage multiple Python/Ruby/etc. installations with no black magic.
NOTES
gbpm only manages installations located in GBPM_OPTS_PATH, shadowing
binaries already reachable from PATH. No information on external
installations is displayed.
A substring match is performed when selecting an installation, with
tiebreak rules to choose intuitively, the greatest being selected
amongst equally ranked matches. For example, `2.1' will match
`python-2.1.3' over `python-2.1.2' or `python-3.2.1'.
DEPENDENCIES
bash (>= 4.0)
coreutils (sort)
INSTALLING
The output of this script is a series of commands to be executed, e.g.
via a shell function in `~/.bashrc':
pypm() {
. <(
GBPM_OPTS_PATH="${HOME}/.pythons" \
/path/to/gbpm.sh "${@}")
}
rbpm() {
. <(
GBPM_OPTS_PATH="${HOME}/.rubies" \
/path/to/gbpm.sh "${@}")
}
INSTALLING VERSIONS
With `~/.rubies' as the managed directory, the path to a ruby binary
should look something like:
~/.rubies/ruby-2.1.2/bin/ruby
To install Ruby to this directory:
$ wget https://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.2.tar.bz2
$ tar -xf ruby-2.1.2.tar.bz2
$ cd ruby-2.1.2
$ ./configure --prefix="${HOME}"/.rubies/ruby-2.1.2
$ make
$ make install
USAGE
A series of commands showing gbpm in use, through an `rbpm' function:
$ ruby -v
bash: ruby: command not found
$ rbpm ls
ruby-1.8.7-p374
ruby-1.9.3-p547
ruby-2.1.2
$ rbpm set 2.1
adding /home/david/.rubies/ruby-2.1.2/bin to PATH
$ rbpm ls
ruby-1.8.7-p374
ruby-1.9.3-p547
* ruby-2.1.2
$ ruby -v
ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-linux]
$ rbpm set 1.9
removing /home/david/.rubies/ruby-2.1.2/bin from PATH
adding /home/david/.rubies/ruby-1.9.3-p547/bin to PATH
$ ruby -v
ruby 1.9.3p547 (2014-05-14 revision 45962) [x86_64-linux]
$ rbpm clear
removing /home/david/.rubies/ruby-1.9.3-p547/bin from PATH
$ ruby -v
bash: ruby: command not found
To set the version from a .ruby-version file:
$ rbpm set $(cat .ruby-version)
adding /home/david/.rubies/ruby-1.8.7-p374/bin to PATH
AUTHORS
David Vazgenovich Shakaryan
LICENSE
Distributed under the terms of the MIT License.
See included COPYING file for the full license text.
# vim: set sw=2 sts=2 ts=2 et tw=72 spell spl=en :
|