ARGV: Deprecate ARGV.collect_build_args
This commit is contained in:
		
							parent
							
								
									6530e333b3
								
							
						
					
					
						commit
						7ad6dab288
					
				@ -68,6 +68,19 @@ module Homebrew
 | 
				
			|||||||
        named.blank?
 | 
					        named.blank?
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      # If the user passes any flags that trigger building over installing from
 | 
				
			||||||
 | 
					      # a bottle, they are collected here and returned as an Array for checking.
 | 
				
			||||||
 | 
					      def collect_build_args
 | 
				
			||||||
 | 
					        build_flags = []
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        build_flags << "--HEAD" if head
 | 
				
			||||||
 | 
					        build_flags << "--universal" if build_universal
 | 
				
			||||||
 | 
					        build_flags << "--build-bottle" if build_bottle
 | 
				
			||||||
 | 
					        build_flags << "--build-from-source" if build_from_source
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        build_flags
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      def formulae
 | 
					      def formulae
 | 
				
			||||||
        require "formula"
 | 
					        require "formula"
 | 
				
			||||||
        @formulae ||= (downcased_unique_named - casks).map do |name|
 | 
					        @formulae ||= (downcased_unique_named - casks).map do |name|
 | 
				
			||||||
@ -160,11 +173,33 @@ module Homebrew
 | 
				
			|||||||
      end
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      def head
 | 
					      def head
 | 
				
			||||||
        (args_parsed && HEAD?) || cmdline_args.include?("--HEAD")
 | 
					        return true if args_parsed && HEAD?
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        cmdline_args.include?("--HEAD")
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      def devel
 | 
					      def devel
 | 
				
			||||||
        (args_parsed && devel?) || cmdline_args.include?("--devel")
 | 
					        return true if args_parsed && devel?
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        cmdline_args.include?("--devel")
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      def build_universal
 | 
				
			||||||
 | 
					        return true if args_parsed && universal?
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        cmdline_args.include?("--universal")
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      def build_bottle
 | 
				
			||||||
 | 
					        return true if args_parsed && build_bottle?
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        cmdline_args.include?("--build-bottle")
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      def build_from_source
 | 
				
			||||||
 | 
					        return true if args_parsed && (build_from_source? || s?)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        cmdline_args.include?("--build-from-source") || cmdline_args.include?("-s")
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      def spec(default = :stable)
 | 
					      def spec(default = :stable)
 | 
				
			||||||
 | 
				
			|||||||
@ -47,10 +47,6 @@ module HomebrewArgvExtension
 | 
				
			|||||||
    !(include?("--HEAD") || include?("--devel"))
 | 
					    !(include?("--HEAD") || include?("--devel"))
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def build_universal?
 | 
					 | 
				
			||||||
    include? "--universal"
 | 
					 | 
				
			||||||
  end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  def build_bottle?
 | 
					  def build_bottle?
 | 
				
			||||||
    include?("--build-bottle")
 | 
					    include?("--build-bottle")
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
@ -84,19 +80,6 @@ module HomebrewArgvExtension
 | 
				
			|||||||
    value "env"
 | 
					    value "env"
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  # If the user passes any flags that trigger building over installing from
 | 
					 | 
				
			||||||
  # a bottle, they are collected here and returned as an Array for checking.
 | 
					 | 
				
			||||||
  def collect_build_flags
 | 
					 | 
				
			||||||
    build_flags = []
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    build_flags << "--HEAD" if include?("--HEAD")
 | 
					 | 
				
			||||||
    build_flags << "--universal" if build_universal?
 | 
					 | 
				
			||||||
    build_flags << "--build-bottle" if build_bottle?
 | 
					 | 
				
			||||||
    build_flags << "--build-from-source" if build_from_source?
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    build_flags
 | 
					 | 
				
			||||||
  end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  private
 | 
					  private
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def options_only
 | 
					  def options_only
 | 
				
			||||||
 | 
				
			|||||||
@ -80,7 +80,7 @@ class FormulaInstaller
 | 
				
			|||||||
  # it's necessary to interrupt the user before any sort of installation
 | 
					  # it's necessary to interrupt the user before any sort of installation
 | 
				
			||||||
  # can proceed. Only invoked when the user has no developer tools.
 | 
					  # can proceed. Only invoked when the user has no developer tools.
 | 
				
			||||||
  def self.prevent_build_flags
 | 
					  def self.prevent_build_flags
 | 
				
			||||||
    build_flags = ARGV.collect_build_flags
 | 
					    build_flags = Homebrew.args.collect_build_args
 | 
				
			||||||
    return if build_flags.empty?
 | 
					    return if build_flags.empty?
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    all_bottled = ARGV.formulae.all?(&:bottled?)
 | 
					    all_bottled = ARGV.formulae.all?(&:bottled?)
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user