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
98633e03
Commit
98633e03
authored
9 years ago
by
Xu Cheng
Browse files
Options
Downloads
Patches
Plain Diff
add alias_table and alias_reverse_table for core and tap
parent
65488903
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Library/Homebrew/formula.rb
+23
-0
23 additions, 0 deletions
Library/Homebrew/formula.rb
Library/Homebrew/tap.rb
+23
-0
23 additions, 0 deletions
Library/Homebrew/tap.rb
with
46 additions
and
0 deletions
Library/Homebrew/formula.rb
+
23
−
0
View file @
98633e03
...
...
@@ -1052,6 +1052,29 @@ class Formula
@alias_full_names
||=
core_aliases
+
tap_aliases
end
# a table mapping core alias to formula name
# @private
def
self
.
core_alias_table
return
@core_alias_table
if
@core_alias_table
@core_alias_table
=
Hash
.
new
core_alias_files
.
each
do
|
alias_file
|
@core_alias_table
[
alias_file
.
basename
.
to_s
]
=
alias_file
.
resolved_path
.
basename
(
".rb"
).
to_s
end
@core_alias_table
end
# a table mapping core formula name to aliases
# @private
def
self
.
core_alias_reverse_table
return
@core_alias_reverse_table
if
@core_alias_reverse_table
@core_alias_reverse_table
=
Hash
.
new
core_alias_table
.
each
do
|
alias_name
,
formula_name
|
@core_alias_reverse_table
[
formula_name
]
||=
[]
@core_alias_reverse_table
[
formula_name
]
<<
alias_name
end
@core_alias_reverse_table
end
def
self
.
[]
(
name
)
Formulary
.
factory
(
name
)
end
...
...
This diff is collapsed.
Click to expand it.
Library/Homebrew/tap.rb
+
23
−
0
View file @
98633e03
...
...
@@ -121,6 +121,29 @@ class Tap
@aliases
||=
alias_files
.
map
{
|
f
|
"
#{
name
}
/
#{
f
.
basename
}
"
}
end
# a table mapping alias to formula name
# @private
def
alias_table
return
@alias_table
if
@alias_table
@alias_table
=
Hash
.
new
alias_files
.
each
do
|
alias_file
|
@alias_table
[
"
#{
name
}
/
#{
alias_file
.
basename
}
"
]
=
"
#{
name
}
/
#{
alias_file
.
resolved_path
.
basename
(
".rb"
)
}
"
end
@alias_table
end
# a table mapping formula name to aliases
# @private
def
alias_reverse_table
return
@alias_reverse_table
if
@alias_reverse_table
@alias_reverse_table
=
Hash
.
new
alias_table
.
each
do
|
alias_name
,
formula_name
|
@alias_reverse_table
[
formula_name
]
||=
[]
@alias_reverse_table
[
formula_name
]
<<
alias_name
end
@alias_reverse_table
end
# an array of all commands files of this {Tap}.
def
command_files
@command_files
||=
Pathname
.
glob
(
"
#{
path
}
/cmd/brew-*"
).
select
(
&
:executable?
)
...
...
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