create: add license field as parsable arg
This commit is contained in:
		
							parent
							
								
									c643777879
								
							
						
					
					
						commit
						d92f747b1e
					
				@ -45,8 +45,11 @@ module Homebrew
 | 
			
		||||
             description: "Explicitly set the <name> of the new formula."
 | 
			
		||||
      flag   "--set-version=",
 | 
			
		||||
             description: "Explicitly set the <version> of the new formula."
 | 
			
		||||
      flag   "--set-license=",
 | 
			
		||||
             description: "Explicitly set the <license> of the new formula."
 | 
			
		||||
      flag   "--tap=",
 | 
			
		||||
             description: "Generate the new formula within the given tap, specified as <user>`/`<repo>."
 | 
			
		||||
 | 
			
		||||
      switch :force
 | 
			
		||||
      switch :verbose
 | 
			
		||||
      switch :debug
 | 
			
		||||
@ -66,11 +69,13 @@ module Homebrew
 | 
			
		||||
 | 
			
		||||
    version = args.set_version
 | 
			
		||||
    name = args.set_name
 | 
			
		||||
    license = args.set_license
 | 
			
		||||
    tap = args.tap
 | 
			
		||||
 | 
			
		||||
    fc = FormulaCreator.new
 | 
			
		||||
    fc.name = name
 | 
			
		||||
    fc.version = version
 | 
			
		||||
    fc.license = license
 | 
			
		||||
    fc.tap = Tap.fetch(tap || "homebrew/core")
 | 
			
		||||
    raise TapUnavailableError, tap unless fc.tap.installed?
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -5,8 +5,8 @@ require "erb"
 | 
			
		||||
 | 
			
		||||
module Homebrew
 | 
			
		||||
  class FormulaCreator
 | 
			
		||||
    attr_reader :url, :sha256, :desc, :homepage, :license
 | 
			
		||||
    attr_accessor :name, :version, :tap, :path, :mode
 | 
			
		||||
    attr_reader :url, :sha256, :desc, :homepage
 | 
			
		||||
    attr_accessor :name, :version, :tap, :path, :mode, :license
 | 
			
		||||
 | 
			
		||||
    def url=(url)
 | 
			
		||||
      @url = url
 | 
			
		||||
@ -49,6 +49,7 @@ module Homebrew
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    def generate!
 | 
			
		||||
      p "generate"
 | 
			
		||||
      raise "#{path} already exists" if path.exist?
 | 
			
		||||
 | 
			
		||||
      if version.nil? || version.null?
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user