创建并发布自己的公有库和如何把私有库的文件分多层目录存储

简介: 创建并发布自己的公有库和如何把私有库的文件分多层目录存储

我想把我的私有组件的文件分目录存储,我在网上搜了一大堆,但是实验后全部检查不通过。最近我终于找到原因了。因为网上文章抄来抄去全部都不正确,原因是因为在注释前是podspec格式文件不支持的"//"。而podspec格式文件支持注释符号是"#"。失之毫厘,谬以千里。

1、建立工程,创建.podspec文件。

#
# Be sure to run `pod lib lint YXPaylibraryManager.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 http://guides.cocoapods.org/syntax/podspec.html
#

Pod::Spec.new do |s|
  s.name             = 'BITCocoaLumberjack'
  s.version          = '0.0.3'
  s.summary          = 'BITCocoaLumberjack.'

# 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!

  s.description      = <<-DESC
TODO: Add long description of the pod here.
                       DESC

  s.homepage         = 'http://www.baidu.com/'
  # s.screenshots     = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2'
  s.license          = { :type => 'MIT', :file => 'LICENSE' }
  s.author           = { 'jiaguoshang' => 'jia12216@163.com' }
  s.source           = { :git => 'https://gitee.com/jia12216/BITCocoaLumberjack.git', :tag => s.version.to_s }
  # s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>'

  s.ios.deployment_target = '8.0'

#**/*表示Classes目录及其子目录下所有文件
#  s.source_files = 'BITCocoaLumberjack/Classes/**/*'

  #第一层文件夹名称Default(虚拟路径),千万别把目录名称写成Classes,或者检查势失败,Classes应该是系统保留字
  s.subspec 'Default' do |ss|
    #下载Classes下所有的.h和.m文件
    ss.source_files = 'BITCocoaLumberjack/Classes/*.{h,m}'
    #允许使用import<CocoaLumberjack.h>
    ss.public_header_files = 'BITCocoaLumberjack/CocoaLumberjack.h'
    #允许使用import<CocoaLumberjackMacro.h>
    ss.public_header_files = 'BITCocoaLumberjack/CocoaLumberjackMacro.h'
    #允许使用import<CocoaLumberjackNoLogsMacro.h>
    ss.public_header_files = 'BITCocoaLumberjack/CocoaLumberjackNoLogsMacro.h'
    
    #第二层文件夹名称Extensions(虚拟路径)
       ss.subspec 'Extensions' do |sss|
       #下载Extensions下所有的.h和.m文件
       sss.source_files = 'BITCocoaLumberjack/Classes/Extensions/*.{h,m}'
    end
  end

  # s.resource_bundles = {
  #    'BITCocoaLumberjack' => ['BITCocoaLumberjack/Classes/*.xcassets']
  # }

  # s.public_header_files = 'Pod/Classes/**/*.h'
   s.frameworks = 'UIKit', 'Foundation'
   #s.dependency 'ReactiveCocoa', '~> 2.5'  #依赖制定版本的组件
end

若是使用s.source_files = ‘BITCocoaLumberjack/Classes/**/*’,那么它是表示的是Classes目录及其子目录下所有文件。

ss.subspec ‘Extensions’ do |sss|是表示第二层文件夹名称Default(虚拟路径)。

有时间成功和你只差两个字符。

2、编辑检查podspec文件。

pod spec lint BITCocoaLumberjack.podspec  --allow-warnings
w1:BITCocoaLumberjack jiaguoshang$ pod spec lint BITCocoaLumberjack.podspec  --allow-warnings

 -> BITCocoaLumberjack (0.0.1)
    - NOTE  | xcodebuild:  note: Using new build system
    - NOTE  | [iOS] xcodebuild:  note: Planning build
    - NOTE  | [iOS] xcodebuild:  note: Constructing build description
    - NOTE  | [iOS] xcodebuild:  warning: Skipping code signing because the target does not have an Info.plist file. (in target 'App')

Analyzed 1 podspec.

BITCocoaLumberjack.podspec passed validation.

3、在码云或gitHub创建公有项目,打版本标签,上传工程。

4、Cocoapods注册Trunk。

这个邮件有时间发过来不是一般的慢啊!

不行了多发几次吧!

收到的确认邮件

拷贝粘贴激活链接到浏览器上打开

w1:BITCocoaLumberjack jiaguoshang$ pod trunk register jia12216@163.com 'jiaguoshang'
[!] Please verify the session by clicking the link in the verification email that has been sent to jia12216@163.com
w1:BITCocoaLumberjack jiaguoshang$ pod trunk me
  - Name:     jiaguoshang
  - Email:    jia12216@163.com
  - Since:    December 5th, 2017 06:32
  - Pods:
    - AERequestManage
  - Sessions:
    - December 5th, 2017 06:32 -     April 13th, 03:45. IP: 218.72.30.25
    Description: macbook air
    - November 28th, 03:55     - April 5th, 2019 03:55. IP:
    125.119.191.112
    - November 28th, 18:59     - April 5th, 2019 19:00. IP:
    125.119.191.112

4、上传配置到公有源。

pod trunk push BITCocoaLumberjack.podspec --allow-warnings
w1:BITCocoaLumberjack jiaguoshang$  pod trunk push BITCocoaLumberjack.podspec --allow-warnings
Updating spec repo `master`
warning: inexact rename detection was skipped due to too many files.
warning: you may want to set your diff.renameLimit variable to at least 30696 and retry the command.

