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
37cd547d
Commit
37cd547d
authored
9 years ago
by
Xu Cheng
Browse files
Options
Downloads
Patches
Plain Diff
Formula: cache methods' output to reduce io
Closes Homebrew/homebrew#40855. Signed-off-by:
Xu Cheng
<
xucheng@me.com
>
parent
adafb6c9
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Library/Homebrew/formula.rb
+14
-12
14 additions, 12 deletions
Library/Homebrew/formula.rb
with
14 additions
and
12 deletions
Library/Homebrew/formula.rb
+
14
−
12
View file @
37cd547d
...
...
@@ -624,22 +624,22 @@ class Formula
# an array of all core {Formula} names
def
self
.
core_names
Dir
[
"
#{
HOMEBREW_LIBRARY
}
/Formula/*.rb"
].
map
{
|
f
|
File
.
basename
f
,
".rb"
}.
sort
@core_names
||=
Dir
[
"
#{
HOMEBREW_LIBRARY
}
/Formula/*.rb"
].
map
{
|
f
|
File
.
basename
f
,
".rb"
}.
sort
end
# an array of all tap {Formula} names
def
self
.
tap_names
Tap
.
map
(
&
:formula_names
).
flatten
.
sort
@tap_names
||=
Tap
.
map
(
&
:formula_names
).
flatten
.
sort
end
# an array of all {Formula} names
def
self
.
names
(
core_names
+
tap_names
.
map
{
|
name
|
name
.
split
(
"/"
)[
-
1
]
}).
sort
.
uniq
@names
||=
(
core_names
+
tap_names
.
map
{
|
name
|
name
.
split
(
"/"
)[
-
1
]
}).
sort
.
uniq
end
# an array of all {Formula} names, which the tap formulae have the fully-qualified name
def
self
.
full_names
core_names
+
tap_names
@full_names
||=
core_names
+
tap_names
end
def
self
.
each
...
...
@@ -657,14 +657,16 @@ class Formula
# An array of all installed {Formula}
def
self
.
installed
return
[]
unless
HOMEBREW_CELLAR
.
directory?
HOMEBREW_CELLAR
.
subdirs
.
map
do
|
rack
|
begin
Formulary
.
from_rack
(
rack
)
rescue
FormulaUnavailableError
,
TapFormulaAmbiguityError
end
end
.
compact
@installed
||=
if
HOMEBREW_CELLAR
.
directory?
HOMEBREW_CELLAR
.
subdirs
.
map
do
|
rack
|
begin
Formulary
.
from_rack
(
rack
)
rescue
FormulaUnavailableError
,
TapFormulaAmbiguityError
end
end
.
compact
else
[]
end
end
def
self
.
aliases
...
...
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