mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
formula_creator: Set initial values for name and version in constructor
This commit is contained in:
parent
e2d2ea1d04
commit
259823cf4d
@ -140,15 +140,12 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
def create_formula(args:)
|
def create_formula(args:)
|
||||||
fc = FormulaCreator.new(!args.no_fetch?, args.HEAD?)
|
fc = FormulaCreator.new(args.set_name, args.set_version, !args.no_fetch?, args.HEAD?)
|
||||||
fc.name = if args.set_name.blank?
|
if fc.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}]: "
|
||||||
__gets || stem
|
fc.name = __gets || stem
|
||||||
else
|
|
||||||
args.set_name
|
|
||||||
end
|
end
|
||||||
fc.version = args.set_version
|
|
||||||
fc.license = args.set_license
|
fc.license = args.set_license
|
||||||
fc.tap = Tap.fetch(args.tap || "homebrew/core")
|
fc.tap = Tap.fetch(args.tap || "homebrew/core")
|
||||||
raise TapUnavailableError, fc.tap.name unless fc.tap.installed?
|
raise TapUnavailableError, fc.tap.name unless fc.tap.installed?
|
||||||
|
@ -12,7 +12,9 @@ module Homebrew
|
|||||||
attr_reader :url, :sha256, :desc, :homepage
|
attr_reader :url, :sha256, :desc, :homepage
|
||||||
attr_accessor :name, :version, :tap, :mode, :license
|
attr_accessor :name, :version, :tap, :mode, :license
|
||||||
|
|
||||||
def initialize(fetch=true, head=false)
|
def initialize(name, version, fetch=true, head=false)
|
||||||
|
@name = name
|
||||||
|
@version = version
|
||||||
@fetch = fetch
|
@fetch = fetch
|
||||||
@head = head
|
@head = head
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user