/images/avatar.JPG

Jenkins基本安装与使用

准备工作

  1. 开发环境,如Java、Ruby、MacOS等。
  2. 开发工具,如Xcode、Android Studio、IntelliJ IDEA等。
  3. 证书管理,如推送证书、商店证书、手机配置文件等。
  4. 其他依赖工具,如Git、Fastlane、Cocoapods、Maven等。

建议:准备完成后,创建新项目或使用已有项目,打包一次验证是否可以成功打包。

Cocoapods之podspec文件

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#名字
s.name             = 'Chat2Love'
#版本号,更新发布内容最好更新版本号
s.version          = '0.1.0'
#简介说明
s.summary          = 'A short description of Chat2Love.'
#详细说明
s.description      = ''
#主页,通常是github项目地址
s.homepage         = 'https://github.com/dsencheng/Chat2Love'
#屏幕快照链接
# s.screenshots     = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2'
#协议
s.license          = { :type => 'MIT', :file => 'LICENSE' }
#作者
s.author           = { 'dsencheng' => 'dsencheng@gmail.com' }
#源码地址
s.source           = { :git => 'https://github.com/dsencheng/Chat2Love.git', :tag => s.version.to_s }
#社交信息
# s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>'
#开发版本
s.ios.deployment_target = '8.0'
#暴露的文件,举例:`/*.h` 仅暴露.h文件。 `/*.{h,m} ` 仅暴露.h和.m文件
s.source_files = 'Chat2Love/Classes/**/*'
#资源文件
# s.resource_bundles = {
#   'Chat2Love' => ['Chat2Love/Assets/*.png']
# }
#暂未用到
# s.public_header_files = 'Pod/Classes/**/*.h'
#需要使用到的系统库
# s.frameworks = 'UIKit', 'MapKit'
# 需要依赖的三方库,支持指定版本,不支持指定地址。可在podfile文件中指定地址。
# s.dependency 'AFNetworking', '~> 2.3'
#静态库
#s.static_framework = true
# 依赖的系统静态库
#s.library = 'c++', 'resolv'
# build setting中的配置
#s.ios.pod_target_xcconfig = { 'OTHER_LDFLAGS' => '-lObjC', 'ENABLE_BITCODE' => false, }
# 子库,会有不同的文件夹
#  s.subspec 'Sub' do | b |
#      b.source_files = 'Chat2Love/Classes/**/*'
#   end
# 引用其他的库,不建议样写,pod中引用framework文件会报错。
# s.ios.vendored_frameworks = 'Ali/Classes/AliRTCSdk.framework','Ali/Classes/UTDID.framework'
# 引用其他的库,建议写法
#  s.subspec 'AliRTC' do | sub_rtc |
#      sub_rtc.ios.vendored_frameworks = 'Ali/Classes/AliRTCSdk.framework','Ali/Classes/UTDID.framework'
#   end

Cocoapods之创建私有库

本文以创建名为"DCServices"的私有库为例。

  1. 打开任意终端工具,进入你的工作目录,输入命令 pod lib create DCServices,按照提示回答问题,即可完成lib项目的创建工作。
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
~ pod lib create DCServices                                                                                                                         
Cloning `https://github.com/CocoaPods/pod-template.git` into `DCServices`.
Configuring DCServices template.

------------------------------

To get you started we need to ask a few questions, this should only take a minute.

If this is your first time we recommend running through with the guide:
 - https://guides.cocoapods.org/making/using-pod-lib-create.html
 ( hold cmd and click links to open in a browser. )


What platform do you want to use?? [ iOS / macOS ]
ios

What language do you want to use?? [ Swift / ObjC ]
objc

Would you like to include a demo application with your library? [ Yes / No ]
yes

Which testing frameworks will you use? [ Specta / Kiwi / None ]
none

Would you like to do view based testing? [ Yes / No ]
no

What is your class prefix?
DC

Running pod install on your new library.

Analyzing dependencies
Downloading dependencies
Installing DCServices (0.1.0)
Generating Pods project
Integrating client project

[!] Please close any current Xcode sessions and use `DCServices.xcworkspace` for this project from now on.
Pod installation complete! There is 1 dependency from the Podfile and 1 total pod installed.

 Ace! you're ready to go!
 We will start you off by opening your project in Xcode
  open 'DCServices/Example/DCServices.xcworkspace'

To learn more about the template see `https://github.com/CocoaPods/pod-template.git`.
To learn more about creating a new pod, see `https://guides.cocoapods.org/making/making-a-cocoapod`.
  1. 创建完成后会自动打开Xcode工程,依次展开左侧列表 Pods > Development Pods > DCServices ,找到 ReplaceMe.m 文件后删除它。

制作一个CocoaPods私有库

创建pod库

在GitHub上创建一个空仓库,不要初始化。`PrivatePods 是你的私有库名字。如果已经初始化,下面创建lib要在对应的目录里执行。

1
https://github.com/your_github_name/PrivatePods.git
  1. 打开终端,进入到要建立私有库工程的目录,执行下面的命令 。执行命令过程中会询问几个问题,按自己所需回答。
1
pod lib create PrivatePods

创建完成后,会自动打开项目。