目录
Commands
pod
Cocoa库包管理器。
Installation
这个组中列出的命令支持安装和集成Podfile中指定的依赖项。
下面是在用户项目中集成CocoaPods的基本工作流程。
$ touch Podfile
$ vim Podfile
$ pod install
$ open *.xcworkspace
$ vim podfile
$ pod install
$ pod outdated
$ pod update
Commands:
pod init
pod install
pod update
pod outdated
pod deintegrate
init
pod init XCODEPROJ
如果当前目录不存在,则为当前目录创建一个Podfile。如果指定了XCODEPROJ
项目文件,或者当前目录中只有一个项目文件,那么将根据项目中定义的目标自动生成目标。
可以在Podfile.default
(普通目标)Podfile中指定模板将使用的依赖项列表。Podfile.test
(测试目标),这些文件应该存储在/home/travis/.cocoapods/templates
文件夹。
继承的选项:
--silent 展示什么内容.
--version 展示工具的版本。.
--verbose 展示更多调试信息.
--no-ansi 展示输出不包含ANSI代码.
--help 展示帮助命令.
install
pod install
下载Podfile
中定义的所有依赖项,并在./Pods
中创建一个Xcode Pods库项目。
Xcode项目文件应该在你的Podfile中指定如下:
project `path/to/XcodeProject.xcodeproj`
如果没有指定项目,那么将对Xcode项目进行搜索。如果找到一个以上的Xcode项目,该命令将引发一个错误。
这将配置项目以引用Pods静态库,添加一个构建配置文件,并添加一个post构建脚本来复制Pod资源。
如果遇到问题,可能会返回几个错误代码中的一个。*1
通用错误代码*31
规格未找到(i。e失效的pod源,Pod名称错误等…)
选项:
--repo-update
Force running pod repo update before install.
--deployment
Disallow any changes to the Podfile or the Podfile.lock during installation.
--clean-install
Ignore the contents of the project cache and force a full pod installation. This only applies to projects that have enabled incremental installation.
--project-directory=/project/dir/
The path to the root of the project directory.
继承的选项:
--silent
Show nothing.
--version
Show the version of the tool.
--verbose
Show more debugging information.
--no-ansi
Show output without ANSI codes.
--help
Show help banner of specified command.
update
pod update [POD_NAMES ...]
更新由指定的POD_NAMES
标识的pod,它是一个以空格分隔的pod名称列表。如果没有指定pod_name
,它将更新所有pod,忽略Podfile.lock的内容。此命令用于更新依赖项;pod安装应该用于安装对Podfile的更改。
选项:
--sources=https://cdn.cocoapods.org/
The sources from which to update dependent pods. Multiple sources must be comma-delimited.
--exclude-pods=podName
Pods to exclude during update. Multiple pods must be comma-delimited.
--clean-install
Ignore the contents of the project cache and force a full pod installation. This only applies to projects that have enabled incremental installation.
--project-directory=/project/dir/
The path to the root of the project directory.
--no-repo-update
Skip running pod repo update before install.
继承的选项:
--silent
Show nothing.
--version
Show the version of the tool.
--verbose
Show more debugging information.
--no-ansi
Show output without ANSI codes.
--help
Show help banner of specified command.
outdated
pod outdated
显示当前pod中过时的Podfile.lock
,但是但仅限于规范回购,而非本地/外部来源。。
选项:
--project-directory=/project/dir/
The path to the root of the project directory.
--no-repo-update
Skip running pod repo update before install.
继承的选项:
--silent
Show nothing.
--version
Show the version of the tool.
--verbose
Show more debugging information.
--no-ansi
Show output without ANSI codes.
--help
Show help banner of specified command.
deintegrate
pod deintegrate
自v1.0.0.beta.1可用。
pod deintegrate [XCODE_PROJECT]
把你的项目从CocoaPods中分离出来。从Xcode项目中删除所有CocoaPods的痕迹。
如果未指定xcodeproj,则将在当前目录中搜索Xcode项目。
选项:
--project-directory=/project/dir/
The path to the root of the project directory.
继承的选项:
--silent
Show nothing.
--version
Show the version of the tool.
--verbose
Show more debugging information.
--no-ansi
Show output without ANSI codes.
--help
Show help banner of specified command.
Environment
环境
pod env
env
pod env
显示Pod环境.
继承的选项:
--silent
Show nothing.
--version
Show the version of the tool.
--verbose
Show more debugging information.
--no-ansi
Show output without ANSI codes.
--help
Show help banner of specified command.
Browse
浏览
pod search
pod list
pod try
search
自v0.0.2可用。
pod search QUERY
搜索pods,忽略case,它的名称、摘要、描述或作者匹配查询。如果指定了——simple
选项,这将只搜索仓库的名称。
选项:
--regex
Interpret the QUERY as a regular expression.
--simple
Search only by name.
--stats
Show additional stats (like GitHub watchers and forks).
--web
Searches on cocoapods.org.
--ios
Restricts the search to Pods supported on iOS.
--osx
Restricts the search to Pods supported on macOS.
--watchos
Restricts the search to Pods supported on watchOS.
--tvos
Restricts the search to Pods supported on tvOS.
--no-pager
Do not pipe search results into a pager.
继承选项:
--silent
Show nothing.
--version
Show the version of the tool.
--verbose
Show more debugging information.
--no-ansi
Show output without ANSI codes.
--help
Show help banner of specified command.
list
pod list
列出所有可用的pods.
选项:
--update
Run pod repo update before listing.
--stats
Show additional stats (like GitHub watchers and forks).
继承选项:
--silent
Show nothing.
--version
Show the version of the tool.
--verbose
Show more debugging information.
--no-ansi
Show output without ANSI codes.
--help
Show help banner of specified command.
try
自v0.29.0可用。
pod try NAME|URL
下载带有给定名称
(或Git URL)的Pod,根据需要安装它的依赖项并打开它的演示项目。如果提供了一个Git URL,则使用repo的头部。
如果指定了一个Git URL,那么可以提供一个——podspec_name
,如果podspec名称由于某种原因与Git repo不同。
选项:
--podspec_name=[name]
The name of the podspec file within the Git Repository.
--no-repo-update
Skip running pod repo update before install.
继承的选项:
--silent
Show nothing.
--version
Show the version of the tool.
--verbose
Show more debugging information.
--no-ansi
Show output without ANSI codes.
--help
Show help banner of specified command.
Specifications
pod spec create
pod spec lint
pod spec cat
pod spec which
pod spec edit
spec create
pod spec create [NAME|https://github.com/USER/REPO]
在当前工作目录中创建一个PodSpec,名为NAME.podspec。如果传递了一个GitHub url,spec就会被预填充。
继承的选项:
--silent
Show nothing.
--verbose
Show more debugging information.
--no-ansi
Show output without ANSI codes.
--help
Show help banner of specified command.
spec lint
pod spec lint [NAME.podspec|DIRECTORY|http://PATH/NAME.podspec ...]
验证NAME.podspec
。如果提供了目录
,它将验证找到的podspec文件,包括子文件夹。如果该参数被省略,它默认为当前工作目录。
选项:
--quick
Lint skips checks that would require to download and build the spec.
--allow-warnings
Lint validates even if warnings are present.
--subspec=NAME
Lint validates only the given subspec.
--no-subspecs
Lint skips validation of subspecs.
--no-clean
Lint leaves the build directory intact for inspection.
--fail-fast
Lint stops on the first failing platform or subspec.
--use-libraries
Lint uses static libraries to install the spec.
--use-modular-headers
Lint uses modular headers during installation.
--sources=https://cdn.cocoapods.org/
The sources from which to pull dependent pods (defaults to https://cdn.cocoapods.org/). Multiple sources must be comma-delimited.
--platforms=ios,macos
Lint against specific platforms (defaults to all platforms supported by the podspec). Multiple platforms must be comma-delimited.
--private
Lint skips checks that apply only to public specs.
--swift-version=VERSION
The SWIFT_VERSION that should be used to lint the spec. This takes precedence over the Swift versions specified by the spec or a .swift-version file.
--skip-import-validation
Lint skips validating that the pod can be imported.
--skip-tests
Lint skips building and running tests during validation.
--analyze
Validate with the Xcode Static Analysis tool.
继承的选项:
--silent
Show nothing.
--verbose
Show more debugging information.
--no-ansi
Show output without ANSI codes.
--help
Show help banner of specified command.
spec cat
pod spec cat [QUERY]
打印名称与标准输出匹配的podspec的内容。
选项:
--regex
Interpret the QUERY as a regular expression.
--show-all
Pick from all versions of the given podspec.
继承的选项:
--silent
Show nothing.
--verbose
Show more debugging information.
--no-ansi
Show output without ANSI codes.
--help
Show help banner of specified command.
spec which
pod spec which [QUERY]
打印名称与查询匹配的.podspec文件的路径
选项:
--regex
Interpret the QUERY as a regular expression.
--show-all
Print all versions of the given podspec.
继承的选项:
--silent
Show nothing.
--verbose
Show more debugging information.
--no-ansi
Show output without ANSI codes.
--help
Show help banner of specified command.
spec edit
pod spec edit [QUERY]
打开要编辑的podspec匹配查询。
选项:
--regex
Interpret the QUERY as a regular expression.
--show-all
Pick from all versions of the given podspec.
继承选项:
--silent
Show nothing.
--verbose
Show more debugging information.
--no-ansi
Show output without ANSI codes.
--help
Show help banner of specified command.
Trunk
pod trunk add-owner
pod trunk info
pod trunk me
pod trunk push
pod trunk register
pod trunk remove-owner
pod trunk deprecate
pod trunk delete
trunk add-owner
自V0.33.0可用。
pod trunk add-owner POD OWNER-EMAIL
将具有指定所有者电子邮件
的注册用户添加为给定POD的所有者。“所有者”是一个注册用户,允许对pod进行更改,比如推送新版本和添加或删除其他“所有者”。
继承的选项:
--silent
Show nothing.
--verbose
Show more debugging information.
--no-ansi
Show output without ANSI codes.
--help
Show help banner of specified command.
trunk info
自V0.33.0可用。
pod trunk info NAME
返回关于Pod的信息。
继承的选项:
--silent
Show nothing.
--verbose
Show more debugging information.
--no-ansi
Show output without ANSI codes.
--help
Show help banner of specified command.
trunk me
自V0.33.0可用。
pod trunk me
包括关于你的登记的信息,然后是你的所有会话。
这些会话包括当前会话、其他有效会话、未验证会话和过期会话。
继承的选项:
--silent
Show nothing.
--verbose
Show more debugging information.
--no-ansi
Show output without ANSI codes.
--help
Show help banner of specified command.
trunk push
自V0.33.0可用。
pod trunk push [PATH]
在PATH
上发布podspec,使其对“trunk”spec-repo的所有用户可用。如果没有提供路径,则默认为当前目录。
在将podspec推送到cocoapods.org之前,这将执行podspec的一个本地lint,包括一个库的构建。但是,您仍然有责任确保发布的podspec能够真正为您的用户工作。因此,建议您首先尝试使用podspec将该库集成到演示和/或实际应用程序中。
如果这是您第一次发布这个pod的规范,那么您将自动注册为这个pod的“所有者”。(注意,这里的“所有者”指的是允许发布新版本并添加其他“所有者”的人,不一定是库的作者。)
选项:
--allow-warnings
Allows push even if there are lint warnings.
--use-libraries
Linter uses static libraries to install the spec.
--use-modular-headers
Lint uses modular headers during installation.
--swift-version=VERSION
The SWIFT_VERSION that should be used to lint the spec. This takes precedence over a .swift-version file..
--skip-import-validation
Lint skips validating that the pod can be imported.
--skip-tests
Lint skips building and running tests during validation.
继承的选项:
--silent
Show nothing.
--verbose
Show more debugging information.
--no-ansi
Show output without ANSI codes.
--help
Show help banner of specified command.
trunk register
自V0.33.0可用。
pod trunk register EMAIL [YOUR_NAME]
注册一个新帐户,或创建一个新会话。
如果这是你的第一次注册,你的电子邮件地址和你的名字都是必须的。如果您已经在trunk上注册了,您可以省略YOUR_NAME(除非您想更改它)。
建议您提供会话的描述,以便以后更容易识别。例如,当您想清理会话时。一个常见的示例是指定您正在使用会话的机器的物理位置。
例如:
$ pod trunk register eloy@example.com `Eloy Durán` --description=`Personal Laptop`
$ pod trunk register eloy@example.com --description=`Work Laptop`
$ pod trunk register eloy@example.com
选项:
--description=DESCRIPTION
An arbitrary description to easily identify your session later on..
继承选项:
--silent
Show nothing.
--verbose
Show more debugging information.
--no-ansi
Show output without ANSI codes.
--help
Show help banner of specified command.
trunk remove-owner
自V0.33.0可用。
pod trunk remove-owner POD OWNER-EMAIL
删除具有指定所有者电子邮件的用户,使其不再是给定POD的所有者。“所有者”是一个注册用户,允许对pod进行更改,比如推送新版本和添加或删除其他“所有者”。
继承的选项:
--silent
Show nothing.
--verbose
Show more debugging information.
--no-ansi
Show output without ANSI codes.
--help
Show help banner of specified command.
trunk deprecate
自v1.0.0.beta.1可用。
pod trunk deprecate NAME
弃用某个pod。
选项:
--in-favor-of=OTHER_NAME
The pod to deprecate this pod in favor of..
继承选项:
--silent
Show nothing.
--verbose
Show more debugging information.
--no-ansi
Show output without ANSI codes.
--help
Show help banner of specified command.
trunk delete
自v1.0.0.beta.1可用。
pod trunk delete NAME VERSION
警告:删除别人依赖的Pod版本通常被认为是不良行为!请考虑使用deprecate命令。
从trunk和master specs repo中删除指定的pod版本。一旦删除,这个版本就不能再推了。
继承的选项:
--silent
Show nothing.
--verbose
Show more debugging information.
--no-ansi
Show output without ANSI codes.
--help
Show help banner of specified command.
Repos
pod repo add
pod repo add-cdn
pod repo update
pod repo lint
pod repo list
pod repo remove
pod repo push
pod setup
repo add
pod repo add NAME URL [BRANCH]
克隆位于/home/travis/.cocoapods/repos
的本地spec repos目录中的URL
。以后可以按名称引用远程服务器。
选项:
--progress
Show the progress of cloning the spec repository.
继承选项:
--silent
Show nothing.
--verbose
Show more debugging information.
--no-ansi
Show output without ANSI codes.
--help
Show help banner of specified command.
repo add-cdn
pod repo add-cdn NAME URL
将URL添加到本地spec repos目录/home/travis/.cocoapods/repos。以后可以按名称引用远程服务器。
继承的选项:
--silent
Show nothing.
--verbose
Show more debugging information.
--no-ansi
Show output without ANSI codes.
--help
Show help banner of specified command.
repo update
pod repo update [NAME]
更新规范repo名称的本地克隆。如果省略名称,则将更新/home/travis/.cocoapods/repos中的所有规范repo。
继承选项:
--silent
Show nothing.
--verbose
Show more debugging information.
--no-ansi
Show output without ANSI codes.
--help
Show help banner of specified command.
repo lint
pod repo lint [NAME|DIRECTORY]
Lints规范repo名称。如果提供了目录,则假定该目录是repo的根目录。最后,如果没有提供名称,这将删除CocoaPods已知的所有spec repo。
选项:
--only-errors
Lint presents only the errors.
继承的选项:
--silent
Show nothing.
--verbose
Show more debugging information.
--no-ansi
Show output without ANSI codes.
--help
Show help banner of specified command.
repo list
pod repo list
从/home/travis/.cocoapods/repos的本地spec repos目录中列出repos。
选项:
--count-only
Show the total number of repos.
继承的选项:
--silent
Show nothing.
--verbose
Show more debugging information.
--no-ansi
Show output without ANSI codes.
--help
Show help banner of specified command.
repo remove
pod repo remove NAME
从/home/travis/.cocoapods/repos的本地spec repos目录中删除远程命名名称。
继承的选项:
--silent
Show nothing.
--verbose
Show more debugging information.
--no-ansi
Show output without ANSI codes.
--help
Show help banner of specified command.
repo push
pod repo push REPO [NAME.podspec]
验证NAME.podspec
或当前工作目录中的*.podspec
,在REPO
的本地副本(/home/travis/.cocoapods/repos/[REPO])中为pod创建一个目录和版本文件夹,将podspec文件复制到版本目录中,最后将REPO推送到远程。
选项:
--allow-warnings
Allows pushing even if there are warnings.
--use-libraries
Linter uses static libraries to install the spec.
--use-modular-headers
Lint uses modular headers during installation.
--sources=https://cdn.cocoapods.org/
The sources from which to pull dependent pods (defaults to all available repos). Multiple sources must be comma-delimited.
--local-only
Does not perform the step of pushing REPO to its remote.
--no-private
Lint includes checks that apply only to public repos.
--skip-import-validation
Lint skips validating that the pod can be imported.
--skip-tests
Lint skips building and running tests during validation.
--commit-message="Fix bug in pod"
Add custom commit message. Opens default editor if no commit message is specified.
--use-json
Convert the podspec to JSON before pushing it to the repo.
--swift-version=VERSION
The SWIFT_VERSION that should be used when linting the spec. This takes precedence over the Swift versions specified by the spec or a .swift-version file.
--no-overwrite
Disallow pushing that would overwrite an existing spec.
继承的选项:
--silent
Show nothing.
--verbose
Show more debugging information.
--no-ansi
Show output without ANSI codes.
--help
Show help banner of specified command.
setup
pod setup
设置CocoaPods环境。
继承的选项:
--silent
Show nothing.
--version
Show the version of the tool.
--verbose
Show more debugging information.
--no-ansi
Show output without ANSI codes.
--help
Show help banner of specified command.
Libraries
pod lib create
pod lib lint
lib create
pod lib create NAME
根据CocoaPods的最佳实践,创建一个用于开发名为NAME的新Pod的仓库。如果指定了包含兼容模板的git repo的模板URL,则将使用该URL代替默认的模板URL。
选项:
--template-url=URL
The URL of the git repo containing a compatible template.
继承的选项:
--silent
Show nothing.
--verbose
Show more debugging information.
--no-ansi
Show output without ANSI codes.
--help
Show help banner of specified command.
lib lint
pod lib lint [PODSPEC_PATHS ...]
使用工作目录中的文件验证Pod。
选项:
--quick
Lint skips checks that would require to download and build the spec.
--allow-warnings
Lint validates even if warnings are present.
--subspec=NAME
Lint validates only the given subspec.
--no-subspecs
Lint skips validation of subspecs.
--no-clean
Lint leaves the build directory intact for inspection.
--fail-fast
Lint stops on the first failing platform or subspec.
--use-libraries
Lint uses static libraries to install the spec.
--use-modular-headers
Lint uses modular headers during installation.
--sources=https://cdn.cocoapods.org/
The sources from which to pull dependent pods (defaults to https://cdn.cocoapods.org/). Multiple sources must be comma-delimited.
--platforms=ios,macos
Lint against specific platforms (defaults to all platforms supported by the podspec). Multiple platforms must be comma-delimited.
--private
Lint skips checks that apply only to public specs.
--swift-version=VERSION
The SWIFT_VERSION that should be used to lint the spec. This takes precedence over the Swift versions specified by the spec or a .swift-version file.
--include-podspecs=**/*.podspec
Additional ancillary podspecs which are used for linting via :path.
--external-podspecs=**/*.podspec
Additional ancillary podspecs which are used for linting via :podspec. If there are --include-podspecs, then these are removed from them.
--skip-import-validation
Lint skips validating that the pod can be imported.
--skip-tests
Lint skips building and running tests during validation.
--analyze
Validate with the Xcode Static Analysis tool.
继承的选项:
--silent
Show nothing.
--verbose
Show more debugging information.
--no-ansi
Show output without ANSI codes.
--help
Show help banner of specified command.
IPC
pod ipc repl
pod ipc spec
pod ipc podfile
pod ipc podfile-json
pod ipc list
pod ipc update-search-index
ipc repl
pod ipc repl
repl监听标准输入上的命令,并将它们的结果输出到标准输出。它接受所有其他ipc子命令。repl将用ASCII CR+LF \n\r
来表示输出的结束。
选项:
--project-directory=/project/dir/
The path to the root of the project directory.
继承选项:
--silent
Show nothing.
--verbose
Show more debugging information.
--no-ansi
Show output without ANSI codes.
--help
Show help banner of specified command.
ipc spec
pod ipc spec PATH
将podspec转换为JSON并将其打印到STDOUT。
继承的选项:
--silent
Show nothing.
--verbose
Show more debugging information.
--no-ansi
Show output without ANSI codes.
--help
Show help banner of specified command.
ipc podfile
pod ipc podfile PATH
将Podfile转换为YAML并将其打印到STDOUT。
选项:
--project-directory=/project/dir/
The path to the root of the project directory.
继承的选项:
--silent
Show nothing.
--verbose
Show more debugging information.
--no-ansi
Show output without ANSI codes.
--help
Show help banner of specified command.
ipc podfile-json
pod ipc podfile-json PATH
将Podfile转换为JSON并将其打印到STDOUT。
选项:
--project-directory=/project/dir/
The path to the root of the project directory.
继承选项:
--silent
Show nothing.
--verbose
Show more debugging information.
--no-ansi
Show output without ANSI codes.
--help
Show help banner of specified command.
ipc list
pod ipc list
打印到STDOUT一个YAML字典,其中键是规范的名称,每个对应的值是一个具有以下键的字典:-在文件中定义的-version-authors-summary-description-platforms
继承的选项:
--silent
Show nothing.
--verbose
Show more debugging information.
--no-ansi
Show output without ANSI codes.
--help
Show help banner of specified command.
ipc update-search-index
pod ipc update-search-index
更新搜索索引并将其路径打印到标准输出。搜索索引是一个YAML编码的字典,其中键是Pods的名称,值是一个包含以下信息的字典:- version - summary - description - authors
继承的选项:
--silent
Show nothing.
--verbose
Show more debugging information.
--no-ansi
Show output without ANSI codes.
--help
Show help banner of specified command.
Plugins
pod plugins list
pod plugins search
pod plugins installed
pod plugins create
pod plugins publish
plugins list
pod plugins list
列出所有已知的插件(根据github.com/CocoaPods/cocoapods-plugins)
继承的选项:
--silent
Show nothing.
--verbose
Show more debugging information.
--no-ansi
Show output without ANSI codes.
--help
Show help banner of specified command.
plugins search
pod plugins search QUERY
搜索其是否包含名称
的插件
。查询是一个正则表达式,忽略大小写。
使用——full
,它还可以根据作者
和描述
进行搜索。
选项:
--full
Search by name, author, and description.
继承的选项:
--silent
Show nothing.
--verbose
Show more debugging information.
--no-ansi
Show output without ANSI codes.
--help
Show help banner of specified command.
plugins installed
pod plugins installed
列出所有已安装的插件及其各自的版本。
继承的选项:
--silent
Show nothing.
--verbose
Show more debugging information.
--no-ansi
Show output without ANSI codes.
--help
Show help banner of specified command.
plugins create
pod plugins create NAME [TEMPLATE_URL]
根据CocoaPods的最佳实践,创建一个名为NAME
的新插件开发框架。
如果指定了指向包含兼容模板的git repo的TEMPLATE_URL
,则将使用它来替代默认模板。
继承的选项:
--silent
Show nothing.
--verbose
Show more debugging information.
--no-ansi
Show output without ANSI codes.
--help
Show help banner of specified command.
plugins publish
pod plugins publish
这个命令只对CocoaPods插件的开发者有用。
它打开一个新的GitHub问题,请求将当前正在开发的插件添加到官方插件列表中。
当前目录应该有一个(而且只有一个).gemspec文件描述CocoaPods插件gem。
继承的选项:
--silent
Show nothing.
--verbose
Show more debugging information.
--no-ansi
Show output without ANSI codes.
--help
Show help banner of specified command.
Cache
pod cache list
pod cache clean
cache list
pod cache list [NAME]
将pods缓存的内容显示为按pod组织的YAML树输出。如果给出了名称,那么输出中只会包含该pod的缓存。
选项:
--short
Only print the path relative to the cache root.
继承的选项:
--silent
Show nothing.
--verbose
Show more debugging information.
--no-ansi
Show output without ANSI codes.
--help
Show help banner of specified command.
cache clean
pod cache clean [NAME]
删除给定pod的缓存,或者完全清除缓存。
如果请求的pod的不同版本有多个缓存,您将被询问要清除哪个缓存。使用——all来清洗它们。
如果没有给出pod名称,则需要指定——all标志(这是为了避免错误地清除所有缓存)。
选项:
--all
Remove all the cached pods without asking.
继承的选项:
--silent
Show nothing.
--verbose
Show more debugging information.
--no-ansi
Show output without ANSI codes.
--help
Show help banner of specified command.
网友评论