Commit graph

615 commits

Author SHA1 Message Date
Mark H. Wilkinson
050f750563 Fix pattern replacement to allow flags with commas. 2015-03-11 13:14:52 +00:00
Mislav Marohnić
4d72eefffc Merge branch 'fast-travis' 2015-02-28 12:56:49 +13:00
Mislav Marohnić
b6ac87c220 Faster bats clone 2015-02-27 02:17:31 +13:00
Mislav Marohnić
6b908bf39f Opt into fast Travis CI builds 2015-02-27 02:08:38 +13:00
Mislav Marohnić
f87d8762eb Merge pull request #698 from asymmetric/dead-readme-links
Remove dead links to History and License from README
2015-02-27 02:06:16 +13:00
Lorenzo Manacorda
c54fa3731f Remove dead links to Version history and License
Cfr. #688
2015-02-26 11:39:31 +01:00
Mislav Marohnić
4d0c289287 Merge pull request #688 from sstephenson/readme-no-history
Remove history, license information from README
2015-02-25 11:50:39 +13:00
Mislav Marohnić
52bb0dcfcf Merge pull request #687 from sstephenson/remove-prefix-warning
Remove warning about extraneous "ruby-" prefix in `.ruby-version`
2015-02-25 11:49:52 +13:00
Mislav Marohnić
98953c2e14 Merge pull request #696 from aprescott/patch-1
Update README to make rbenv version consistent with previous `versions` output
2015-02-18 11:36:34 +13:00
Adam Prescott
9ae8ba8a29 Update README to make rbenv version consistent with previous versions output
The `rbenv versions` info highlights 1.9.3-p327 as the current version, and
making `rbenv version` sample output match that helps make it clearer.
2015-02-16 10:56:38 -05:00
Mislav Marohnić
1a7f49d2f0 Merge pull request #695 from lyrixx/patch-1
[README] Updated link to bundler.io
2015-02-15 19:05:52 -08:00
Grégoire Pineau
70c6d3f67e [README] Updated link to bundler.io 2015-02-16 04:03:08 +01:00
Mislav Marohnić
b155380a06 Remove license information from README
The license information is already present in the LICENSE file.
2015-01-29 02:10:28 -08:00
Mislav Marohnić
cd60df52af Remove rbenv version history from README
We won't maintain it anymore. Instead, the changelogs can be obtained
from the project's Releases page: https://github.com/sstephenson/rbenv/releases
2015-01-29 02:09:05 -08:00
Mislav Marohnić
6820704c91 Remove warning about extraneous "ruby-" prefix in .ruby-version
When we started to support reading `.ruby-version` files, we made a
commitment to not support fuzzy version matching. Treating "ruby-2.1.5"
as "2.1.5" is a sort of fuzzy matching, so we put in place a warning
telling you to remove the extraneous "ruby-" prefix popularly used by
other Ruby version managers to denote MRI. (Their logic is that MRI is
"ruby" and other rubies are not "ruby", apparently.)

However, people are often not able to remove the prefix in their
projects because they want to support other coworkers and tools that
sadly still require the prefix, like RubyMine.

So to restore sanity for a big portion of our users, the warning is gone.
2015-01-29 01:55:58 -08:00
No GUI
55341f4436 Include gems dir in .gitignore
Since communal-gems is maintainer-approved, thought it would be useful to include the directory it uses in the ignore list.

(This also helps me, since I install rbenv as submodule and without this entry, the submodule is perpetually marked dirty.)
2015-01-20 13:21:22 -07:00
Kevin Burke
c9a96c9f79 Use command to run rbenv rehash
In the event that `eval "$(rbenv init -)"` is called from a function named
rbenv (which I do to get rbenv to load lazily in my shell), evaluating the
phrase `rbenv rehash` will cause the outer function to run again (causing an
infinite loop).

This change makes it clear you want the command named rbenv and not a function
which may exist in the environment.
2014-11-28 21:16:14 -08:00
Mislav Marohnić
7e0e85bdda Avoid JRuby warning during rehash Rubygems plugin
As it seems, JRuby 1.7 complains on stderr every time you invoke `system`:

    warning: executable? does not in this environment and will return a dummy value

