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
20f4b317
Commit
20f4b317
authored
10 years ago
by
Jack Nagel
Browse files
Options
Downloads
Patches
Plain Diff
Implement canonical_name in Formulary
parent
e891bb42
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
+1
-37
1 addition, 37 deletions
Library/Homebrew/formula.rb
Library/Homebrew/formulary.rb
+4
-0
4 additions, 0 deletions
Library/Homebrew/formulary.rb
with
5 additions
and
37 deletions
Library/Homebrew/formula.rb
+
1
−
37
View file @
20f4b317
...
...
@@ -390,44 +390,8 @@ class Formula
Dir
[
"
#{
HOMEBREW_LIBRARY
}
/Aliases/*"
].
map
{
|
f
|
File
.
basename
f
}.
sort
end
# TODO - document what this returns and why
def
self
.
canonical_name
name
# if name includes a '/', it may be a tap reference, path, or URL
if
name
.
include?
"/"
if
name
=~
%r{(.+)/(.+)/(.+)}
tap_name
=
"#$1-#$2"
.
downcase
tapd
=
Pathname
.
new
(
"
#{
HOMEBREW_LIBRARY
}
/Taps/
#{
tap_name
}
"
)
if
tapd
.
directory?
tapd
.
find_formula
do
|
relative_pathname
|
return
"
#{
tapd
}
/
#{
relative_pathname
}
"
if
relative_pathname
.
stem
.
to_s
==
$3
end
end
end
# Otherwise don't resolve paths or URLs
return
name
end
# test if the name is a core formula
formula_with_that_name
=
Formula
.
path
(
name
)
if
formula_with_that_name
.
file?
and
formula_with_that_name
.
readable?
return
name
end
# test if the name is a formula alias
possible_alias
=
Pathname
.
new
(
"
#{
HOMEBREW_LIBRARY
}
/Aliases/
#{
name
}
"
)
if
possible_alias
.
file?
return
possible_alias
.
resolved_path
.
basename
(
".rb"
).
to_s
end
# test if the name is a cached downloaded formula
possible_cached_formula
=
Pathname
.
new
(
"
#{
HOMEBREW_CACHE_FORMULA
}
/
#{
name
}
.rb"
)
if
possible_cached_formula
.
file?
return
possible_cached_formula
.
to_s
end
# dunno, pass through the name
return
name
Formulary
.
canonical_name
(
name
)
end
def
self
.
[]
(
name
)
...
...
This diff is collapsed.
Click to expand it.
Library/Homebrew/formulary.rb
+
4
−
0
View file @
20f4b317
...
...
@@ -178,6 +178,10 @@ class Formulary
loader_for
(
ref
).
get_formula
end
def
self
.
canonical_name
(
ref
)
loader_for
(
ref
).
name
end
def
self
.
loader_for
(
ref
)
case
ref
when
%r[(https?|ftp)://]
...
...
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