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
b0cd6b03
Commit
b0cd6b03
authored
11 years ago
by
Jack Nagel
Browse files
Options
Downloads
Patches
Plain Diff
Extract some boilerplate into an each_tap method
parent
99c275d0
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/cmd/tap.rb
+19
-14
19 additions, 14 deletions
Library/Homebrew/cmd/tap.rb
Library/Homebrew/cmd/update.rb
+9
-12
9 additions, 12 deletions
Library/Homebrew/cmd/update.rb
with
28 additions
and
26 deletions
Library/Homebrew/cmd/tap.rb
+
19
−
14
View file @
b0cd6b03
...
...
@@ -2,13 +2,9 @@ module Homebrew extend self
def
tap
if
ARGV
.
empty?
tapd
=
HOMEBREW_LIBRARY
/
"Taps"
tapd
.
children
.
each
do
|
user
|
next
unless
user
.
directory?
user
.
children
.
each
do
|
repo
|
puts
"
#{
user
.
basename
}
/
#{
repo
.
basename
.
sub
(
"homebrew-"
,
""
)
}
"
if
(
repo
/
".git"
).
directory?
end
end
if
tapd
.
directory?
each_tap
do
|
user
,
repo
|
puts
"
#{
user
.
basename
}
/
#{
repo
.
basename
.
sub
(
"homebrew-"
,
""
)
}
"
if
(
repo
/
".git"
).
directory?
end
elsif
ARGV
.
first
==
"--repair"
repair_taps
else
...
...
@@ -88,13 +84,10 @@ module Homebrew extend self
count
=
0
# check symlinks are all set in each tap
HOMEBREW_REPOSITORY
.
join
(
"Library/Taps"
).
children
.
each
do
|
user
|
next
unless
user
.
directory?
user
.
children
.
each
do
|
repo
|
files
=
[]
repo
.
find_formula
{
|
file
|
files
<<
user
.
basename
.
join
(
repo
.
basename
,
file
)
}
if
repo
.
directory?
count
+=
link_tap_formula
(
files
)
end
each_tap
do
|
user
,
repo
|
files
=
[]
repo
.
find_formula
{
|
file
|
files
<<
user
.
basename
.
join
(
repo
.
basename
,
file
)
}
count
+=
link_tap_formula
(
files
)
end
puts
"Tapped
#{
count
}
formula"
...
...
@@ -102,6 +95,18 @@ module Homebrew extend self
private
def
each_tap
taps
=
HOMEBREW_LIBRARY
.
join
(
"Taps"
)
if
taps
.
directory?
taps
.
subdirs
.
each
do
|
user
|
user
.
subdirs
.
each
do
|
repo
|
yield
user
,
repo
end
end
end
end
def
tap_args
ARGV
.
first
=~
%r{^([
\w
_-]+)/(homebrew-)?([
\w
_-]+)$}
raise
"Invalid tap name"
unless
$1
&&
$3
...
...
This diff is collapsed.
Click to expand it.
Library/Homebrew/cmd/update.rb
+
9
−
12
View file @
b0cd6b03
...
...
@@ -38,19 +38,16 @@ module Homebrew extend self
# this procedure will be removed in the future if it seems unnecessasry
rename_taps_dir_if_necessary
Dir
[
"Library/Taps/*/"
].
each
do
|
user
|
Dir
[
"
#{
user
}
*/"
].
each
do
|
repo
|
cd
repo
do
begin
updater
=
Updater
.
new
updater
.
pull!
report
.
merge!
(
updater
.
report
)
do
|
key
,
oldval
,
newval
|
oldval
.
concat
(
newval
)
end
rescue
repo
=~
%r{^Library/Taps/([
\w
_-]+)/(homebrew-)?([
\w
_-]+)}
onoe
"Failed to update tap: #$1/#$3"
each_tap
do
|
user
,
repo
|
repo
.
cd
do
begin
updater
=
Updater
.
new
updater
.
pull!
report
.
merge!
(
updater
.
report
)
do
|
key
,
oldval
,
newval
|
oldval
.
concat
(
newval
)
end
rescue
onoe
"Failed to update tap:
#{
user
.
basename
}
/
#{
repo
.
basename
.
sub
(
"homebrew-"
,
""
)
}
"
end
end
end
...
...
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