We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
/dev/null not found with pre-commit 3.0.2
### search you tried in the issue tracker

/dev/null

### describe your issue

After upgrading to pre-commit 3.0.2, one of my users (on up-to-date macos) is reporting that invoking ruby actions fails with `/dev/null` not found.

Relevant output:

```
rubocop..................................................................Failed
- hook id: rubocop
- exit code: 2

/dev/null not found
/Users/user/.rvm/rubies/ruby-3.1.3/lib/ruby/3.1.0/bundler/definition.rb:36:in `build'
/Users/user/.rvm/rubies/ruby-3.1.3/lib/ruby/3.1.0/bundler.rb:207:in `definition'
/Users/user/.rvm/rubies/ruby-3.1.3/lib/ruby/3.1.0/bundler.rb:190:in `load'
/Users/user/.cache/pre-commit/repojquw8lys/rbenv-default/gems/gems/rubocop-1.42.0/lib/rubocop/config_loader_resolver.rb:270:in `gem_config_path'
/Users/user/.cache/pre-commit/repojquw8lys/rbenv-default/gems/gems/rubocop-1.42.0/lib/rubocop/config_loader_resolver.rb:65:in `block (2 levels) in resolve_inheritance_from_gems'
/Users/user/.cache/pre-commit/repojquw8lys/rbenv-default/gems/gems/rubocop-1.42.0/lib/rubocop/config_loader_resolver.rb:63:in `reverse_each'
/Users/user/.cache/pre-commit/repojquw8lys/rbenv-default/gems/gems/rubocop-1.42.0/lib/rubocop/config_loader_resolver.rb:63:in `block in resolve_inheritance_from_gems'
/Users/user/.cache/pre-commit/repojquw8lys/rbenv-default/gems/gems/rubocop-1.42.0/lib/rubocop/config_loader_resolver.rb:57:in `each_pair'
/Users/user/.cache/pre-commit/repojquw8lys/rbenv-default/gems/gems/rubocop-1.42.0/lib/rubocop/config_loader_resolver.rb:57:in `resolve_inheritance_from_gems'
/Users/user/.cache/pre-commit/repojquw8lys/rbenv-default/gems/gems/rubocop-1.42.0/lib/rubocop/config_loader.rb:49:in `load_file'
/Users/user/.cache/pre-commit/repojquw8lys/rbenv-default/gems/gems/rubocop-1.42.0/lib/rubocop/config_loader.rb:104:in `configuration_from_file'
/Users/user/.cache/pre-commit/repojquw8lys/rbenv-default/gems/gems/rubocop-1.42.0/lib/rubocop/config_store.rb:68:in `for_dir'
/Users/user/.cache/pre-commit/repojquw8lys/rbenv-default/gems/gems/rubocop-1.42.0/lib/rubocop/config_store.rb:47:in `for_pwd'
/Users/user/.cache/pre-commit/repojquw8lys/rbenv-default/gems/gems/rubocop-1.42.0/lib/rubocop/cli.rb:147:in `apply_default_formatter'
/Users/user/.cache/pre-commit/repojquw8lys/rbenv-default/gems/gems/rubocop-1.42.0/lib/rubocop/cli.rb:47:in `run'
/Users/user/.cache/pre-commit/repojquw8lys/rbenv-default/gems/gems/rubocop-1.42.0/exe/rubocop:19:in `block in <top (required)>'
/Users/user/.rvm/rubies/ruby-3.1.3/lib/ruby/3.1.0/benchmark.rb:311:in `realtime'
/Users/user/.cache/pre-commit/repojquw8lys/rbenv-default/gems/gems/rubocop-1.42.0/exe/rubocop:19:in `<top (required)>'
/Users/user/.cache/pre-commit/repojquw8lys/rbenv-default/gems/bin/rubocop:25:in `load'
/Users/user/.cache/pre-commit/repojquw8lys/rbenv-default/gems/bin/rubocop:25:in `<main>'
/Users/user/.cache/pre-commit/repojquw8lys/rbenv-default/gems/bin/ruby_executable_hooks:22:in `eval'
/Users/user/.cache/pre-commit/repojquw8lys/rbenv-default/gems/bin/ruby_executable_hooks:22:in `<main>'
```

This looks closely related to #2727.

For what it's worth, I did confirm that the user actually has a working `/dev/null` on their system.

