Commit graph

570 commits

Author SHA1 Message Date
David Celis
35ca51fe88 Update rbenv init instructions
The README details `eval`ing `rbenv init -`, but for some shells (such as fish) there's a difference in what should be run. It turns out that `rbenv init` on its own will print correct instructions, so we should point users to running that command instead.
2016-02-14 09:08:00 -08:00
Mislav Marohnić
d6ab394efd Merge pull request #863 from ErikAGriffin/patch-1
Updated Mac OSX brew install command
2016-02-01 22:48:28 +11:00
Erik Griffn
d29ba1f80e Updated Mac OSX brew install command
It seems rbenv now comes with ruby-build.  I have not investigated fully, but the previously shown command: `brew install rbenv ruby-build` caused issues on my machine.  After uninstalling both and simply running `brew install rbenv` everything worked fine.
2016-02-01 11:17:56 +00:00
Mislav Marohnić
c38833179b Merge pull request #852 from jasonkarns/extract-hook-helper
Extract hook helper
2016-01-04 18:48:10 +01:00
Jason Karns
565798d617 Test IFS handling in version-name/version-origin hooks 2016-01-04 09:14:28 -05:00
Jason Karns
0f7a2cad8d Use create_hook helper
Use extracted create_hook helper in tests for:

- exec
- hooks
- rehash
- version-name
- version-origin
- which
2016-01-04 09:14:25 -05:00
Jason Karns
5ccba5d7cc Extract common create_hook helper 2016-01-04 09:14:04 -05:00
Jason Karns
2cc2ec160e Remove redundant test
Spaces in hook path is tested in test/hooks.bats
2016-01-04 09:13:58 -05:00
Mislav Marohnić
a95ccd09a2 Simplify fallback to global version file 2015-12-29 14:44:32 +01:00
Mislav Marohnić
e199a3d8f7 Merge pull request #850 from jasonkarns/remove-legacy-global-version-file
Remove support for legacy global version files
2015-12-29 14:40:37 +01:00
Mislav Marohnić
fec0f56d0b Merge pull request #849 from jasonkarns/remove-legacy-version-file-handling
Remove all handling/support of .rbenv-version files
2015-12-29 14:34:08 +01:00
Jason Karns
fe809ea90d Remove support for legacy global version files
`default` was made legacy back in 2011 with
5be66da9f4 (the command was renamed from
`rbenv-default` to `rbenv-global`, and so the global file was renamed
from `$RBENV_ROOT/default` to `$RBENV_ROOT/global` (the latter taking
precedence)

`global` was then made legacy about a month later in Sep 2011 when the
preferred filename was changed to `$RBENV_ROOT/version`.
2015-12-28 22:05:00 -05:00
Jason Karns
f880dc6d6f Remove support for legacy version file 2015-12-28 21:34:07 -05:00
Jason Karns
3c9674453f fix local --unset test 2015-12-28 21:33:50 -05:00
Mislav Marohnić
22f4980a21 🔥 deprecated ruby-local-exec
It was useless for a while now. I should have nuked it prior to the
1.0.0 release but I forgot :(
2015-12-25 00:26:46 +01:00
Mislav Marohnić
abbcde665c Fix ToC level
[ci skip]
2015-12-24 20:02:37 +01:00
Mislav Marohnić
c9c9415154 Update ToC 2015-12-24 20:01:36 +01:00
Mislav Marohnić
3997a394d9 rbenv 1.0.0 2015-12-24 19:12:47 +01:00
Mislav Marohnić
e0b85397c8 Point out that it's not necessary to sudo gem install
Closes #532
2015-12-24 19:12:47 +01:00
Mislav Marohnić
e554cd86c3 Strip leading : from RBENV_HOOK_PATH 2015-12-24 19:12:47 +01:00
Mislav Marohnić
38692f97fe vim ignores, the-silver-searcher ignores 2015-12-24 18:18:44 +01:00
Mislav Marohnić
7e5680a0d8 Add configure + make step to installation instructions
This compiles the `realpath` dynamic extension for bash which speeds up
symlink resolution. If the extension doesn't compile due to
cross-platform issues, rbenv will still work normally, although not as fast.
2015-12-24 18:04:17 +01:00
Mislav Marohnić
d51f6d4376 Merge branch 'detect-shell-from-script'
Closes #730
2015-12-24 13:24:54 +01:00
Mislav Marohnić
a9a9636d1e Tweak sanitizing shell name
Handles situation when the output is `/bin/shell- args...`. First strip
away the arguments, then the trailing dash.
2015-12-24 13:23:01 +01:00
Daniel Hahler
32030e2ed9 Fix shell version when invoked from a script
When invoked from a shell script, `$(rbenv init -)` did not get the
shell name correct.
It needs to look at the `args` value from `ps`.

Ref: https://github.com/yyuu/pyenv/issues/373
2015-12-24 13:21:22 +01:00
Mislav Marohnić
f9d8b551dc Add test for detecting shell when rbenv init is called from script
References #730
2015-12-24 13:20:49 +01:00
Mislav Marohnić
2c7960102c Simplify reference to realpath.dylib within rbenv-versions
The `../libexec` dance isn't necessary here. It was only necessary in
main `rbenv` command because that one might have been pointed to
directly via a symlink.
2015-12-24 03:54:32 +01:00
Mislav Marohnić
1a0be6f0ad Improve git --version git revision lookup
It doesn't try to chdir into RBENV_ROOT anymore because that might be
a location of an unrelated rbenv install that might have a different
version than the current one that is installed e.g. via a package
manager such as Homebrew.

Now just tries the repo where the source files (`libexec/*`) are
located, and if that isn't a valid rbenv repo, bail out early.
2015-12-24 03:52:33 +01:00
Mislav Marohnić
6481cbb172 Merge branch 'version-hooks'
Closes #739
2015-12-23 17:42:44 +01:00
Mislav Marohnić
6e30032278 Simplify version-name, version-origin hook tests
No need for helper function that's gonna be used just once.
2015-12-23 17:39:14 +01:00
Mislav Marohnić
4fde4ecbaf Ensure RBENV_VERSION_ORIGIN is not inherited from environment
It's only supposed to be set from `version-origin` hooks, but not
inherited from environment in case it was set.
2015-12-23 17:26:53 +01:00
Mislav Marohnić
40c1d27445 Merge remote-tracking branch 'origin/master' into version-hooks 2015-12-23 17:22:43 +01:00
Jason Karns
97f0499f43 add version-name/version-origin to hooks completion 2015-12-23 17:22:31 +01:00
Jason Karns
c3a5f91ed0 create hook: version-origin
Expose a `version-origin` hook.

It is invoked *before* the traditional `rbenv-version-file` lookup. Because `version-origin` is traditionally run immediately after `version-name`, then any plugin hooks that alter `version-name` would have done so. Thus, running `version-origin` prior to printing the origin gives those plugins a chance to alter the `version-origin` to match.

If any of the hooks set `$RBENV_VERSION_ORIGIN`, then it is used as the return value. Otherwise, the existing logic continues to return "environment variable" or "filename" as appropriate.

This change, in conjunction with the `version-name` hook, makes a clean seam by which plugins can inject their own ruby version setting logic. Using this seam, as opposed to altering `$RBENV_COMMAND_PATH` from the `which` hook, means that the version name and origin are set more reliably and so `version`, `version-name`, `version-origin` and `which` all work as expected. Indeed, even PS1 works now.
2015-12-23 17:22:31 +01:00
Jason Karns
258e4413b1 create hook: version-name
Expose a `version-name` hook.

It is invoked *after* the traditional `RBENV_VERSION` lookup. Which means hook scripts can interrogate `$RBENV_VERSION_FILE` and/or `$RBENV_VERSION` (or use the executables).

The hooks are then run, giving plugins a chance to alter `RBENV_VERSION`. Once the hooks have run, we now have (in `$RBENV_VERSION`) the actual version we want to use (or it's empty which defaults to `system` per normal). Lastly, the same logic remains for checking if the version exists, or trimming the `ruby-` prefix.

Prime example: the ruby-bundler-ruby-version plugin can select a ruby by using the `ruby` directive from the `Gemfile` if a local `.ruby-version` doesn't exist.
2015-12-23 17:22:30 +01:00
Mislav Marohnić
a62a75369e Merge branch 'rbenv-local-respects-ancestry' 2015-12-23 15:30:18 +01:00
Mislav Marohnić
ba072adcb9 Have rbenv local read version from parent directories as well
Fixes #807
2015-12-23 15:21:24 +01:00
Mislav Marohnić
ca25259900 Allow explicit target directory argument to rbenv-version-file
Can be used for `.ruby-version` file lookup in the ancestry of a
specific directory. In this mode of operation, global version files
aren't taken into consideration, and the command fails unless a local
version file was found.
2015-12-23 15:19:54 +01:00
Mislav Marohnić
90373d78b9 Add test for not including current directory in PATH search
Confirms #836
2015-12-14 11:59:01 +01:00
Mislav Marohnić
dc23ef10b6 Merge pull request #836 from eagletmt/fix-path
Remove leading `:`
2015-12-12 15:22:36 +01:00
Kohei Suzuki
3c7a13d81f Remove leading : 2015-12-12 15:28:34 +09:00
Mislav Marohnić
20755cfc15 Merge pull request #833 from chulkilee/fix-url
update urls to rbenv
2015-12-07 20:47:06 +01:00
Chulki Lee
df4c16ecb4 update urls to rbenv 2015-12-07 11:03:07 -08:00
Mislav Marohnić
f0e8bdcdaf Merge pull request #830 from ReadmeCritic/master
Update README URLs based on HTTP redirects
2015-11-25 19:49:54 +01:00
ReadmeCritic
f85c41b14f Update README URLs based on HTTP redirects 2015-11-25 10:08:28 -08:00
Mislav Marohnić
75a1dd25cd Merge pull request #828 from jasonkarns/formatting
indentation
2015-11-24 17:22:33 +01:00
Jason Karns
a1ef9efc80 use PWD var over pwd command 2015-11-23 09:13:31 -05:00
Jason Karns
87dd5fe2c0 indentation 2015-11-23 09:13:31 -05:00
Mislav Marohnić
5fb9c84e14 Merge pull request #822 from jasonkarns/completion
Add --help and tab completion to rbenv-versions
2015-11-20 18:37:54 +01:00
Mislav Marohnić
d138f5f5e4 Merge pull request #826 from jasonkarns/fail-helper
Extract `fail` helper function
2015-11-20 18:29:34 +01:00