It doesn't seem to complain when backtics are used. It's safe to use
backticks here because `rbenv rehash` doesn't output anything on stdout,
and the exit status of the command is irrelevant.
2014-10-19 18:06:09 +02:00
Mislav Marohnić
d1a0398fdb Merge pull request #638 from sstephenson/gem-rehash
Bring rbenv-gem-rehash functionality to core
2014-10-19 14:51:45 +02:00
Mislav Marohnić
67f429c41d Bring automatic gem-rehash functionality to rbenv core
This bakes in the functionality of rbenv-gem-rehash plugin.

The Rubygems hook is improved:

- It will not rehash for gems installed in locations that rbenv otherwise
  doesn't search for binstubs; for instance in case of
  `bundle --path vendor/bundle`.
- It rescues exceptions and makes them non-lethal by warning on stderr.
2014-10-19 14:35:43 +02:00
Mislav Marohnić
632263568e Add rbenv's own rbenv.d directory to hook paths
This allows rbenv source code to ship with built-in hooks.
2014-10-19 14:35:36 +02:00
Mislav Marohnić
bf39d88d11 Add tests for rbenv PATH and RBENV_HOOK_PATH handling 2014-10-19 14:35:36 +02:00
Mislav Marohnić
07d675350f Merge pull request #636 from sstephenson/speedup-rehash
Speed up `rbenv rehash`
2014-10-16 12:29:51 +02:00
Mislav Marohnić
39cde6fc95 Merge pull request #528 from sstephenson/dylib
Speed up rbenv by dynamically loading compiled command
2014-10-15 18:19:54 +02:00
Mislav Marohnić
1381c2ca79 Simplify the shims registration implementation in rbenv-rehash
It doesn't need to be a bash array and we don't need a separate index of
shims registered. Simply keep everything in a space-separated string and
use that as an index as well.

This assumes that executable names *never* have spaces in them.
2014-10-15 05:46:18 +02:00
Mislav Marohnić
89d4e8a0e0 Speed up rehash process when there are many Ruby versions
On my system that has 25 versions under rbenv, this speeds up rehash
almost 3-fold:

- before: 391 ms
- after:  134 ms

This is achieved by removing duplicate names of executables before
registering them as shims. Since most Rubies will share a lot of the
same executable names ("ruby", "rake", "bundle", ...), this is a
considerable reduction in number of shims registered.
2014-10-15 05:46:18 +02:00
Mislav Marohnić
a8df5d587c Avoid changing directories during rehash process 2014-10-15 05:46:18 +02:00
Mislav Marohnić
e2173df4aa Revert "Don't duplicate shims in PATH"
Too many of our users have a shell initialization set up that
inadvertently duplicates some or most of the entries in their PATH,
bringing the system paths again in front of rbenv's shims. If this was a
nested shell (a typical scenario when starting up tmux), `rbenv init`
would get eval'd again but this time, shims won't get added to the front
of the PATH and would only stay and the end of the path, effectively
rendering them useless.

I tried to argue that this is a user problem rather than rbenv's, but I
can't fix everybody shell init when they report bugs. Instead, let's
revert to simpler times in rbenv where we just roll along with the
duplication and don't ask any questions.

This reverts commit 03fa148e81.

Fixes #369
2014-10-15 01:43:24 +02:00
Mislav Marohnić
e851250da6 Speed up obtaining exec/which/whence completions
Delegate to `rbenv-shims` instead of `rbenv shims` and therefore skip
going through the main `rbenv` executable again that would set up a lot
of the environment that was already set.
2014-10-15 01:24:45 +02:00
Mislav Marohnić
c69d9a1128 Isolate rbenv-which tests from any .ruby-version file on the system
Having a `.ruby-version` file in any of the parent directories of the
local clone of rbenv could cause the test suite to fail because it
wasn't expecting a local version to be set.

Fixes #533
2014-10-13 12:39:47 +02:00
Mislav Marohnić
f4652fbbf0 Merge branch 'speedup-which'
Closes #560
2014-10-13 12:30:34 +02:00
Mislav Marohnić
3ee395f9b5 Clean up PATH sanitization in rbenv-which 2014-10-13 12:27:19 +02:00
Daniel Hahler
e4cbf04592 Improve performance of rbenv-which when RBENV_VERSION=system
This implements removing of the shims path element via bash
substitution, instead of jumping around in all the `$PATH` elements.
2014-10-13 12:26:43 +02:00
Mislav Marohnić
6bb7f07d2d Avoid rbenv-exec calling out to rbenv-version-name twice
Running any shim (and thus `rbenv-exec`) would always execute
`rbenv-version-name` twice: once in `rbenv-exec` and another time in
`rbenv-which`, even though RBENV_VERSION variable would have already
been populated at this point.

