Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

include files recursively in Cocoapods podspec

Tags:

cocoapods

I want to create a local podspec that is based on some private code. I can't seem to use the 'source' attribute, as that is not working. I can use the 'source_files' attribute, but it does not include files recursively. So with a directory that looks like this

Library   /src     /Core     /Audio     /Graphics 

And my podspec looks like this:

Pod::Spec.new do |s|   ...   s.source = 'src' # this does not work.   s.source_files = 'src' # this only includes the files in src, and not in any of the Core, Audio or Graphics folders. 

I kind of want to specify a '-r' flag. I have tried using wildcards but no luck.

like image 715
Ying Avatar asked Sep 03 '13 21:09

Ying


People also ask

What is Podspec in CocoaPods?

A Podspec, or Spec, describes a version of a Pod library. One Pod, over the course of time, will have many Specs. It includes details about where the source should be fetched from, what files to use, the build settings to apply, and other general metadata such as its name, version, and description.

What is Podspec file?

All Pods have a podspec file. A podspec, as its name suggests, defines the specifications of the Pod! Now let's make one: To create a Podspec, navigate to your project file in the Terminal. Run the following command to create the file: touch FantasticView.


1 Answers

The source_files attribute uses Ruby file glob syntax. The pattern must be relative to the root of your project (i.e., the podspec file), so this should work for you:

s.source_files = 'Library/src/**/*.{h,m}' 

The source attribute is not for source code files, but rather for the remote repository from which the code should be retrieved (most commonly a Git repository URL and tag). See the CocoaPods specification docs for more info.

like image 170
Adam Sharp Avatar answered Sep 21 '22 21:09

Adam Sharp