CocoaPods/CocoaPods — pull request #796 by dillonlucente (2013-02-13 18:24:30+00:00)
Title: Option to Preserve Resource Directory Structure

We found the need in the course of our development to maintain some resource directory structures, specifically with some mustache templates and html assets rendered in a UIWebView. When we use this in our base project it work fines with this structure, but when we try to turn it into a pod, the resources are flattened into the app's main directory.

What we did is add a new option called preserved_resource_directories that can be a directory, an array of directories, or a hash with keys that are the location of the directory in the filesystem and the values being the intended directory in the pod.

So we have something like:

s.resources = "assets/**/*"
s.preserved_resource_directories = "assets"

And that will keep the directory structure of the entire assets folder intact.

We could also do:

s.resources = "design/html/assets/**/*"
s.preserved_resource_directories = { "design/html/assets" => "assets" }

Which would map that deeply nested assets folder to an assets folder in the main bundle.

We tried this out both with a local pod and a remote private pod and it worked out well for us. We also tried to write a quick little integration test to make sure everything was ok.

We're not yet familiar with your entire codebase, so sorry if we built up something wrong.

--

We saw you guys were thinking about this (#743, #773) so if you're going to do your own solution, that's great. Just thought we'd throw this out there to see if you'd be receptive to it.