mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-07-08 11:39:02 +00:00
[PR #12024/00060263 backport][stable-12] bundler: replace deprecated CLI flags with BUNDLE_* env vars (#12037)
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
* fix(bundler): add changelog fragment for PR #12024
---------
(cherry picked from commit 00060263a5)
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
46f6a7a69a
commit
dad425d3c6
2 changed files with 13 additions and 6 deletions
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue