32

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.

asked Sep 3, 2013 at 21:22

2 Answers 2

46

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.

answered Sep 3, 2013 at 22:40
Sign up to request clarification or add additional context in comments.

Comments

10

CocoaPods source_files

[CocoaPods]

spec.source_files = 'Classes/**/*.{h,m,swift}', 'More_Classes/**/*.{h,m,swift}'

File patterns:

  • * - Matches any file.
  • ** - Matches directories recursively.
  • ? - Matches any one character.
  • [set] - Matches any one character in set.
  • {p,q} - Matches either literal p or literal q.
  • \ - Escapes the next meta-character.
answered Dec 9, 2019 at 22:49

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.