Skip to content

Commit e891f86

Browse files
authored
Merge pull request #2905 from jaysoffian/fix-gem-install
Force gem installation into envdir
2 parents f073f8e + 50b1511 commit e891f86

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pre_commit/languages/ruby.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ def _install_ruby(
114114
def install_environment(
115115
prefix: Prefix, version: str, additional_dependencies: Sequence[str],
116116
) -> None:
117+
envdir = lang_base.environment_dir(prefix, ENVIRONMENT_DIR, version)
118+
117119
if version != 'system': # pragma: win32 no cover
118120
_install_rbenv(prefix, version)
119121
with in_env(prefix, version):
@@ -135,6 +137,8 @@ def install_environment(
135137
'gem', 'install',
136138
'--no-document', '--no-format-executable',
137139
'--no-user-install',
140+
'--install-dir', os.path.join(envdir, 'gems'),
141+
'--bindir', os.path.join(envdir, 'gems', 'bin'),
138142
*prefix.star('.gem'), *additional_dependencies,
139143
),
140144
)

0 commit comments

Comments
 (0)