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
efd63447
Commit
efd63447
authored
10 years ago
by
Jack Nagel
Browse files
Options
Downloads
Patches
Plain Diff
Move management of options collection to the spec object
parent
8039107a
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Library/Homebrew/build_options.rb
+0
-11
0 additions, 11 deletions
Library/Homebrew/build_options.rb
Library/Homebrew/formula.rb
+6
-9
6 additions, 9 deletions
Library/Homebrew/formula.rb
Library/Homebrew/software_spec.rb
+13
-1
13 additions, 1 deletion
Library/Homebrew/software_spec.rb
with
19 additions
and
21 deletions
Library/Homebrew/build_options.rb
+
0
−
11
View file @
efd63447
...
...
@@ -20,17 +20,6 @@ class BuildOptions
@args
=
other
.
args
.
dup
end
def
add
(
name
,
description
)
description
||=
case
name
when
"universal"
then
"Build a universal binary"
when
"32-bit"
then
"Build 32-bit only"
when
"c++11"
then
"Build using C++11 mode"
else
""
end
@options
<<
Option
.
new
(
name
,
description
)
end
def
empty?
@options
.
empty?
end
...
...
This diff is collapsed.
Click to expand it.
Library/Homebrew/formula.rb
+
6
−
9
View file @
efd63447
...
...
@@ -16,7 +16,7 @@ class Formula
include
Utils
::
Inreplace
extend
Enumerable
attr_reader
:name
,
:path
,
:homepage
,
:build
attr_reader
:name
,
:path
,
:homepage
attr_reader
:stable
,
:devel
,
:head
,
:active_spec
attr_reader
:pkg_version
,
:revision
...
...
@@ -38,9 +38,8 @@ class Formula
@active_spec
=
determine_active_spec
(
spec
)
validate_attributes
:url
,
:name
,
:version
@build
=
determine_build_
options
active_spec
.
add_legacy_options
(
options
)
@pkg_version
=
PkgVersion
.
new
(
version
,
revision
)
@pin
=
FormulaPin
.
new
(
self
)
end
...
...
@@ -65,12 +64,6 @@ class Formula
end
end
def
determine_build_options
build
=
active_spec
.
build
options
.
each
{
|
opt
,
desc
|
build
.
add
(
opt
,
desc
)
}
build
end
def
bottle
Bottle
.
new
(
self
,
active_spec
.
bottle_specification
)
if
active_spec
.
bottled?
end
...
...
@@ -110,6 +103,10 @@ class Formula
active_spec
.
option_defined?
(
name
)
end
def
build
active_spec
.
build
end
# if the dir is there, but it's empty we consider it not installed
def
installed?
(
dir
=
installed_prefix
).
directory?
&&
dir
.
children
.
length
>
0
...
...
This diff is collapsed.
Click to expand it.
Library/Homebrew/software_spec.rb
+
13
−
1
View file @
efd63447
...
...
@@ -80,7 +80,15 @@ class SoftwareSpec
name
=
name
.
to_s
if
Symbol
===
name
raise
ArgumentError
,
"option name is required"
if
name
.
empty?
raise
ArgumentError
,
"options should not start with dashes"
if
name
.
start_with?
(
"-"
)
build
.
add
(
name
,
description
)
description
||=
case
name
when
"universal"
then
"Build a universal binary"
when
"32-bit"
then
"Build 32-bit only"
when
"c++11"
then
"Build using C++11 mode"
else
""
end
options
<<
Option
.
new
(
name
,
description
)
end
def
depends_on
spec
...
...
@@ -115,6 +123,10 @@ class SoftwareSpec
options
<<
Option
.
new
(
"without-
#{
name
}
"
,
"Build without
#{
name
}
support"
)
end
end
def
add_legacy_options
(
list
)
list
.
each
{
|
opt
,
desc
|
options
<<
Option
.
new
(
opt
[
/^--(.+)$/
,
1
],
desc
)
}
end
end
class
HeadSoftwareSpec
<
SoftwareSpec
...
...
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