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
75dd75bd
Commit
75dd75bd
authored
11 years ago
by
Jack Nagel
Browse files
Options
Downloads
Patches
Plain Diff
Replace subformula example with a resource example
parent
4bacc8bb
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Library/Contributions/example-formula.rb
+14
-13
14 additions, 13 deletions
Library/Contributions/example-formula.rb
with
14 additions
and
13 deletions
Library/Contributions/example-formula.rb
+
14
−
13
View file @
75dd75bd
...
...
@@ -202,6 +202,16 @@ class ExampleFormula < Formula
cause
'multiple configure and compile errors'
end
## Resources
# Additional downloads can be defined as resources and accessed in the
# install method. Resources can also be defined inside a stable, devel, or
# head block. This mechanism replaces ad-hoc "subformula" classes.
resource
"additional_files"
do
url
'https://example.com/additional-stuff.tar.gz'
sha1
'deadbeef7890123456789012345678901234567890'
end
## Patches
...
...
@@ -348,12 +358,10 @@ class ExampleFormula < Formula
# Copy `./example_code/simple/ones` to share/demos/examples
(
share
/
'demos'
).
install
"example_code/simple/ones"
=>
'examples'
# Additional stuff can be defined in a sub-formula (see below) and
# with a block like this, it will be extracted into its own temporary
# dir. We can install into the Cellar of the main formula easily,
# because `prefix`, `bin` and all the other pre-defined variables are
# from the main formula.
AdditionalStuff
.
new
.
brew
{
bin
.
install
'my/extra/tool'
}
# Additional downloads can be defined as resources (see above).
# The stage method will create a temporary directory and yield
# to a block.
resource
(
"additional_files"
).
stage
{
bin
.
install
'my/extra/tool'
}
# `name` and `version` are accessible too, if you need them.
end
...
...
@@ -412,13 +420,6 @@ class ExampleFormula < Formula
def
plist
;
nil
;
end
end
class
AdditionalStuff
<
Formula
# Often, a second formula is used to download some resource
# NOTE: This is going to change when https://github.com/Homebrew/homebrew/pull/21714 happens.
url
'https://example.com/additional-stuff.tar.gz'
sha1
'deadbeef7890123456789012345678901234567890'
end
__END__
# Room for a patch after the `__END__`
# Read in the wiki about how to get a patch in here:
...
...
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