Now RBENV_VERSION is respected within `rbenv-which`.
2014-10-13 12:26:43 +02:00
Mislav Marohnić
51bd975820 Merge branch 'blank-versions'
Fixes #626
2014-10-13 11:51:46 +02:00
Mislav Marohnić
294cff3fd4 Fall back to cc as default compiler when gcc is not available 2014-10-13 04:12:35 +02:00
Mislav Marohnić
a6e0785b84 Create configure script to generate a cross-platform Makefile
The previous Makefile only worked on OS X. The dynamically generated
Makefile (from `Makefile.in`) should now work on multiple platforms
(tested on OS X and Ubuntu).
2014-10-13 04:12:35 +02:00
Mislav Marohnić
302b317b89 Fix shobj-conf on Darwin
The `shobj-conf` script imported from bash seems to not support the
latest OS X. This makes sure that `SHOBJ_LDFLAG=-dynamiclib` is output
for Darwin10+ (latest version is Darwin 13.0).
2014-10-13 04:12:35 +02:00
Mislav Marohnić
8facb3b3a7 Import shobj-conf script from bash
Given the `-o <HOST-OS>` parameter, the script generates environment
variables with information how to compile dynamically loadable libraries
for that system.

Imported from bash-3.2.48
2014-10-13 04:12:35 +02:00
Mislav Marohnić
b5622bee3a Try without -current_version
Seems to only work on OS X; fails on Travis
https://travis-ci.org/sstephenson/rbenv/jobs/16384866
2014-10-13 04:12:35 +02:00
Mislav Marohnić
3f74da0e73 Fail hard if RBENV_NATIVE_EXT is set but extensions failed to load 2014-10-13 04:12:35 +02:00
Mislav Marohnić
68b92a7f5d Test compiled native extensions on Travis CI 2014-10-13 04:12:35 +02:00
Mislav Marohnić
8bac958994 Stop using abs_dirname() in rbenv-init
It's slow and not necessary since we expect `$0` to already be expanded.

In tests this change forces us to deal with some relative paths, but
it's not a big deal. The `rbenv init -` output in the most common case
will be the same as before:

    source '/home/myuser/.rbenv/libexec/../completions/rbenv.bash'
2014-10-13 04:12:34 +02:00
Mislav Marohnić
5287e2ebf4 Avoid slow abs_dirname() by loading realpath extension
This speeds up every `rbenv` invocation significantly.
2014-10-13 04:12:34 +02:00
Mislav Marohnić
284588f9b4 Fix hooks tests on OS X by expanding BATS_TMPDIR
With `realpath` extension, hooks tests on OS X will output
`/private/tmp` instead of `/tmp` because the latter is an actual symlink
to the former.

Avoid this mistmach in output assertions by expanding BATS_TMPDIR if
`realpath` extension is compiled.
2014-10-13 04:12:34 +02:00
Mislav Marohnić
16c7eb4135 Speed up realpath() with dynamically loaded C extension
On systems that support both C compiling and dynamic loading, we can
speed up `realpath()` (where most time in rbenv is spent) by replacing
it with a dynamically loaded bash builtin.

When `make -C src` is called in the project's root,
`libexec/rbenv-realpath.dylib` will be created. If it exists, rbenv will
attempt to load it as a builtin command. If it fails, execution will
fall back to the old `realpath()` shell function.
2014-10-13 04:12:34 +02:00
Mislav Marohnić
9bcef4b875 Add tests for non-directory types under RBENV_ROOT/versions/ 2014-10-13 04:02:46 +02:00
Mislav Marohnić
f237a11f4f Have versions emit a warning when no Ruby version was found 2014-10-13 04:02:04 +02:00
Mislav Marohnić
13a474c4e9 Get rid of explicit exit in fish branch of rbenv-init
Allows for code to be added to the end of the script which will not
mysteriously fail to run for fish shell.
2014-06-03 00:39:34 +07:00
Mislav Marohnić
fe0b2436b8 Merge pull request #581 from LawnGnome/solaris-gawk
Prefer gawk over awk if both are available.

Fixes rbenv-help on Solaris 11.1
2014-04-19 15:29:31 +02:00