- 
                Notifications
    
You must be signed in to change notification settings  - Fork 26
 
Feature/Add Qualified version #276
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Merged
      
      
    
  
     Merged
                    Changes from all commits
      Commits
    
    
            Show all changes
          
          
            4 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      44c76b8
              
                Create a internal struct to deliver the package version
              
              
                brunoocasali 6628f0c
              
                Make Pod::Spec load directly from PackageVersion.swift
              
              
                brunoocasali 40f495e
              
                Add a new step to lint podspec before the publish
              
              
                brunoocasali 70e5e29
              
                Add a new check-release step to prevent issues with the new versioning
              
              
                brunoocasali File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| 
          
            
          
           | 
    @@ -6,9 +6,18 @@ | |
| # To learn more about a Podspec see https://guides.cocoapods.org/syntax/podspec.html | ||
| # | ||
| 
     | 
||
| # Loads version from `PackageVersion.current` defined in the PackageVersion.swift file. | ||
| package_version = begin | ||
| File | ||
| .read("./Sources/MeiliSearch/Model/PackageVersion.swift") | ||
| .match(/"([0-9]+.[0-9]+.[0-9]+)"/i)[1] | ||
| rescue | ||
| raise "Cannot retrieve a valid semver.org version in the PackageVersion.swift file" | ||
| end | ||
| 
     | 
||
| Pod::Spec.new do |s| | ||
| s.name = 'MeiliSearch' | ||
| s.version = '0.13.0' | ||
| s.version = package_version | ||
| s.summary = 'The Meilisearch API client written in Swift' | ||
| 
     | 
||
| # This description is used to generate tags and improve search results. | ||
| 
        
          
        
         | 
    @@ -33,10 +42,11 @@ Pod::Spec.new do |s| | |
| s.homepage = 'https://github.com/meilisearch/meilisearch-swift' | ||
| s.license = { :type => 'MIT', :file => 'LICENSE' } | ||
| s.author = { 'Meilisearch' => '[email protected]' } | ||
| s.source = { :git => 'https://github.com/meilisearch/meilisearch-swift.git', :tag => s.version.to_s } | ||
| s.source = { :git => 'https://github.com/meilisearch/meilisearch-swift.git', :tag => package_version } | ||
| s.social_media_url = 'https://twitter.com/meilisearch' | ||
| 
     | 
||
| s.source_files = 'Sources/**/*' | ||
| s.source_files = 'Sources/**/*.{h,m,swift}' | ||
| 
     | 
||
| s.swift_versions = ['5.2'] | ||
| s.ios.deployment_target = '10.0' | ||
| s.osx.deployment_target = '10.10' | ||
| 
          
            
          
           | 
    ||
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| import Foundation | ||
| 
     | 
||
| internal struct PackageVersion { | ||
| /// This is the current version of the meilisearch-swift package | ||
| private static let current = "0.13.0" | ||
| 
     | 
||
| /** | ||
| Retrieves the current version of the MeiliSearch Swift package and formats accordingly. | ||
| 
     | 
||
| - returns: String containing the qualified version of this package eg. `Meilisearch Swift (v1.0.0)` | ||
| */ | ||
| static func qualifiedVersion(_ rawVersion: String? = nil) -> String { | ||
| "Meilisearch Swift (v\(rawVersion ?? self.current))" | ||
| } | ||
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| @testable import MeiliSearch | ||
| 
     | 
||
| import Foundation | ||
| import XCTest | ||
| 
     | 
||
| class PackageVersionTests: XCTestCase { | ||
| func testAppendsContentsToPrefix() { | ||
| XCTAssert(PackageVersion.qualifiedVersion().contains("Meilisearch Swift")) | ||
| } | ||
| 
     | 
||
| func testGetsFullyQualifiedVersion() { | ||
| XCTAssertEqual(PackageVersion.qualifiedVersion("0.3.2"), "Meilisearch Swift (v0.3.2)") | ||
| } | ||
| 
     | 
||
| func testChecksForSemVerVersion() { | ||
| let version = PackageVersion.qualifiedVersion() | ||
| let regex = "[0-9]+.[0-9]+.[0-9]+" | ||
| 
     | 
||
| let hasSemVer = (version.range(of: regex, options: .regularExpression) ?? nil) != nil | ||
| 
     | 
||
| XCTAssert(hasSemVer, "The PackageVersion.current does not have a valid semver version.") | ||
| } | ||
| } | 
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.