create: Pass fetch value directly into constructor
This commit is contained in:
parent
251a098fbf
commit
c148396b98
@ -140,7 +140,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
def create_formula(args:)
|
def create_formula(args:)
|
||||||
fc = FormulaCreator.new(args)
|
fc = FormulaCreator.new(args, !args.no_fetch?)
|
||||||
fc.name = if args.set_name.blank?
|
fc.name = if args.set_name.blank?
|
||||||
stem = Pathname.new(args.named.first).stem.rpartition("=").last
|
stem = Pathname.new(args.named.first).stem.rpartition("=").last
|
||||||
print "Formula name [#{stem}]: "
|
print "Formula name [#{stem}]: "
|
||||||
|
|||||||
@ -12,8 +12,9 @@ module Homebrew
|
|||||||
attr_reader :args, :url, :sha256, :desc, :homepage
|
attr_reader :args, :url, :sha256, :desc, :homepage
|
||||||
attr_accessor :name, :version, :tap, :mode, :license
|
attr_accessor :name, :version, :tap, :mode, :license
|
||||||
|
|
||||||
def initialize(args)
|
def initialize(args, fetch=true)
|
||||||
@args = args
|
@args = args
|
||||||
|
@fetch = fetch
|
||||||
end
|
end
|
||||||
|
|
||||||
def url=(url)
|
def url=(url)
|
||||||
@ -41,10 +42,6 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def fetch?
|
|
||||||
!args.no_fetch?
|
|
||||||
end
|
|
||||||
|
|
||||||
def head?
|
def head?
|
||||||
@head || args.HEAD?
|
@head || args.HEAD?
|
||||||
end
|
end
|
||||||
@ -58,7 +55,7 @@ module Homebrew
|
|||||||
|
|
||||||
if version.nil? || version.null?
|
if version.nil? || version.null?
|
||||||
odie "Version cannot be determined from URL. Explicitly set the version with `--set-version` instead."
|
odie "Version cannot be determined from URL. Explicitly set the version with `--set-version` instead."
|
||||||
elsif fetch?
|
elsif @fetch
|
||||||
unless head?
|
unless head?
|
||||||
r = Resource.new
|
r = Resource.new
|
||||||
r.url(url)
|
r.url(url)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user