启发式CocoaPods是否用于“ pod try”广告活动?命令记录在任何地方? [英] Is the heuristic CocoaPods uses for the "pod try" command documented anywhere?
问题描述
在CocoaPods v.0.29中,添加了 pod try命令(请参见 http:// blog .cocoapods.org / CocoaPods-0.29 / )。从文档中开始(粗体强调):
In CocoaPods v.0.29, the 'pod try' command was added (see http://blog.cocoapods.org/CocoaPods-0.29/). From the documentation (bold emphasis mine):
换句话说,该命令将自动执行以下步骤:
In other words the command automates the following steps:
- 在临时目录中签出Pod的来源。
- 使用一些简单的搜索任何类似于演示项目的项目启发式。
- 如果找到的项目需要,请安装任何CocoaPods依赖项。
- 在Xcode中打开工作区/项目。
- Checkout the source of the Pod in a temporary directory.
- Search for any project looking like a demo project using some simple heuristics.
- Install any CocoaPods dependencies if needed by the located project.
- Open the workspace/project in Xcode.
我已经搜索了Google和StackOverflow,却找不到任何有关特定启发式的文档CocoaPods用于定位演示项目。 CocoaPods查找演示项目的过程和/或包括演示项目和计划的最佳实践是否记录在任何地方?我正在整理一个图书馆,希望很快将其变成CocoaPod,并希望确保我的示例项目可以与CocoaPods一起正常使用。
I've searched both Google and StackOverflow and have not been able to find any documentation about the specific heuristics that CocoaPods uses to locate a demo project. Is the process by which CocoaPods locates a demo project, and/or best practices for including a demo project and scheme documented anywhere? I am putting together a library which I hope to turn into a CocoaPod soon, and would like to ensure that my sample project will actually work correctly with CocoaPods.
谢谢您的时间。
推荐答案
我也在寻找这个,而我唯一得到的就是pod-try插件的来源:
I was looking for this as well and the only thing I got was the source of the pod-try plugin:
# Picks a project or workspace suitable for the demo purposes in the
# given directory.
#
# To decide the project simple heuristics are used according to the name,
# if no project is found this method raises and `Informative` otherwise
# if more than one project is found the choice is presented to the user.
#
# @param [#to_s] dir
# The path where to look for projects.
#
# @return [String] The path of the project.
#
def pick_demo_project(dir)
projs = projects_in_dir(dir)
if projs.count == 0
raise Informative, 'Unable to find any project in the source files' \
" of the Pod: `#{dir}`"
elsif projs.count == 1
projs.first
elsif (workspaces = projs.grep(/(demo|example).*\.xcworkspace$/i)).count == 1
workspaces.first
elsif (projects = projs.grep(/demo|example/i)).count == 1
projects.first
else
message = 'Which project would you like to open'
selection_array = projs.map do |p|
Pathname.new(p).relative_path_from(dir).to_s
end
index = choose_from_array(selection_array, message)
projs[index]
end
end
我不了解Ruby,但似乎它会获得所有XCode项目的列表/工作区(Pods项目和具有姊妹工作区的项目除外)并选择:
I don't know Ruby, but seems that it gets the list of all XCode projects/workspaces (except the Pods project and the projects that have a sister workspace) and picks:
- 只有一个项目存在。
- 如果只有一个这样的项目,则唯一的文件名中包含 demo或 example的工作区。
- 唯一的项目具有 demo或 example如果只有一个这样的项目,则在文件名中显示 demo或 example。
- 什么也没有,但让我们从找到的所有项目中进行选择。
- The only item if there's only one item found.
- The only workspace that has "demo" or "example" in filename if there's only one such item found.
- The only project that has "demo" or "example" in filename if there's only one such item found.
- Nothing, but let's you choose from all the items found.
如果有人对此有更正-他们会受到欢迎,因为我不是Ruby家伙。
If somebody has corrections to this - they're welcomed, as I'm no Ruby guy.
这篇关于启发式CocoaPods是否用于“ pod try”广告活动?命令记录在任何地方?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!