CocoaPods 用于 "pod try" 命令的启发式方法是否记录在任何地方?



在CocoaPods v.0.29中,增加了'pod try'命令(参见http://blog.cocoapods.org/CocoaPods-0.29/)。来自文档(粗体强调我的):

换句话说,命令自动执行以下步骤:

  1. 在临时目录中签出Pod的源代码。
  2. 使用一些简单的启发式方法搜索任何看起来像演示项目的项目
  3. 如果项目需要,安装CocoaPods依赖项。
  4. 在Xcode中打开工作区/项目。

我搜索了Google和StackOverflow,但没有找到任何关于CocoaPods用于定位演示项目的具体启发式的文档。CocoaPods定位演示项目的过程,和/或包括演示项目和方案的最佳实践记录在任何地方吗?我正在把一个库放在一起,我希望很快变成一个CocoaPod,并希望确保我的示例项目实际上可以正确地与CocoaPod一起工作。

感谢您的宝贵时间。

我也在寻找这个,我得到的唯一的东西是pod-try插件的源代码:

# 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项目和有姊妹工作区的项目),并选择:

  1. 如果只找到一项,则为唯一项。
  2. 如果只找到一个这样的项目,那么唯一在filename中有"demo"或"example"的工作区。
  3. 唯一一个在文件名中有"demo"或"example"的项目,如果只有一个这样的项目。
  4. 没有,但是让您从找到的所有项目中选择。
如果有人对这个有更正-欢迎他们,因为我不是Ruby爱好者。

最新更新