Cocoapods: pod spec lint cannot find my LICENSE file

Created on 8 Sep 2012  Β·  11Comments  Β·  Source: CocoaPods/CocoaPods

I'm trying to get my first podspec working and, no matter what I try, pod spec lint refuses to find my LICENSE file.

It's at the same project level as the podspec (but I've also tried putting it in the with the sources). I've tried using the default (no :file) behaviour as well as specifiying :file => "LICENSE". I've also tried it as LICENSE.md to match other working pods I found.

As far as I can see the lint provides no useful information about _why_ it can't find it, esp. since the given path is in /tmp so I'm really trying to figure out why it's not being copied in the first place.

Any help would be much appreciated.

Kind regards,

Matt

Shaddam:Gen matt$ pod spec lint Gen.podspec

-> Gen
――― MARKDOWN TEMPLATE ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

Report

  • What did you do?
  • What did you expect to happen?
  • What happened instead?

    Stack

   CocoaPods : 0.13.0
        Ruby : ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin12.1.0]
    RubyGems : 1.8.24
        Host : Mac OS X 10.8.1 (12B19)
       Xcode : 4.4.1 (4F1003)
Ruby lib dir : /Volumes/Corrino/matt/.rvm/rubies/ruby-1.9.3-p194/lib
Repositories : local - /Volumes/Corrino/matt/Projects/cocoapodspecs @ 5fe14089e06c449e836c137d9b484ce559d39ccc
               master - https://github.com/CocoaPods/Specs.git @ 96b627752ea05ff9b33c24dc7dfb21b310e56393

Error

No such file or directory - /tmp/CocoaPods/Lint/Pods/Gen/LICENSE.md
/Volumes/Corrino/matt/.rvm/gems/ruby-1.9.3-p194/gems/cocoapods-0.13.0/lib/cocoapods/local_pod.rb:318:in `read'
/Volumes/Corrino/matt/.rvm/gems/ruby-1.9.3-p194/gems/cocoapods-0.13.0/lib/cocoapods/local_pod.rb:318:in `license_text'


Most helpful comment

I see two possible issues:

  1. You added the License file after you've added the tag but you didn't delete and added the tag to the later commit so the 1.0 tag still points to a commit without the file. Your test of checking out the head and the switching to the commit with the tag would not work because git would not delete the file.
  2. The git cache of CocoaPods still contains the old tag so it doesn't updates. This is an edge case because you modified the tag. Running pod spec lint --verbose [Name].podspec will print all the git commands used by cocoapods in one you should see the path of the cache. Remove it.

All 11 comments

Did you commit the file to the repo? Because it does not do a simple copy, it actually clones from the current dir. So if the file is not in the repo, it wonβ€˜t show up in the tmp build dir. Btw, you can pass the --no-clean option to leave the tmp build dir in tact so you can inspect it.

Originally I hadn't, I was assuming it copied. But after inspecting what was going on I realised it did a clone so I added the LICENSE and committed. But that seemed to make no difference.

Now that I've used --no-clean I can see that the LICENSE file isn't there. But that's puzzling because it's in the repo and the tag that I am using...

I just checked out a clean clone (of my pushed repo) and switched to the 1.0 tag and the LICENSE file is definitely there. I'm puzzled why it's not there when pod lint tries it.

Okay well I am still getting this error with 0.14RC2. I assume it's something I've done wrong in my repo although I can't see what.

Okay so when I look at what files lint is using it's not the complete set of files from the repo but it's also not just the source files since README.md is there. So what rule is allowing README.md to appear, but not LICENSE?

Pod::Spec.new do |s|
s.name = "Gen"
s.version = "1.0"
s.summary = "Code generator for creating Objective-C code."
s.description = <<-DESC
Gen is a code generating framework for creating Objective-C and based on modelling
classes, protocols, methods, properties, etc.. using Gen classes. The final result
being converted into .m/.h files.
DESC
s.homepage = "https://github.com/mmower/Gen"
s.license = 'BSD'
s.author = { "Matt Mower" => "[email protected]" }
s.source = { :git => "https://github.com/mmower/Gen.git", :tag => "1.0" }
s.ios.deployment_target = '5.0'
s.osx.deployment_target = '10.7'
s.source_files = 'Gen', 'Gen/*_/_.{h,m}'
s.requires_arc = true
end

I see two possible issues:

  1. You added the License file after you've added the tag but you didn't delete and added the tag to the later commit so the 1.0 tag still points to a commit without the file. Your test of checking out the head and the switching to the commit with the tag would not work because git would not delete the file.
  2. The git cache of CocoaPods still contains the old tag so it doesn't updates. This is an edge case because you modified the tag. Running pod spec lint --verbose [Name].podspec will print all the git commands used by cocoapods in one you should see the path of the cache. Remove it.

Originally I hadn't, I was assuming it copied. But after inspecting what was going on I realised it did a clone so I added the LICENSE and committed. But that seemed to make no difference.

After checking your repo I'm pretty confident that is the cache of CocoaPods that it is using the old 1.0 tag. just removing it should solve the issue. I'm sorry for the issues that you experienced with it.

Interesting lib btw, do you have any cool usage example?

Thanks Fabio that did, indeed, turn out to be the problem. I deleted the cache and now the lint check passes fine.

I use Gen in my other library Statec which is an Objective-C state machine builder. There's an old version of Statec on github at the moment. Now that I've extract Gen I will be uploading the new version :)

Thanks again for the assist.

Kind regards,

Matt

There's an old version of Statec on github at the moment. Now that I've extract Gen I will be uploading the new version :)

Sounds cool!

I ran into this issue with a local pod I was testing, as it turns out the podspec was pointing to JUST a place that contained the podspec file and not the entire sourcecode tree which was the problem. Hopefully this helps someone out down the road.

I think the solution is to change the license filename to 'BSD'. I had a similar problem trying to use the 'MIT' license. Changing the filename to 'MIT' fixed it for me.

Was this page helpful?
0 / 5 - 0 ratings