### pre-commit --version

pre-commit 3.0.2

### .pre-commit-config.yaml

```yaml
repos:
- repo: https://github.com/rubocop/rubocop.git
  rev: '0f7416a0b3ea4a3d4edb1f2091ce8706ea3e6640'
  hooks:
    - id: rubocop
      additional_dependencies: ["standard:1.22.1"]
```


### ~/.cache/pre-commit/pre-commit.log (if present)

_No response_

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `pre_commit/languages/ruby.py`
Content:
```
1 from __future__ import annotations
2 
3 import contextlib
4 import functools
5 import os.path
6 import shutil
7 import tarfile
8 from typing import Generator
9 from typing import Sequence
10 
11 import pre_commit.constants as C
12 from pre_commit.envcontext import envcontext
13 from pre_commit.envcontext import PatchesT
14 from pre_commit.envcontext import UNSET
15 from pre_commit.envcontext import Var
16 from pre_commit.languages import helpers
17 from pre_commit.prefix import Prefix
18 from pre_commit.util import CalledProcessError
19 from pre_commit.util import resource_bytesio
20 
21 ENVIRONMENT_DIR = 'rbenv'
22 health_check = helpers.basic_health_check
23 run_hook = helpers.basic_run_hook
24 
25 
26 @functools.lru_cache(maxsize=1)
27 def get_default_version() -> str:
28     if all(helpers.exe_exists(exe) for exe in ('ruby', 'gem')):
29         return 'system'
30     else:
31         return C.DEFAULT
32 
33 
34 def get_env_patch(
35         venv: str,
36         language_version: str,
37 ) -> PatchesT:
38     patches: PatchesT = (
39         ('GEM_HOME', os.path.join(venv, 'gems')),
40         ('GEM_PATH', UNSET),
41         ('BUNDLE_IGNORE_CONFIG', '1'),
42         ('BUNDLE_GEMFILE', os.devnull),
43     )
44     if language_version == 'system':
45         patches += (
46             (
47                 'PATH', (
48                     os.path.join(venv, 'gems', 'bin'), os.pathsep,
49                     Var('PATH'),
50                 ),
51             ),
52         )
53     else:  # pragma: win32 no cover
54         patches += (
55             ('RBENV_ROOT', venv),
56             (
57                 'PATH', (
58                     os.path.join(venv, 'gems', 'bin'), os.pathsep,
59                     os.path.join(venv, 'shims'), os.pathsep,
60                     os.path.join(venv, 'bin'), os.pathsep, Var('PATH'),
61                 ),
62             ),
63         )
64     if language_version not in {'system', 'default'}:  # pragma: win32 no cover
65         patches += (('RBENV_VERSION', language_version),)
66 
67     return patches
68 
69 
70 @contextlib.contextmanager
71 def in_env(prefix: Prefix, version: str) -> Generator[None, None, None]:
72     envdir = helpers.environment_dir(prefix, ENVIRONMENT_DIR, version)
73     with envcontext(get_env_patch(envdir, version)):
74         yield
75 
76 
77 def _extract_resource(filename: str, dest: str) -> None:
78     with resource_bytesio(filename) as bio:
79         with tarfile.open(fileobj=bio) as tf:
80             tf.extractall(dest)
81 
82 
83 def _install_rbenv(
84         prefix: Prefix,
85         version: str,
86 ) -> None:  # pragma: win32 no cover
87     envdir = helpers.environment_dir(prefix, ENVIRONMENT_DIR, version)
88 
89     _extract_resource('rbenv.tar.gz', prefix.path('.'))
90     shutil.move(prefix.path('rbenv'), envdir)
91 
92     # Only install ruby-build if the version is specified
93     if version != C.DEFAULT:
94         plugins_dir = os.path.join(envdir, 'plugins')
95         _extract_resource('ruby-download.tar.gz', plugins_dir)
96         _extract_resource('ruby-build.tar.gz', plugins_dir)
97 
98 
99 def _install_ruby(
100         prefix: Prefix,
101         version: str,
102 ) -> None:  # pragma: win32 no cover
103     try:
104         helpers.run_setup_cmd(prefix, ('rbenv', 'download', version))
105     except CalledProcessError:  # pragma: no cover (usually find with download)
106         # Failed to download from mirror for some reason, build it instead
107         helpers.run_setup_cmd(prefix, ('rbenv', 'install', version))
108 
109 
110 def install_environment(
111         prefix: Prefix, version: str, additional_dependencies: Sequence[str],
112 ) -> None:
113     if version != 'system':  # pragma: win32 no cover
114         _install_rbenv(prefix, version)
115         with in_env(prefix, version):
116             # Need to call this before installing so rbenv's directories
117             # are set up
118             helpers.run_setup_cmd(prefix, ('rbenv', 'init', '-'))
119             if version != C.DEFAULT:
120                 _install_ruby(prefix, version)
121             # Need to call this after installing to set up the shims
122             helpers.run_setup_cmd(prefix, ('rbenv', 'rehash'))
123 
124     with in_env(prefix, version):
125         helpers.run_setup_cmd(
126             prefix, ('gem', 'build', *prefix.star('.gemspec')),
127         )
128         helpers.run_setup_cmd(
129             prefix,
130             (
131                 'gem', 'install',
132                 '--no-document', '--no-format-executable',
133                 '--no-user-install',
134                 *prefix.star('.gem'), *additional_dependencies,
135             ),
136         )
137
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/pre_commit/languages/ruby.py b/pre_commit/languages/ruby.py
--- a/pre_commit/languages/ruby.py
+++ b/pre_commit/languages/ruby.py
@@ -39,7 +39,6 @@
         ('GEM_HOME', os.path.join(venv, 'gems')),
         ('GEM_PATH', UNSET),
         ('BUNDLE_IGNORE_CONFIG', '1'),
-        ('BUNDLE_GEMFILE', os.devnull),
     )
     if language_version == 'system':
         patches += (

{"golden_diff": "diff --git a/pre_commit/languages/ruby.py b/pre_commit/languages/ruby.py\n--- a/pre_commit/languages/ruby.py\n+++ b/pre_commit/languages/ruby.py\n@@ -39,7 +39,6 @@\n         ('GEM_HOME', os.path.join(venv, 'gems')),\n         ('GEM_PATH', UNSET),\n         ('BUNDLE_IGNORE_CONFIG', '1'),\n-        ('BUNDLE_GEMFILE', os.devnull),\n     )\n     if language_version == 'system':\n         patches += (\n", "issue": "/dev/null not found with pre-commit 3.0.2\n### search you tried in the issue tracker\n\n/dev/null\n\n### describe your issue\n\nAfter upgrading to pre-commit 3.0.2, one of my users (on up-to-date macos) is reporting that invoking ruby actions fails with `/dev/null` not found.\r\n\r\nRelevant output:\r\n\r\n```\r\nrubocop..................................................................Failed\r\n- hook id: rubocop\r\n- exit code: 2\r\n\r\n/dev/null not found\r\n/Users/user/.rvm/rubies/ruby-3.1.3/lib/ruby/3.1.0/bundler/definition.rb:36:in `build'\r\n/Users/user/.rvm/rubies/ruby-3.1.3/lib/ruby/3.1.0/bundler.rb:207:in `definition'\r\n/Users/user/.rvm/rubies/ruby-3.1.3/lib/ruby/3.1.0/bundler.rb:190:in `load'\r\n/Users/user/.cache/pre-commit/repojquw8lys/rbenv-default/gems/gems/rubocop-1.42.0/lib/rubocop/config_loader_resolver.rb:270:in `gem_config_path'\r\n/Users/user/.cache/pre-commit/repojquw8lys/rbenv-default/gems/gems/rubocop-1.42.0/lib/rubocop/config_loader_resolver.rb:65:in `block (2 levels) in resolve_inheritance_from_gems'\r\n/Users/user/.cache/pre-commit/repojquw8lys/rbenv-default/gems/gems/rubocop-1.42.0/lib/rubocop/config_loader_resolver.rb:63:in `reverse_each'\r\n/Users/user/.cache/pre-commit/repojquw8lys/rbenv-default/gems/gems/rubocop-1.42.0/lib/rubocop/config_loader_resolver.rb:63:in `block in resolve_inheritance_from_gems'\r\n/Users/user/.cache/pre-commit/repojquw8lys/rbenv-default/gems/gems/rubocop-1.42.0/lib/rubocop/config_loader_resolver.rb:57:in `each_pair'\r\n/Users/user/.cache/pre-commit/repojquw8lys/rbenv-default/gems/gems/rubocop-1.42.0/lib/rubocop/config_loader_resolver.rb:57:in `resolve_inheritance_from_gems'\r\n/Users/user/.cache/pre-commit/repojquw8lys/rbenv-default/gems/gems/rubocop-1.42.0/lib/rubocop/config_loader.rb:49:in `load_file'\r\n/Users/user/.cache/pre-commit/repojquw8lys/rbenv-default/gems/gems/rubocop-1.42.0/lib/rubocop/config_loader.rb:104:in `configuration_from_file'\r\n/Users/user/.cache/pre-commit/repojquw8lys/rbenv-default/gems/gems/rubocop-1.42.0/lib/rubocop/config_store.rb:68:in `for_dir'\r\n/Users/user/.cache/pre-commit/repojquw8lys/rbenv-default/gems/gems/rubocop-1.42.0/lib/rubocop/config_store.rb:47:in `for_pwd'\r\n/Users/user/.cache/pre-commit/repojquw8lys/rbenv-default/gems/gems/rubocop-1.42.0/lib/rubocop/cli.rb:147:in `apply_default_formatter'\r\n/Users/user/.cache/pre-commit/repojquw8lys/rbenv-default/gems/gems/rubocop-1.42.0/lib/rubocop/cli.rb:47:in `run'\r\n/Users/user/.cache/pre-commit/repojquw8lys/rbenv-default/gems/gems/rubocop-1.42.0/exe/rubocop:19:in `block in <top (required)>'\r\n/Users/user/.rvm/rubies/ruby-3.1.3/lib/ruby/3.1.0/benchmark.rb:311:in `realtime'\r\n/Users/user/.cache/pre-commit/repojquw8lys/rbenv-default/gems/gems/rubocop-1.42.0/exe/rubocop:19:in `<top (required)>'\r\n/Users/user/.cache/pre-commit/repojquw8lys/rbenv-default/gems/bin/rubocop:25:in `load'\r\n/Users/user/.cache/pre-commit/repojquw8lys/rbenv-default/gems/bin/rubocop:25:in `<main>'\r\n/Users/user/.cache/pre-commit/repojquw8lys/rbenv-default/gems/bin/ruby_executable_hooks:22:in `eval'\r\n/Users/user/.cache/pre-commit/repojquw8lys/rbenv-default/gems/bin/ruby_executable_hooks:22:in `<main>'\r\n```\r\n\r\nThis looks closely related to #2727.\r\n\r\nFor what it's worth, I did confirm that the user actually has a working `/dev/null` on their system.\n\n### pre-commit --version\n\npre-commit 3.0.2\n\n### .pre-commit-config.yaml\n\n```yaml\nrepos:\r\n- repo: https://github.com/rubocop/rubocop.git\r\n  rev: '0f7416a0b3ea4a3d4edb1f2091ce8706ea3e6640'\r\n  hooks:\r\n    - id: rubocop\r\n      additional_dependencies: [\"standard:1.22.1\"]\n```\n\n\n### ~/.cache/pre-commit/pre-commit.log (if present)\n\n_No response_\n", "before_files": [{"content": "from __future__ import annotations\n\nimport contextlib\nimport functools\nimport os.path\nimport shutil\nimport tarfile\nfrom typing import Generator\nfrom typing import Sequence\n\nimport pre_commit.constants as C\nfrom pre_commit.envcontext import envcontext\nfrom pre_commit.envcontext import PatchesT\nfrom pre_commit.envcontext import UNSET\nfrom pre_commit.envcontext import Var\nfrom pre_commit.languages import helpers\nfrom pre_commit.prefix import Prefix\nfrom pre_commit.util import CalledProcessError\nfrom pre_commit.util import resource_bytesio\n\nENVIRONMENT_DIR = 'rbenv'\nhealth_check = helpers.basic_health_check\nrun_hook = helpers.basic_run_hook\n\n\n@functools.lru_cache(maxsize=1)\ndef get_default_version() -> str:\n    if all(helpers.exe_exists(exe) for exe in ('ruby', 'gem')):\n        return 'system'\n    else:\n        return C.DEFAULT\n\n\ndef get_env_patch(\n        venv: str,\n        language_version: str,\n) -> PatchesT:\n    patches: PatchesT = (\n        ('GEM_HOME', os.path.join(venv, 'gems')),\n        ('GEM_PATH', UNSET),\n        ('BUNDLE_IGNORE_CONFIG', '1'),\n        ('BUNDLE_GEMFILE', os.devnull),\n    )\n    if language_version == 'system':\n        patches += (\n            (\n                'PATH', (\n                    os.path.join(venv, 'gems', 'bin'), os.pathsep,\n                    Var('PATH'),\n                ),\n            ),\n        )\n    else:  # pragma: win32 no cover\n        patches += (\n            ('RBENV_ROOT', venv),\n            (\n                'PATH', (\n                    os.path.join(venv, 'gems', 'bin'), os.pathsep,\n                    os.path.join(venv, 'shims'), os.pathsep,\n                    os.path.join(venv, 'bin'), os.pathsep, Var('PATH'),\n                ),\n            ),\n        )\n    if language_version not in {'system', 'default'}:  # pragma: win32 no cover\n        patches += (('RBENV_VERSION', language_version),)\n\n    return patches\n\n\n@contextlib.contextmanager\ndef in_env(prefix: Prefix, version: str) -> Generator[None, None, None]:\n    envdir = helpers.environment_dir(prefix, ENVIRONMENT_DIR, version)\n    with envcontext(get_env_patch(envdir, version)):\n        yield\n\n\ndef _extract_resource(filename: str, dest: str) -> None:\n    with resource_bytesio(filename) as bio:\n        with tarfile.open(fileobj=bio) as tf:\n            tf.extractall(dest)\n\n\ndef _install_rbenv(\n        prefix: Prefix,\n        version: str,\n) -> None:  # pragma: win32 no cover\n    envdir = helpers.environment_dir(prefix, ENVIRONMENT_DIR, version)\n\n    _extract_resource('rbenv.tar.gz', prefix.path('.'))\n    shutil.move(prefix.path('rbenv'), envdir)\n\n    # Only install ruby-build if the version is specified\n    if version != C.DEFAULT:\n        plugins_dir = os.path.join(envdir, 'plugins')\n        _extract_resource('ruby-download.tar.gz', plugins_dir)\n        _extract_resource('ruby-build.tar.gz', plugins_dir)\n\n\ndef _install_ruby(\n        prefix: Prefix,\n        version: str,\n) -> None:  # pragma: win32 no cover\n    try:\n        helpers.run_setup_cmd(prefix, ('rbenv', 'download', version))\n    except CalledProcessError:  # pragma: no cover (usually find with download)\n        # Failed to download from mirror for some reason, build it instead\n        helpers.run_setup_cmd(prefix, ('rbenv', 'install', version))\n\n\ndef install_environment(\n        prefix: Prefix, version: str, additional_dependencies: Sequence[str],\n) -> None:\n    if version != 'system':  # pragma: win32 no cover\n        _install_rbenv(prefix, version)\n        with in_env(prefix, version):\n            # Need to call this before installing so rbenv's directories\n            # are set up\n            helpers.run_setup_cmd(prefix, ('rbenv', 'init', '-'))\n            if version != C.DEFAULT:\n                _install_ruby(prefix, version)\n            # Need to call this after installing to set up the shims\n            helpers.run_setup_cmd(prefix, ('rbenv', 'rehash'))\n\n    with in_env(prefix, version):\n        helpers.run_setup_cmd(\n            prefix, ('gem', 'build', *prefix.star('.gemspec')),\n        )\n        helpers.run_setup_cmd(\n            prefix,\n            (\n                'gem', 'install',\n                '--no-document', '--no-format-executable',\n                '--no-user-install',\n                *prefix.star('.gem'), *additional_dependencies,\n            ),\n        )\n", "path": "pre_commit/languages/ruby.py"}], "after_files": [{"content": "from __future__ import annotations\n\nimport contextlib\nimport functools\nimport os.path\nimport shutil\nimport tarfile\nfrom typing import Generator\nfrom typing import Sequence\n\nimport pre_commit.constants as C\nfrom pre_commit.envcontext import envcontext\nfrom pre_commit.envcontext import PatchesT\nfrom pre_commit.envcontext import UNSET\nfrom pre_commit.envcontext import Var\nfrom pre_commit.languages import helpers\nfrom pre_commit.prefix import Prefix\nfrom pre_commit.util import CalledProcessError\nfrom pre_commit.util import resource_bytesio\n\nENVIRONMENT_DIR = 'rbenv'\nhealth_check = helpers.basic_health_check\nrun_hook = helpers.basic_run_hook\n\n\n@functools.lru_cache(maxsize=1)\ndef get_default_version() -> str:\n    if all(helpers.exe_exists(exe) for exe in ('ruby', 'gem')):\n        return 'system'\n    else:\n        return C.DEFAULT\n\n\ndef get_env_patch(\n        venv: str,\n        language_version: str,\n) -> PatchesT:\n    patches: PatchesT = (\n        ('GEM_HOME', os.path.join(venv, 'gems')),\n        ('GEM_PATH', UNSET),\n        ('BUNDLE_IGNORE_CONFIG', '1'),\n    )\n    if language_version == 'system':\n        patches += (\n            (\n                'PATH', (\n                    os.path.join(venv, 'gems', 'bin'), os.pathsep,\n                    Var('PATH'),\n                ),\n            ),\n        )\n    else:  # pragma: win32 no cover\n        patches += (\n            ('RBENV_ROOT', venv),\n            (\n                'PATH', (\n                    os.path.join(venv, 'gems', 'bin'), os.pathsep,\n                    os.path.join(venv, 'shims'), os.pathsep,\n                    os.path.join(venv, 'bin'), os.pathsep, Var('PATH'),\n                ),\n            ),\n        )\n    if language_version not in {'system', 'default'}:  # pragma: win32 no cover\n        patches += (('RBENV_VERSION', language_version),)\n\n    return patches\n\n\n@contextlib.contextmanager\ndef in_env(prefix: Prefix, version: str) -> Generator[None, None, None]:\n    envdir = helpers.environment_dir(prefix, ENVIRONMENT_DIR, version)\n    with envcontext(get_env_patch(envdir, version)):\n        yield\n\n\ndef _extract_resource(filename: str, dest: str) -> None:\n    with resource_bytesio(filename) as bio:\n        with tarfile.open(fileobj=bio) as tf:\n            tf.extractall(dest)\n\n\ndef _install_rbenv(\n        prefix: Prefix,\n        version: str,\n) -> None:  # pragma: win32 no cover\n    envdir = helpers.environment_dir(prefix, ENVIRONMENT_DIR, version)\n\n    _extract_resource('rbenv.tar.gz', prefix.path('.'))\n    shutil.move(prefix.path('rbenv'), envdir)\n\n    # Only install ruby-build if the version is specified\n    if version != C.DEFAULT:\n        plugins_dir = os.path.join(envdir, 'plugins')\n        _extract_resource('ruby-download.tar.gz', plugins_dir)\n        _extract_resource('ruby-build.tar.gz', plugins_dir)\n\n\ndef _install_ruby(\n        prefix: Prefix,\n        version: str,\n) -> None:  # pragma: win32 no cover\n    try:\n        helpers.run_setup_cmd(prefix, ('rbenv', 'download', version))\n    except CalledProcessError:  # pragma: no cover (usually find with download)\n        # Failed to download from mirror for some reason, build it instead\n        helpers.run_setup_cmd(prefix, ('rbenv', 'install', version))\n\n\ndef install_environment(\n        prefix: Prefix, version: str, additional_dependencies: Sequence[str],\n) -> None:\n    if version != 'system':  # pragma: win32 no cover\n        _install_rbenv(prefix, version)\n        with in_env(prefix, version):\n            # Need to call this before installing so rbenv's directories\n            # are set up\n            helpers.run_setup_cmd(prefix, ('rbenv', 'init', '-'))\n            if version != C.DEFAULT:\n                _install_ruby(prefix, version)\n            # Need to call this after installing to set up the shims\n            helpers.run_setup_cmd(prefix, ('rbenv', 'rehash'))\n\n    with in_env(prefix, version):\n        helpers.run_setup_cmd(\n            prefix, ('gem', 'build', *prefix.star('.gemspec')),\n        )\n        helpers.run_setup_cmd(\n            prefix,\n            (\n                'gem', 'install',\n                '--no-document', '--no-format-executable',\n                '--no-user-install',\n                *prefix.star('.gem'), *additional_dependencies,\n            ),\n        )\n", "path": "pre_commit/languages/ruby.py"}]}