summaryrefslogtreecommitdiffstats
path: root/pre_commit/languages/ruby.py
diff options
context:
space:
mode:
Diffstat (limited to 'pre_commit/languages/ruby.py')
-rw-r--r--pre_commit/languages/ruby.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/pre_commit/languages/ruby.py b/pre_commit/languages/ruby.py
index 73b23cc..1a0f0c7 100644
--- a/pre_commit/languages/ruby.py
+++ b/pre_commit/languages/ruby.py
@@ -8,7 +8,6 @@ from typing import Sequence
from typing import Tuple
import pre_commit.constants as C
-from pre_commit import parse_shebang
from pre_commit.envcontext import envcontext
from pre_commit.envcontext import PatchesT
from pre_commit.envcontext import UNSET
@@ -26,7 +25,7 @@ healthy = helpers.basic_healthy
@functools.lru_cache(maxsize=1)
def get_default_version() -> str:
- if all(parse_shebang.find_executable(exe) for exe in ('ruby', 'gem')):
+ if all(helpers.exe_exists(exe) for exe in ('ruby', 'gem')):
return 'system'
else:
return C.DEFAULT
@@ -122,8 +121,8 @@ def install_environment(
# Need to call this before installing so rbenv's directories
# are set up
helpers.run_setup_cmd(prefix, ('rbenv', 'init', '-'))
- # XXX: this will *always* fail if `version == C.DEFAULT`
- _install_ruby(prefix, version)
+ if version != C.DEFAULT:
+ _install_ruby(prefix, version)
# Need to call this after installing to set up the shims
helpers.run_setup_cmd(prefix, ('rbenv', 'rehash'))
@@ -134,7 +133,8 @@ def install_environment(
helpers.run_setup_cmd(
prefix,
(
- 'gem', 'install', '--no-document',
+ 'gem', 'install',
+ '--no-document', '--no-format-executable',
*prefix.star('.gem'), *additional_dependencies,
),
)