Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
brew
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to JiHu GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
KMSCAKKSCFKA AKFACAMADCAS
brew
Commits
f5a462bc
Commit
f5a462bc
authored
8 years ago
by
ilovezfs
Browse files
Options
Downloads
Patches
Plain Diff
bump-formula-pr: audit formula before opening PR
parent
327f5ca1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Library/Homebrew/dev-cmd/bump-formula-pr.rb
+31
-2
31 additions, 2 deletions
Library/Homebrew/dev-cmd/bump-formula-pr.rb
with
31 additions
and
2 deletions
Library/Homebrew/dev-cmd/bump-formula-pr.rb
+
31
−
2
View file @
f5a462bc
#: * `bump-formula-pr` [`--devel`] [`--dry-run`] `--url=`<url> `--sha256=`<sha-256> <formula>:
#: * `bump-formula-pr` [`--devel`] [`--dry-run`] `--tag=`<tag> `--revision=`<revision> <formula>:
#: * `bump-formula-pr` [`--devel`] [`--dry-run`]
[`--audit`|`--strict`]
`--url=`<url> `--sha256=`<sha-256> <formula>:
#: * `bump-formula-pr` [`--devel`] [`--dry-run`]
[`--audit`|`--strict`]
`--tag=`<tag> `--revision=`<revision> <formula>:
#: Creates a pull request to update the formula with a new url or a new tag.
#:
#: If a <url> is specified, the <sha-256> checksum of the new download must
...
...
@@ -13,6 +13,10 @@
#:
#: If `--dry-run` is passed, print what would be done rather than doing it.
#:
#: If `--audit` is passed, run `brew audit` before opening the PR.
#:
#: If `--strict` is passed, run `brew audit --strict` before opening the PR.
#:
#: Note that this command cannot be used to transition a formula from a
#: url-and-sha256 style specification into a tag-and-revision style
#: specification, nor vice versa. It must use whichever style specification
...
...
@@ -113,22 +117,47 @@ module Homebrew
]
end
backup_file
=
File
.
read
(
formula
.
path
)
unless
ARGV
.
dry_run?
new_contents
=
inreplace_pairs
(
formula
.
path
,
replacement_pairs
)
new_formula_version
=
formula_version
(
formula
,
requested_spec
,
new_contents
)
if
new_formula_version
<
old_formula_version
formula
.
path
.
atomic_write
(
backup_file
)
unless
ARGV
.
dry_run?
odie
<<-
EOS
.
undent
You probably need to bump this formula manually since changing the
version from
#{
old_formula_version
}
to
#{
new_formula_version
}
would be a downgrade.
EOS
elsif
new_formula_version
==
old_formula_version
formula
.
path
.
atomic_write
(
backup_file
)
unless
ARGV
.
dry_run?
odie
<<-
EOS
.
undent
You probably need to bump this formula manually since the new version
and old version are both
#{
new_formula_version
}
.
EOS
end
if
ARGV
.
dry_run?
if
ARGV
.
include?
"--strict"
ohai
"brew audit --strict
#{
formula
.
path
.
basename
}
"
elsif
ARGV
.
include?
"--audit"
ohai
"brew audit
#{
formula
.
path
.
basename
}
"
end
else
failed_audit
=
false
if
ARGV
.
include?
"--strict"
system
HOMEBREW_BREW_FILE
,
"audit"
,
"--strict"
,
formula
.
path
failed_audit
=
!
$?
.
success?
elsif
ARGV
.
include?
"--audit"
system
HOMEBREW_BREW_FILE
,
"audit"
,
formula
.
path
failed_audit
=
!
$?
.
success?
end
if
failed_audit
formula
.
path
.
atomic_write
(
backup_file
)
odie
"brew audit failed!"
end
end
unless
Formula
[
"hub"
].
any_version_installed?
if
ARGV
.
dry_run?
ohai
"brew install hub"
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment