Pass args to create instead of using global args.

This commit is contained in:
Markus Reiter 2020-07-23 03:08:19 +02:00
parent 6b0b25cd00
commit e669949659
2 changed files with 9 additions and 5 deletions

View File

@ -63,7 +63,7 @@ module Homebrew
# Create a formula from a tarball URL # Create a formula from a tarball URL
def create def create
create_args.parse args = create_args.parse
# Ensure that the cache exists so we can fetch the tarball # Ensure that the cache exists so we can fetch the tarball
HOMEBREW_CACHE.mkpath HOMEBREW_CACHE.mkpath
@ -75,7 +75,7 @@ module Homebrew
license = args.set_license license = args.set_license
tap = args.tap tap = args.tap
fc = FormulaCreator.new fc = FormulaCreator.new(args)
fc.name = name fc.name = name
fc.version = version fc.version = version
fc.license = license fc.license = license

View File

@ -5,9 +5,13 @@ require "erb"
module Homebrew module Homebrew
class FormulaCreator class FormulaCreator
attr_reader :url, :sha256, :desc, :homepage attr_reader :args, :url, :sha256, :desc, :homepage
attr_accessor :name, :version, :tap, :path, :mode, :license attr_accessor :name, :version, :tap, :path, :mode, :license
def initialize(args)
@args = args
end
def url=(url) def url=(url)
@url = url @url = url
path = Pathname.new(url) path = Pathname.new(url)
@ -41,11 +45,11 @@ module Homebrew
end end
def fetch? def fetch?
!Homebrew.args.no_fetch? !args.no_fetch?
end end
def head? def head?
@head || Homebrew.args.HEAD? @head || args.HEAD?
end end
def generate! def generate!