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 'pathname'
|
||||||
require 'mach'
|
require 'mach'
|
||||||
|
require 'resource'
|
||||||
|
|
||||||
# we enhance pathname to make our code more readable
|
# we enhance pathname to make our code more readable
|
||||||
class Pathname
|
class Pathname
|
||||||
@ -12,6 +13,8 @@ class Pathname
|
|||||||
case src
|
case src
|
||||||
when Resource
|
when Resource
|
||||||
src.stage(self)
|
src.stage(self)
|
||||||
|
when Resource::Partial
|
||||||
|
src.resource.stage { install(*src.files) }
|
||||||
when Array
|
when Array
|
||||||
if src.empty?
|
if src.empty?
|
||||||
opoo "tried to install empty array to #{self}"
|
opoo "tried to install empty array to #{self}"
|
||||||
|
@ -62,6 +62,12 @@ class Resource
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Partial = Struct.new(:resource, :files)
|
||||||
|
|
||||||
|
def files(*files)
|
||||||
|
Partial.new(self, files)
|
||||||
|
end
|
||||||
|
|
||||||
# For brew-fetch and others.
|
# For brew-fetch and others.
|
||||||
def fetch
|
def fetch
|
||||||
# Ensure the cache exists
|
# Ensure the cache exists
|
||||||
|
Loading…
x
Reference in New Issue
Block a user