mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Allow partial installation of resources
This commit is contained in:
parent
28cb9978ee
commit
50d2f632d9
@ -1,5 +1,6 @@
|
||||
require 'pathname'
|
||||
require 'mach'
|
||||
require 'resource'
|
||||
|
||||
# we enhance pathname to make our code more readable
|
||||
class Pathname
|
||||
@ -12,6 +13,8 @@ class Pathname
|
||||
case src
|
||||
when Resource
|
||||
src.stage(self)
|
||||
when Resource::Partial
|
||||
src.resource.stage { install(*src.files) }
|
||||
when Array
|
||||
if src.empty?
|
||||
opoo "tried to install empty array to #{self}"
|
||||
|
@ -62,6 +62,12 @@ class Resource
|
||||
end
|
||||
end
|
||||
|
||||
Partial = Struct.new(:resource, :files)
|
||||
|
||||
def files(*files)
|
||||
Partial.new(self, files)
|
||||
end
|
||||
|
||||
# For brew-fetch and others.
|
||||
def fetch
|
||||
# Ensure the cache exists
|
||||
|
Loading…
x
Reference in New Issue
Block a user