Ankit Thakur
Ankit Thakur

Reputation: 4749

Cocoapods pod repo push git

I am trying to push my pod to local repo. Before that, I have verified pod lib lint on my repo, and working fine locally

$ pod lib lint --swift-version=5.0 --allow-warnings
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/universal-darwin18/rbconfig.rb:215: warning: Insecure world writable dir /usr/local/sbin in PATH, mode 040777

 -> SFLocationManager (1.0)
    - WARN  | source: Git SSH URLs will NOT work for people behind firewalls configured to only allow HTTP, therefore HTTPS is preferred.
    - NOTE  | xcodebuild:  note: Using new build system
    - NOTE  | xcodebuild:  note: Planning build
    - NOTE  | xcodebuild:  note: Constructing build description

SFLocationManager passed validation.

After this, I have created tags and pushed to server

$ git tag
0.1.0
0.1.1
1.0

Then I have tried to test pod repo push command for local repo, which got failed

$ pod repo push [email protected]:ankit.thakur/locationmanager.git SFLocationManager.podspec --allow-warnings --swift-version=5.0 --local-only
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/universal-darwin18/rbconfig.rb:215: warning: Insecure world writable dir /usr/local/sbin in PATH, mode 040777

Validating spec
 -> SFLocationManager (1.0)
    - WARN  | source: Git SSH URLs will NOT work for people behind firewalls configured to only allow HTTP, therefore HTTPS is preferred.
    - ERROR | file patterns: The `source_files` pattern did not match any file.
    - NOTE  | xcodebuild:  note: Using new build system
    - NOTE  | xcodebuild:  note: Planning build
    - NOTE  | xcodebuild:  note: Constructing build description

[!] The `SFLocationManager.podspec` specification does not validate.

Then I removed --local-only flag and ran again, but still failed.

$ pod repo push [email protected]:ankit.thakur/locationmanager.git SFLocationManager.podspec --allow-warnings --swift-version=5.0
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/universal-darwin18/rbconfig.rb:215: warning: Insecure world writable dir /usr/local/sbin in PATH, mode 040777

Validating spec
 -> SFLocationManager (1.0)
    - WARN  | source: Git SSH URLs will NOT work for people behind firewalls configured to only allow HTTP, therefore HTTPS is preferred.
    - ERROR | file patterns: The `source_files` pattern did not match any file.
    - NOTE  | xcodebuild:  note: Using new build system
    - NOTE  | xcodebuild:  note: Planning build
    - NOTE  | xcodebuild:  note: Constructing build description

[!] The `SFLocationManager.podspec` specification does not validate.

Here is the pod version

$ pod --version
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/universal-darwin18/rbconfig.rb:215: warning: Insecure world writable dir /usr/local/sbin in PATH, mode 040777
1.6.0

Here is the podspec file:

#
# Be sure to run `pod lib lint SFLocationManager.podspec' to ensure this is a
# valid spec before submitting.
#
# Any lines starting with a # are optional, but their use is encouraged
# To learn more about a Podspec see https://guides.cocoapods.org/syntax/podspec.html
#

Pod::Spec.new do |spec|
  spec.name             = 'SFLocationManager'
  spec.version          = '1.0'
  spec.summary          = 'SFLocationManager is location based library for iOS and Mac'

# This description is used to generate tags and improve search results.
#   * Think: What does it do? Why did you write it? What is the focus?
#   * Try to keep it short, snappy and to the point.
#   * Write the description between the DESC delimiters below.
#   * Finally, don't worry about the indent, CocoaPods strips it!

  spec.description      = <<-DESC
 Location library in beta test version to fetch location with scheduled interval.
                       DESC

  spec.homepage         = 'https://git.url.com/ankit.thakur/locationmanager'
  # spec.screenshots     = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2'
  spec.license          = { :type => 'MIT', :file => 'LICENSE' }
  spec.author           = { 'ankitthakur' => '[email protected]' }
  spec.source           = { :git => '[email protected]:ankit.thakur/locationmanager.git', :tag => spec.version.to_s }
  # spec.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>'

  spec.requires_arc = true
  spec.ios.deployment_target  = '10.0'
  spec.osx.deployment_target  = '10.10'

  spec.source_files       = 'SFLocationManager/Sources/Common/**/*.swift'
  # spec.ios.source_files   = 'SFLocationManager/Sources/iOS/**/*.swift'
  # spec.osx.source_files   = 'SFLocationManager/Sources/OSX/**/*.swift'

  # spec.resource_bundles = {
  #   'SFLocationManager' => ['SFLocationManager/Assets/*.png']
  # }

  spec.frameworks = 'CoreLocation'

  # spec.public_header_files = 'Pod/Classes/**/*.h'
  # spec.frameworks = 'UIKit', 'MapKit'
  # spec.dependency 'AFNetworking', '~> 2.3'
end

The response of spec.source_files is

