Preserve folder structure Cocoa Pods

戏子无情 提交于 2019-12-04 17:45:39

问题


I have create a simple and private pod with this tutorial: http://pablin.org/2013/05/18/cocoapods-for-internal-libraries/

In fact my repo has just a group of classes

All is ok and I can install my pod perfectly. The only problem is all files are installed inside of the main folder so it doesn't preserve the folder structure.

I have this folder structure, repository named: myRepository

 Classes 
 |
 ------ foo.h and foo.m
 ------ Controller Layer
        |
        ----------- foo2.h and foo2.m
 ------ ViewLayer
        |
        ----------- foo3.h and foo3.m

All files are copied inside of a folder called myRepository.

This is my podspec:

Pod::Spec.new do |s|

  s.name         = "fooClasses"
  s.version      = "0.0.1"
  s.summary      = "Common clases of foo"

  s.homepage     = "http://foo.com"

  s.license      = 'BSD'
  s.license      = { :type => 'Foo License', :file => 'LICENSE.txt' }

  s.author       = { "me" => "me@me.com" }

  s.platform     = :ios, '7.0'

  s.source       = { :git => "https://github.com/myRepository.git", :tag => "0.0.1" }

  s.source_files  = "**/*.{h,m}"

  s.requires_arc = true
end

I have tried with s.preserve_path = "*" and s.preserve_path = "Classes"

Any idea?

Thanks!!!!!!!!


回答1:


Well I have achieved to create my own folders with subspec.

You can create a subspec with this line:

s.subspec 'folder name' do |ss|
    ss.source_files = 'files'
    ss.frameworks = 'frameworks'
end

The ss.frameworks is not mandatory.

You can see the complete answer from the CocoaPods mail list:

https://groups.google.com/forum/#!topic/cocoapods/0kV8r2xnqA8

Thanks mcitrrus

I preferred to follow the AFNetworking pod spec:

https://github.com/AFNetworking/AFNetworking/blob/master/AFNetworking.podspec




回答2:


This answer/question is outdated due to changes made in the 0.36 version of cocoapods.

PR 2647 added default grouping behaviour as long as you are using a ":path" pod. As of 1.3.1 the behaviour is that it will traverse the /Classes/... structure until it sees either a file or a second subfolder and start grouping from there in the .xcodeproj file.



来源:https://stackoverflow.com/questions/21168826/preserve-folder-structure-cocoa-pods

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!