CocoaPods/CocoaPods — pull request #807 by dillonlucente (2013-02-20 21:14:50+00:00)
Title: Option to Preserve Resource Directory Structure

Alright, I'm going to try this again and hopefully make it clearer what we're trying to do...

We found the need in the course of our development to maintain some resource directory hierarchies, specifically with some html assets rendered in a UIWebView. When we use this in a base project it works fine with this structure, but when we try to turn that 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 that are the intended directory in the project.

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 /assets in the main bundle.

We tried this out both with a local pod and a remote private pod and it's working out well. We also wrote 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 incorrectly.

--

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.