Skip to content
Newer
Older
100644 91 lines (60 sloc) 3.21 KB
d5ae49f @jneen update the README
authored
1 # ry: the simplest ruby virtual env
bf30b11 @jneen stub of a readme
authored
2
3 ## Installation
4
000c456 update install instructions
http://jayferd.us/ authored
5 If you're on a Mac with homebrew installed, you may simply `brew install ry` and follow the instructions.
6
7 Otherwise, install the files from the repo to your favorite prefix (I use `~/.local`, which is the default).
bf30b11 @jneen stub of a readme
authored
8
9 ``` bash
8281eee update url in readme
http://jneen.net/ authored
10 git clone git://github.com/jneen/ry
1ee8223 @jneen rename to `ry`
authored
11 cd ry
bf30b11 @jneen stub of a readme
authored
12 PREFIX=$HOME/.local make install
13 ```
14
70202b7 @eregon zsh completion: use the more idiomatic way by having an autoloadable …
eregon authored
15 and add the following lines to your bashrc (or zshrc):
bf30b11 @jneen stub of a readme
authored
16
a43c8a3 @jneen add a note about the setup
authored
17 ``` bash
c949584 @jneen add a clarifying note about the ~/.local prefix
authored
18 # If you're using the default ~/.local prefix,
19 # make sure ~/.local/bin is on your $PATH.
52dec2f @DDAZZA add ry to path
DDAZZA authored
20 export PATH="$HOME/.local/bin:$PATH"
1ee8223 @jneen rename to `ry`
authored
21 eval "$(ry setup)"
bf30b11 @jneen stub of a readme
authored
22 ```
a43c8a3 @jneen add a note about the setup
authored
23
24 or, if you don't like `eval`, you can do it manually:
25
26 ``` bash
000c456 update install instructions
http://jayferd.us/ authored
27 export PATH="$PREFIX/lib/ry/current/bin:$PATH"
bf30b11 @jneen stub of a readme
authored
28 ```
fccb812 @jneen flesh out the README
authored
29
58c2e89 @eregon Fixes #30: update the link to the ZSH completion file
eregon authored
30 For ZSH completion, see [this](https://github.com/jneen/ry/blob/master/share/ry.zsh_completion).
70202b7 @eregon zsh completion: use the more idiomatic way by having an autoloadable …
eregon authored
31
7fc348d @mrak made installation directory for rubies set-able via environment variable
mrak authored
32 If you want to specify a different directory for installing rubies:
33
34 ```bash
35 # rubies are installed into $RY_PREFIX/lib/ry/rubies
36 # set RY_RUBIES for an alternate location
37 export RY_RUBIES="$HOME/.rubies"
38 ```
39
fccb812 @jneen flesh out the README
authored
40 ## Usage
41
d5ae49f @jneen update the README
authored
42 Ry is a bit different from [other][rvm] [version][rbenv] [managers][nvm]. The major design goal of ry is to be explicit, unobtrusive, and easy to query. In the vein of the [n][] package manager for node, there are no subshells, and the only thing it needs to add to your environment is a single entry to your `$PATH` (also tab completion if you like). For example, here's how you create a new installation:
fccb812 @jneen flesh out the README
authored
43
f75a256 @shanepelletier Fix link to RVM
shanepelletier authored
44 [rvm]: http://rvm.io/
e1aef2a @jneen fix the link to nvm
authored
45 [nvm]: https://github.com/creationix/nvm
fccb812 @jneen flesh out the README
authored
46 [rbenv]: https://github.com/sstephenson/rbenv
47 [n]: https://github.com/visionmedia/n
48
49 ``` bash
839085d @semmons99 fix a command typo in README.md
semmons99 authored
50 ry install http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p125.tar.gz mri-1.9.3
fccb812 @jneen flesh out the README
authored
51 ```
52
53 This creates an installation of Ruby called `mri-1.9.3` using the tarball from `ruby-lang.org`. To switch to this ruby, use
54
55 ``` bash
8ccbff2 @jneen typo
authored
56 ry use mri-1.9.3 # or: ry mri-1.9.3
fccb812 @jneen flesh out the README
authored
57 ```
58
1e5e071 @jneen update README
authored
59 Want to use a custom commit?
fccb812 @jneen flesh out the README
authored
60
61 ``` bash
1e5e071 @jneen update README
authored
62 ry install https://github.com/ruby/ruby/tarball/<hash> mri-custom
fccb812 @jneen flesh out the README
authored
63 ```
64
1e5e071 @jneen update README
authored
65 ### ruby-build
66 If you have `ruby-build` installed, you can use it very easily with ry:
fccb812 @jneen flesh out the README
authored
67
68 ``` bash
1e5e071 @jneen update README
authored
69 ry install 1.9.3-p125
fccb812 @jneen flesh out the README
authored
70 ```
71
33d7f65 add doc about shell-local selection
http://jneen.net/ authored
72 ### shell-local ruby selection
73
74 Because `ry use` changes a symlink, that ruby is globally activated across all shells. To use a shell-local ruby, simply set your `$PATH` to include that ruby's bin dir. The easiest way to do this is to use the `ry fullpath <ruby>` helper, which outputs a copy of your `$PATH` variable modified for use with ry.
75
76 ``` bash
77 export PATH="$(ry fullpath my-cool-ruby)"
78 ```
79
80 You can activate this automatically with something like [direnv](http://direnv.net/).
81
1e5e071 @jneen update README
authored
82 For more information, see `ry help`.
1e3ca40 @jneen add some notes in the README about my shell idiosyncracies
authored
83
84 ## Developing
85
86 All of the magic is in the bash script `bin/ry`. Here are a couple of bash features I use that aren't common elsewhere:
87
88 * Poor man's namespacing - the character `:` is a perfectly valid character to use in a bash function's name. All of ry's subcommands are implemented as functions looking like `ry::foo`. At the bottom of the file is the function `ry` which essentially delegates to `ry::$1` - so to add a new subcommand, all you need to do is define the bash function and document it in `ry::usage`.
89
90 * Piping from heredocs is awesome. The syntax `cmd <<<"$variable"` runs `cmd` with stdin as the content of `$variable`. I use this extensively, and you should too.
Something went wrong with that request. Please try again.