Merge pull request #8177 from SeekingMeaning/bump-formula-pr/read-only-run
bump-formula-pr: restore formula unless read only run
This commit is contained in:
commit
865e3871b8
@ -246,7 +246,8 @@ module Homebrew
|
|||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
old_contents = File.read(formula.path) unless args.dry_run?
|
read_only_run = args.dry_run? && !args.write?
|
||||||
|
old_contents = File.read(formula.path) unless read_only_run
|
||||||
|
|
||||||
if new_mirrors
|
if new_mirrors
|
||||||
replacement_pairs << [
|
replacement_pairs << [
|
||||||
@ -310,13 +311,13 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
if new_formula_version < old_formula_version
|
if new_formula_version < old_formula_version
|
||||||
formula.path.atomic_write(old_contents) unless args.dry_run?
|
formula.path.atomic_write(old_contents) unless read_only_run
|
||||||
odie <<~EOS
|
odie <<~EOS
|
||||||
You need to bump this formula manually since changing the
|
You need to bump this formula manually since changing the
|
||||||
version from #{old_formula_version} to #{new_formula_version} would be a downgrade.
|
version from #{old_formula_version} to #{new_formula_version} would be a downgrade.
|
||||||
EOS
|
EOS
|
||||||
elsif new_formula_version == old_formula_version
|
elsif new_formula_version == old_formula_version
|
||||||
formula.path.atomic_write(old_contents) unless args.dry_run?
|
formula.path.atomic_write(old_contents) unless read_only_run
|
||||||
odie <<~EOS
|
odie <<~EOS
|
||||||
You need to bump this formula manually since the new version
|
You need to bump this formula manually since the new version
|
||||||
and old version are both #{new_formula_version}.
|
and old version are both #{new_formula_version}.
|
||||||
@ -330,7 +331,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
ohai "brew update-python-resources #{formula.name}"
|
ohai "brew update-python-resources #{formula.name}"
|
||||||
if !args.dry_run? || (args.dry_run? && args.write?)
|
unless read_only_run
|
||||||
PyPI.update_python_resources! formula, new_formula_version, silent: true, ignore_non_pypi_packages: true
|
PyPI.update_python_resources! formula, new_formula_version, silent: true, ignore_non_pypi_packages: true
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -450,7 +451,8 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
def inreplace_pairs(path, replacement_pairs, args:)
|
def inreplace_pairs(path, replacement_pairs, args:)
|
||||||
if args.dry_run?
|
read_only_run = args.dry_run? && !args.write?
|
||||||
|
if read_only_run
|
||||||
str = path.open("r") { |f| Formulary.ensure_utf8_encoding(f).read }
|
str = path.open("r") { |f| Formulary.ensure_utf8_encoding(f).read }
|
||||||
contents = StringInreplaceExtension.new(str)
|
contents = StringInreplaceExtension.new(str)
|
||||||
replacement_pairs.each do |old, new|
|
replacement_pairs.each do |old, new|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user