Cocoapods Pod回购推送git

时间:2019-04-26 07:29:49

标签: swift cocoapods podspec cocoapods-1.2

我正在尝试将吊舱推到本地仓库。在此之前,我已经在仓库中验证了pod lib lint,并且可以在本地正常运行

$ 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.

此后,我创建了标签并将其推送到服务器

$ git tag
0.1.0
0.1.1
1.0

然后我尝试测试本地存储库的pod repo push命令,但失败了

$ pod repo push git@git.url.com: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.

然后我删除了--local-only标志并再次运行,但仍然失败。

$ pod repo push git@git.url.com: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.

这是Pod版本

$ 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

这是podspec文件:

#
# 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' => 'ankit.thakur@url.com' }
  spec.source           = { :git => 'git@git.url.com: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

spec.source_files的响应是

$ 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

根据提供的解决方案中的建议,我更新的Podspec是

#
# 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' => 'ankit.thakur@promobitech.com' }
  spec.source           = { :git => 'git@git.promobitech.com: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

但它仍然无法正常工作。

这是我的podspec文件:

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

1 个答案:

答案 0 :(得分:0)

错误提示:

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

这意味着您输入了错误的模式。

因此,您应像以下那样更正source_files

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

(这将包括文件夹“ FOLDERNAME”下的所有Swift文件)

如果您有多个文件夹,请执行以下操作:

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