version: parse tag if detecting version
This commit is contained in:
		
							parent
							
								
									955947c8dc
								
							
						
					
					
						commit
						11ebc27e0a
					
				@ -684,10 +684,15 @@ describe Version do
 | 
			
		||||
        .to be_detected_from("https://php.net/get/php-7.1.10.tar.gz/from/this/mirror")
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    specify "from URL" do
 | 
			
		||||
    specify "from tag" do
 | 
			
		||||
      expect(described_class.create("1.2.3"))
 | 
			
		||||
        .to be_detected_from("https://github.com/foo/bar.git", tag: "v1.2.3")
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    specify "beta from tag" do
 | 
			
		||||
      expect(described_class.create("1.2.3-beta1"))
 | 
			
		||||
        .to be_detected_from("https://github.com/foo/bar.git", tag: "v1.2.3-beta1")
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -201,7 +201,7 @@ class Version
 | 
			
		||||
 | 
			
		||||
  def self.detect(url, specs)
 | 
			
		||||
    if specs.key?(:tag)
 | 
			
		||||
      FromURL.new(specs[:tag][/((?:\d+\.)*\d+)/, 1])
 | 
			
		||||
      FromURL.parse(specs[:tag])
 | 
			
		||||
    else
 | 
			
		||||
      FromURL.parse(url)
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user