mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Add helper functions for --cache
and fetch
explicitly.
This commit is contained in:
parent
a895f398ed
commit
a6bc9e155a
@ -6,6 +6,8 @@ require "cask/cmd"
|
||||
require "cask/cask_loader"
|
||||
|
||||
module Homebrew
|
||||
extend Fetch
|
||||
|
||||
module_function
|
||||
|
||||
def __cache_args
|
||||
@ -58,7 +60,7 @@ module Homebrew
|
||||
|
||||
def print_formula_cache(name)
|
||||
formula = Formulary.factory name
|
||||
if Fetch.fetch_bottle?(formula)
|
||||
if fetch_bottle?(formula)
|
||||
puts formula.bottle.cached_download
|
||||
else
|
||||
puts formula.cached_download
|
||||
|
@ -5,6 +5,8 @@ require "fetch"
|
||||
require "cli/parser"
|
||||
|
||||
module Homebrew
|
||||
extend Fetch
|
||||
|
||||
module_function
|
||||
|
||||
def fetch_args
|
||||
@ -62,7 +64,7 @@ module Homebrew
|
||||
f.print_tap_action verb: "Fetching"
|
||||
|
||||
fetched_bottle = false
|
||||
if Fetch.fetch_bottle?(f)
|
||||
if fetch_bottle?(f)
|
||||
begin
|
||||
fetch_formula(f.bottle)
|
||||
rescue Interrupt
|
||||
|
@ -2,12 +2,10 @@
|
||||
|
||||
module Homebrew
|
||||
module Fetch
|
||||
module_function
|
||||
|
||||
def fetch_bottle?(f)
|
||||
return true if Homebrew.args.force_bottle? && f.bottle
|
||||
return true if args.force_bottle? && f.bottle
|
||||
return false unless f.bottle && f.pour_bottle?
|
||||
return false if Homebrew.args.build_formula_from_source?(f)
|
||||
return false if args.build_formula_from_source?(f)
|
||||
return false unless f.bottle.compatible_cellar?
|
||||
|
||||
true
|
||||
|
Loading…
x
Reference in New Issue
Block a user