Let change_make_var! append to existing value.
To existing flag value can be specified with "\\1".
To append values to a flag, call with:
    s.change_make_var! "THE_FLAG", "\\1 more-flag-values"
The same trick can be used to prepend or surround values as well.
			
			
This commit is contained in:
		
							parent
							
								
									d8b093f279
								
							
						
					
					
						commit
						5474cf1a95
					
				@ -181,9 +181,9 @@ module HomebrewInreplaceExtension
 | 
			
		||||
  # Looks for Makefile style variable defintions and replaces the
 | 
			
		||||
  # value with "new_value", or removes the definition entirely.
 | 
			
		||||
  # See inreplace in utils.rb
 | 
			
		||||
  def change_make_var! flag, new_value
 | 
			
		||||
    new_value = "#{flag}=#{new_value}" unless new_value.to_s.empty?
 | 
			
		||||
    gsub! Regexp.new("^#{flag}\\s*=.*$"), new_value.to_s
 | 
			
		||||
  def change_make_var! flag, new_value=nil
 | 
			
		||||
    new_value = "#{flag}=#{new_value}" unless new_value == nil
 | 
			
		||||
    gsub! Regexp.new("^#{flag}\\s*=\\s*(.*)$"), new_value
 | 
			
		||||
  end
 | 
			
		||||
  def remove_make_var! flags
 | 
			
		||||
    flags.each { |flag| change_make_var! flag, "" }
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user