$ ls -al SFLocationManager/Sources/Common/**/*.swift
-rw-r--r--@ 1 ankitthakur  staff  2710 Apr 25 18:02 SFLocationManager/Sources/Common/GeocoderUtils/Geocoder.swift
-rw-r--r--@ 1 ankitthakur  staff   613 Apr 25 18:21 SFLocationManager/Sources/Common/LocationManager/LocationConfiguration.swift
-rw-r--r--@ 1 ankitthakur  staff   324 Apr 25 18:02 SFLocationManager/Sources/Common/LocationManager/LocationError.swift
-rw-r--r--@ 1 ankitthakur  staff   241 Apr 25 18:02 SFLocationManager/Sources/Common/LocationManager/LocationEventType.swift
-rw-r--r--@ 1 ankitthakur  staff  7144 Apr 25 18:36 SFLocationManager/Sources/Common/LocationManager/LocationManager.swift
-rw-r--r--@ 1 ankitthakur  staff  4649 Apr 25 18:02 SFLocationManager/Sources/Common/Model/Location.swift
-rw-r--r--@ 1 ankitthakur  staff  3939 Apr 25 18:27 SFLocationManager/Sources/Common/Trigger/LocationTriggerManager.swift

As per suggestions in provided solutions, my updated Podspec is

#
# Be sure to run `pod lib lint SFLocationManager.podspec' to ensure this is a
# valid spec before submitting.
#
# Any lines starting with a # are optional, but their use is encouraged
# To learn more about a Podspec see https://guides.cocoapods.org/syntax/podspec.html
#

Pod::Spec.new do |spec|
  spec.name             = 'SFLocationManager'
  spec.version          = '1.0'
  spec.summary          = 'SFLocationManager is location based library for iOS and Mac'

# This description is used to generate tags and improve search results.
#   * Think: What does it do? Why did you write it? What is the focus?
#   * Try to keep it short, snappy and to the point.
#   * Write the description between the DESC delimiters below.
#   * Finally, don't worry about the indent, CocoaPods strips it!

  spec.description      = <<-DESC
 Location library in beta test version to fetch location with scheduled interval.
                       DESC

  spec.homepage         = 'https://git.promobitech.com/ankit.thakur/locationmanager'
  # spec.screenshots     = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2'
  spec.license          = { :type => 'MIT', :file => 'LICENSE' }
  spec.author           = { 'ankitthakur' => '[email protected]' }
  spec.source           = { :git => '[email protected]:ankit.thakur/locationmanager.git', :tag => spec.version.to_s }
  # spec.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>'

  spec.requires_arc = true
  spec.ios.deployment_target  = '10.0'
  spec.osx.deployment_target  = '10.10'

  spec.source_files       = 'SFLocationManager/Sources/Common/GeocoderUtils/*.{swift}',
  'SFLocationManager/Sources/Common/LocationManager/*.{swift}',
  'SFLocationManager/Sources/Common/Model/*.{swift}',
  'SFLocationManager/Sources/Common/Trigger/*.{swift}'
  # spec.ios.source_files   = 'SFLocationManager/Sources/iOS/**/*.{swift}'
  # spec.osx.source_files   = 'SFLocationManager/Sources/OSX/**/*.{swift}'

  # spec.resource_bundles = {
  #   'SFLocationManager' => ['SFLocationManager/Assets/*.png']
  # }

  spec.frameworks = 'CoreLocation'

  # spec.public_header_files = 'Pod/Classes/**/*.h'
  # spec.frameworks = 'UIKit', 'MapKit'
  # spec.dependency 'AFNetworking', '~> 2.3'
end

but it is still not working.

Here is the my podspec file:

Admin:locationmanager ankitthakur$ ls -al
total 40
drwxr-xr-x  10 ankitthakur  staff   320 Apr 25 20:38 .
drwxr-xr-x   9 ankitthakur  staff   288 Apr 25 20:38 ..
-rw-r--r--   1 ankitthakur  staff  6148 Apr 25 20:38 .DS_Store
drwxr-xr-x  14 ankitthakur  staff   448 Apr 26 14:50 .git
drwxr-xr-x  10 ankitthakur  staff   320 Apr 25 20:38 Example
-rw-r--r--   1 ankitthakur  staff  1086 Apr 25 20:38 LICENSE
-rw-r--r--   1 ankitthakur  staff  1029 Apr 25 20:38 README.md
drwxr-xr-x   4 ankitthakur  staff   128 Apr 25 20:51 SFLocationManager
-rw-r--r--   1 ankitthakur  staff  2241 Apr 26 14:49 SFLocationManager.podspec
lrwxr-xr-x   1 ankitthakur  staff    27 Apr 25 20:38 _Pods.xcodeproj -> Example/Pods/Pods.xcodeproj

Upvotes: 1

Views: 2375

Answers (1)

Marwen Doukh
Marwen Doukh

Reputation: 2050

The error says:

file patterns: The `source_files` pattern did not match any file.

This means that you have written a wrong pattern.

So you should correct your source_files like the following

s.source_files = "FOLDERNAME/*.{swift}"

(This will include all the Swift files under the folder "FOLDERNAME")

In case you have multiple folders, do like the following:

s.source_files = "FOLDERNAME1/*.{swift}" , "FOLDERNAME2/*.{swift}"

Upvotes: 0

Related Questions