Library/Homebrew/dev-cmd/create.rb
def create
    create_args.parse

    raise UsageError if ARGV.named.empty?

    # Ensure that the cache exists so we can fetch the tarball
    HOMEBREW_CACHE.mkpath

    url = ARGV.named.first # Pull the first (and only) url from ARGV

    version = args.set_version
    name = args.set_name
    tap = args.tap

    fc = FormulaCreator.new
    fc.name = name
    fc.version = version
    fc.tap = Tap.fetch(tap || "homebrew/core")
    raise TapUnavailableError, tap unless fc.tap.installed?

    fc.url = url

    fc.mode = if args.cmake?
      :cmake
    elsif args.autotools?
      :autotools
    elsif args.meson?
      :meson
    end

    if fc.name.nil? || fc.name.strip.empty?
      stem = Pathname.new(url).stem
      print "Formula name [#{stem}]: "
      fc.name = __gets || stem
      fc.update_path
    end

    # Don't allow blacklisted formula, or names that shadow aliases,
    # unless --force is specified.
    unless args.force?
      if reason = MissingFormula.blacklisted_reason(fc.name)
        raise <<~EOS
          #{fc.name} is blacklisted for creation.
          #{reason}
          If you really want to create this formula use --force.
        EOS
      end

      if Formula.aliases.include? fc.name
        realname = Formulary.canonical_name(fc.name)
        raise <<~EOS
          The formula #{realname} is already aliased to #{fc.name}
          Please check that you are not creating a duplicate.
          To force creation use --force.
        EOS
      end
    end

    fc.generate!

    puts "Please `brew audit --new-formula #{fc.name}` before submitting, thanks."
    exec_editor fc.path
  end
# Create a formula from a tarball URL
Create a formula from a tarball URL
Create a formula from a tarball URL
def create
    create_args.parse
    raise UsageError if ARGV.named.empty?
    HOMEBREW_CACHE.mkpath
    url = ARGV.named.first 
    version = args.set_version
    name = args.set_name
    tap = args.tap
    fc = FormulaCreator.new
    fc.name = name
    fc.version = version
    fc.tap = Tap.fetch(tap || "homebrew/core")
    raise TapUnavailableError, tap unless fc.tap.installed?
    fc.url = url
    fc.mode = if args.cmake?
      :cmake
    elsif args.autotools?
      :autotools
    elsif args.meson?
      :meson
    end
    if fc.name.nil? || fc.name.strip.empty?
      stem = Pathname.new(url).stem
      print "Formula name [#{stem}]: "
      fc.name = __gets || stem
      fc.update_path
    end
    unless args.force?
      if reason = MissingFormula.blacklisted_reason(fc.name)
        raise <<~EOS
          #{fc.name} is blacklisted for creation.
          #{reason}
          If you really want to create this formula use --force.
        EOS
      end
      if Formula.aliases.include? fc.name
        realname = Formulary.canonical_name(fc.name)
        raise <<~EOS
          The formula #{realname} is already aliased to #{fc.name}
          Please check that you are not creating a duplicate.
          To force creation use --force.
        EOS
      end
    end
    fc.generate!
    puts "Please `brew audit --new-formula #{fc.name}` before submitting, thanks."
    exec_editor fc.path
  end
def create create_args . parse raise UsageError if ARGV . named . empty? HOMEBREW_CACHE . mkpath url = ARGV . named . first version = args . set_version name = args . set_name tap = args . tap fc = FormulaCreator . new fc . name = name fc . version = version fc . tap = Tap . fetch ( tap || "homebrew/core" ) raise TapUnavailableError , tap unless fc . tap . installed? fc . url = url fc . mode = if args . cmake? :cmake elsif args . autotools? :autotools elsif args . meson? :meson end if fc . name . nil? || fc . name . strip . empty? stem = Pathname . new ( url ) . stem print "Formula name [#{stem}]: " fc . name = __gets || stem fc . update_path end unless args . force? if reason = MissingFormula . blacklisted_reason ( fc . name ) raise <<~EOS #{ fc . name }  is blacklisted for creation.
           #{ reason } 
          If you really want to create this formula use --force.
         EOS end if Formula . aliases . include? fc . name realname = Formulary . canonical_name ( fc . name ) raise <<~EOS 
          The formula  #{ realname }  is already aliased to  #{ fc . name } 
          Please check that you are not creating a duplicate.
          To force creation use --force.
         EOS end end fc . generate! puts "Please `brew audit --new-formula #{fc.name}` before submitting, thanks." exec_editor fc . path end
Create a formula from a tarball URL
Create a formula from a tarball URL
# Ensure that the cache exists so we can fetch the tarball # Pull the first (and only) url from ARGV # Don't allow blacklisted formula, or names that shadow aliases, # unless --force is specified.