1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-06-30 07:50:43 +00:00

bundler: replace deprecated CLI flags with BUNDLE_* env vars (#12024)

* fix(bundler): replace deprecated CLI flags with BUNDLE_* env vars

Bundler 2.1 deprecated --deployment, --without, --path, --clean, and
--binstubs; Bundler 4 has removed --clean entirely. Pass these options
as BUNDLE_* environment variables instead, which have been supported
since Bundler 1.0.0 and are scoped to the process (no persistent
.bundle/config written).

Fixes #4583, fixes #11380

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(bundler): add changelog fragment for PR #12024

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Alexei Znamensky 2026-05-12 21:00:45 +12:00 committed by GitHub
parent 171feb5a2c
commit 00060263a5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 13 additions and 6 deletions

View file

@ -0,0 +1,6 @@
bugfixes:
- "bundler - replace deprecated ``--deployment``, ``--without``, ``--path``,
``--clean``, and ``--binstubs`` flags with ``BUNDLE_*`` environment variables,
fixing compatibility with Bundler 4 (https://github.com/ansible-collections/community.general/issues/4583,
https://github.com/ansible-collections/community.general/issues/11380,
https://github.com/ansible-collections/community.general/pull/12024)."

View file

@ -165,24 +165,25 @@ def main():
module.exit_json(changed=rc != 0, state=state, stdout=out, stderr=err)
bundle_env = {}
if state == "present":
cmd.append("install")
if exclude_groups:
cmd.extend(["--without", ":".join(exclude_groups)])
bundle_env["BUNDLE_WITHOUT"] = ":".join(exclude_groups)
if clean:
cmd.append("--clean")
bundle_env["BUNDLE_CLEAN"] = "true"
if gemfile:
cmd.extend(["--gemfile", gemfile])
if local:
cmd.append("--local")
if deployment_mode:
cmd.append("--deployment")
bundle_env["BUNDLE_DEPLOYMENT"] = "true"
if not user_install:
cmd.append("--system")
if gem_path:
cmd.extend(["--path", gem_path])
bundle_env["BUNDLE_PATH"] = gem_path
if binstub_directory:
cmd.extend(["--binstubs", binstub_directory])
bundle_env["BUNDLE_BIN"] = binstub_directory
else:
cmd.append("update")
if local:
@ -191,7 +192,7 @@ def main():
if extra_args:
cmd.extend(extra_args.split(" "))
rc, out, err = module.run_command(cmd, cwd=chdir, check_rc=True)
rc, out, err = module.run_command(cmd, cwd=chdir, check_rc=True, environ_update=bundle_env)
module.exit_json(changed="Installing" in out, state=state, stdout=out, stderr=err)