canonical_name can resolve taps
This commit is contained in:
		
							parent
							
								
									903b1167a6
								
							
						
					
					
						commit
						3f25dd60fa
					
				@ -30,14 +30,14 @@ module Homebrew extend self
 | 
			
		||||
      if $?.success?
 | 
			
		||||
        gitignores << relative_pathname.basename.to_s
 | 
			
		||||
      else
 | 
			
		||||
        opoo "#{relative_pathname.basename, ".rb"} conflicts"
 | 
			
		||||
        opoo "#{relative_pathname.basename('.rb')} conflicts"
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    tf = Tempfile.new("brew-tap")
 | 
			
		||||
    tf.write(gitignores.uniq.join("\n"))
 | 
			
		||||
    tf.close
 | 
			
		||||
    mv tf.path, "#{HOMEBREW_PREFIX}/Library/Formula/.gitignore"
 | 
			
		||||
    mv tf.path, "#{HOMEBREW_LIBRARY}/Formula/.gitignore"
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  private
 | 
			
		||||
 | 
			
		||||
@ -283,7 +283,6 @@ class Formula
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def self.canonical_name name
 | 
			
		||||
    # Cast pathnames to strings.
 | 
			
		||||
    name = name.to_s if name.kind_of? Pathname
 | 
			
		||||
 | 
			
		||||
    formula_with_that_name = HOMEBREW_REPOSITORY+"Library/Formula/#{name}.rb"
 | 
			
		||||
@ -291,7 +290,13 @@ class Formula
 | 
			
		||||
    possible_cached_formula = HOMEBREW_CACHE_FORMULA+"#{name}.rb"
 | 
			
		||||
 | 
			
		||||
    if name.include? "/"
 | 
			
		||||
      # Don't resolve paths or URLs
 | 
			
		||||
      if name =~ %r{(.+)/(.+)/(.+)}
 | 
			
		||||
        tapd = HOMEBREW_REPOSITORY/"Library/Taps/#$1-#$2"
 | 
			
		||||
        tapd.find_formula do |relative_pathname|
 | 
			
		||||
          return "#{tapd}/#{relative_pathname}" if relative_pathname.stem.to_s == $3
 | 
			
		||||
        end if tapd.directory?
 | 
			
		||||
      end
 | 
			
		||||
      # Otherwise don't resolve paths or URLs
 | 
			
		||||
      name
 | 
			
		||||
    elsif formula_with_that_name.file? and formula_with_that_name.readable?
 | 
			
		||||
      name
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user