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
2cc6b903
Commit
2cc6b903
authored
9 years ago
by
Vlad Shablinsky
Committed by
Mike McQuaid
9 years ago
Browse files
Options
Downloads
Patches
Plain Diff
formulary: change logic for renamed formulae
parent
ab1164f4
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/formulary.rb
+30
-2
30 additions, 2 deletions
Library/Homebrew/formulary.rb
with
30 additions
and
2 deletions
Library/Homebrew/formulary.rb
+
30
−
2
View file @
2cc6b903
require
"digest/md5"
require
"formula_renames"
# The Formulary is responsible for creating instances of Formula.
# It is not meant to be used directy from formulae.
...
...
@@ -141,6 +142,7 @@ class Formulary
def
initialize
(
tapped_name
)
user
,
repo
,
name
=
tapped_name
.
split
(
"/"
,
3
).
map
(
&
:downcase
)
@tap
=
Tap
.
new
user
,
repo
.
sub
(
/^homebrew-/
,
""
)
name
=
@tap
.
formula_renames
.
fetch
(
name
,
name
)
path
=
@tap
.
formula_files
.
detect
{
|
file
|
file
.
basename
(
".rb"
).
to_s
==
name
}
path
||=
@tap
.
path
/
"
#{
name
}
.rb"
...
...
@@ -212,7 +214,13 @@ class Formulary
when
Pathname
::
BOTTLE_EXTNAME_RX
return
BottleLoader
.
new
(
ref
)
when
HOMEBREW_CORE_FORMULA_REGEX
return
FormulaLoader
.
new
(
$1
,
core_path
(
$1
))
name
=
$1
formula_with_that_name
=
core_path
(
name
)
if
(
newname
=
FORMULA_RENAMES
[
name
])
&&
!
formula_with_that_name
.
file?
return
FormulaLoader
.
new
(
newname
,
core_path
(
newname
))
else
return
FormulaLoader
.
new
(
name
,
formula_with_that_name
)
end
when
HOMEBREW_TAP_FORMULA_REGEX
return
TapLoader
.
new
(
ref
)
end
...
...
@@ -231,13 +239,33 @@ class Formulary
return
AliasLoader
.
new
(
possible_alias
)
end
possible_tap_formulae
=
tap_paths
(
ref
)
possible_tap_formulae
=
tap_paths
(
ref
)
if
possible_tap_formulae
.
size
>
1
raise
TapFormulaAmbiguityError
.
new
(
ref
,
possible_tap_formulae
)
elsif
possible_tap_formulae
.
size
==
1
return
FormulaLoader
.
new
(
ref
,
possible_tap_formulae
.
first
)
end
if
newref
=
FORMULA_RENAMES
[
ref
]
formula_with_that_oldname
=
core_path
(
newref
)
if
formula_with_that_oldname
.
file?
return
FormulaLoader
.
new
(
newref
,
formula_with_that_oldname
)
end
end
possible_tap_newname_formulae
=
[]
Tap
.
each
do
|
tap
|
if
newref
=
tap
.
formula_renames
[
ref
]
possible_tap_newname_formulae
<<
"
#{
tap
.
name
}
/
#{
newref
}
"
end
end
if
possible_tap_newname_formulae
.
size
>
1
raise
TapFormulaWithOldnameAmbiguityError
.
new
(
ref
,
possible_tap_newname_formulae
)
elsif
!
possible_tap_newname_formulae
.
empty?
return
TapLoader
.
new
(
possible_tap_newname_formulae
.
first
)
end
possible_cached_formula
=
Pathname
.
new
(
"
#{
HOMEBREW_CACHE_FORMULA
}
/
#{
ref
}
.rb"
)
if
possible_cached_formula
.
file?
return
FormulaLoader
.
new
(
ref
,
possible_cached_formula
)
...
...
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