CocoaPods 1.6.0.beta.2 is available.
To update use: `gem install cocoapods --pre`
[!] This is a test version we'd love you to try.

For more information, see https://blog.cocoapods.org and the CHANGELOG for this version at https://github.com/CocoaPods/CocoaPods/releases/tag/1.6.0.beta.2

Validating podspec
 -> BITCocoaLumberjack (0.0.1)
    - NOTE  | xcodebuild:  note: Using new build system
    - NOTE  | [iOS] xcodebuild:  note: Planning build
    - NOTE  | [iOS] xcodebuild:  note: Constructing build description
    - NOTE  | [iOS] xcodebuild:  warning: Skipping code signing because the target does not have an Info.plist file. (in target 'App')

Updating spec repo `master`

CocoaPods 1.6.0.beta.2 is available.
To update use: `gem install cocoapods --pre`
[!] This is a test version we'd love you to try.

For more information, see https://blog.cocoapods.org and the CHANGELOG for this version at https://github.com/CocoaPods/CocoaPods/releases/tag/1.6.0.beta.2


--------------------------------------------------------------------------------
   Congrats

   BITCocoaLumberjack (0.0.1) successfully published
   November 28th, 20:53
   https://cocoapods.org/pods/BITCocoaLumberjack
   Tell your friends!
--------------------------------------------------------------------------------

5、把自己的公有库添加到podfile文件并更新pod来测试下。

w1:HZBitSmartLock jiaguoshang$ pod update --verbose --no-repo-update
Integrating client project

Integrating target `Pods-HZBitSmartLock` (`HZBitSmartLock.xcodeproj` project)
  - Running post install hooks
    - cocoapods-stats from
    `/Users/jiaguoshang/.rvm/gems/ruby-2.4.0@global/gems/cocoapods-stats-1.0.0/lib/cocoapods_plugin.rb`

Sending stats
      - BITCocoaLumberjack, 0.0.1

-> Pod installation complete! There are 1 dependencies from the Podfile and 1 total pods installed.

[!] The `HZBitSmartLock [Debug]` target overrides the `ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES` build setting defined in `Pods/Target Support Files/Pods-HZBitSmartLock/Pods-HZBitSmartLock.debug.xcconfig'. This can lead to problems with the CocoaPods installation
    - Use the `$(inherited)` flag, or
    - Remove the build settings from the target.

[!] The `HZBitSmartLock [Release]` target overrides the `ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES` build setting defined in `Pods/Target Support Files/Pods-HZBitSmartLock/Pods-HZBitSmartLock.release.xcconfig'. This can lead to problems with the CocoaPods installation
    - Use the `$(inherited)` flag, or
    - Remove the build settings from the target.


目录
相关文章
|
JavaScript IDE 前端开发
如何在大型代码仓库中删掉废弃的文件和 exports?
本文是我最近在公司内部写的废弃代码删除工具的一篇思考总结。
|
2月前
|
JavaScript Serverless 数据安全/隐私保护
函数计算产品使用问题之怎么动态设置.npmrc文件以配置私有仓库访问
函数计算产品作为一种事件驱动的全托管计算服务,让用户能够专注于业务逻辑的编写,而无需关心底层服务器的管理与运维。你可以有效地利用函数计算产品来支撑各类应用场景,从简单的数据处理到复杂的业务逻辑,实现快速、高效、低成本的云上部署与运维。以下是一些关于使用函数计算产品的合集和要点,帮助你更好地理解和应用这一服务。
|
XML 存储 数据格式
基于大量文件的名称特征自动新建多个文件夹并自动复制对应文件:Python
本文介绍基于Python,对一个文件夹下大量栅格影像,基于其各自文件名,分别创建指定名称的新文件夹,并将对应影像文件复制到不同的新文件夹下的方法。
137 3
基于大量文件的名称特征自动新建多个文件夹并自动复制对应文件:Python
|
C++
19.【c++基础篇.三个文件实现】
19.【c++基础篇.三个文件实现】
70 0
|
Windows
怎么批量给文件添加拓展名?
怎么批量给文件添加拓展名?
170 0
怎么批量给文件添加拓展名?
|
存储
修改nuget包默认存放路径,避免增加C盘的负担
修改nuget包默认存放路径,避免增加C盘的负担
327 0
修改nuget包默认存放路径,避免增加C盘的负担
代码管理学:常量类应该单独一个目录,还是在模块目录下?
代码管理学:常量类应该单独一个目录,还是在模块目录下?
81 0
|
存储 SQL 缓存
DVC 使用指南:管理外部数据
⚠️ 这是针对特定情况的高级功能,除非绝对没有其他选择,否则不推荐使用。 在大多数情况下,dvc add 和 dvc import-url 的 to-cache 或 to-remote 策略更方便。
|
前端开发 数据采集 JavaScript
项目目录标准结构
(学习自慕课网中《所向披靡的响应式开发》课程中) 一.如何组织项目目录结构 1.约定优于配置 2.约定代码结构或命名规范来减少配置数量 (没有最好的组织方式,只有合适的组织方式) 样式放入CSS文件下,main.css是通用样式,normalize.css是引用样式,login是的登录样式。
1467 0
|
缓存 数据库
Confluence 6 从外部目录中同步数据支持的目录类型
针对一些特定的用户目录类型,Confluence 在系统的数据库中保存了目录的缓存信息(用户和用户组),这样能够让系统更快速的访问用户和用户组数据。
986 0