Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CocoaPods explodes with PDF license files #2407

Closed
kylef opened this issue Aug 20, 2014 · 12 comments
Closed

CocoaPods explodes with PDF license files #2407

kylef opened this issue Aug 20, 2014 · 12 comments
Labels
d1:easy An easy ticket that is a good start for first-time contributors t2:defect These are known bugs. The issue should also contain steps to reproduce. PRs welcome!

Comments

@kylef
Copy link
Contributor

kylef commented Aug 20, 2014

Podspec

Pod::Spec.new do |spec|
  spec.name = 'SuisseIntl'
  spec.version = '1.0.0'
  spec.summary = nil
  spec.description = nil
  spec.license = { :type => 'Commercial', :file => 'Swiss-Typefaces-Font-Software-End-User-License-Agreement.pdf' }
  spec.authors = {}
  spec.homepage = 'https://github.com/CocoaPods-Fonts/SuisseIntl'
  spec.source = { :git => 'https://github.com/CocoaPods-Fonts/SuisseIntl.git', :tag => spec.version }
  spec.screenshot = "https://raw.githubusercontent.com/CocoaPods-Fonts/SuisseIntl/#{spec.version}/SuisseIntl-Screenshot.png"
  spec.platform = :ios
  spec.requires_arc = true
  spec.default_subspec = 'Font'

  spec.subspec 'Font' do |font_spec|
    font_spec.resource_bundle = { 'SuisseIntl' => 'Fonts/*.ttf' }
    font_spec.frameworks = 'UIKit', 'CoreText'
    font_spec.source_files = 'UIFont+SuisseIntl.{h,m}'
  end

  spec.subspec 'Tests' do |test_spec|
    test_spec.frameworks = 'XCTest'
    test_spec.source_files = 'SuisseIntlTests.m'
    test_spec.dependency 'SuisseIntl/Font'
  end
end

Podfile

platform :ios, '7.0'

target 'EatDrinkNap' do
  pod 'SuisseIntl', :path => 'Fonts/SuisseIntl'
end

target 'EatDrinkNapTests' do
  pod 'SuisseIntl/Tests', :path => 'Fonts/SuisseIntl'
end

Error

TypeError - Unable to convert value of key `:FooterText'.
/Users/kylef/gems/gems/cocoapods-0.33.1/lib/cocoapods/generator/acknowledgements/plist.rb:11:in `write_plist'
/Users/kylef/gems/gems/cocoapods-0.33.1/lib/cocoapods/generator/acknowledgements/plist.rb:11:in `save_as'
/Users/kylef/gems/gems/cocoapods-0.33.1/lib/cocoapods/installer/target_installer/aggregate_target_installer.rb:116:in `block (2 levels) in create_acknowledgements'
/Users/kylef/gems/gems/cocoapods-0.33.1/lib/cocoapods/user_interface.rb:113:in `message'
/Users/kylef/gems/gems/cocoapods-0.33.1/lib/cocoapods/installer/target_installer/aggregate_target_installer.rb:113:in `block in create_acknowledgements'
/Users/kylef/gems/gems/cocoapods-0.33.1/lib/cocoapods/installer/target_installer/aggregate_target_installer.rb:111:in `each'
/Users/kylef/gems/gems/cocoapods-0.33.1/lib/cocoapods/installer/target_installer/aggregate_target_installer.rb:111:in `create_acknowledgements'
/Users/kylef/gems/gems/cocoapods-0.33.1/lib/cocoapods/installer/target_installer/aggregate_target_installer.rb:21:in `block in install!'
/Users/kylef/gems/gems/cocoapods-0.33.1/lib/cocoapods/user_interface.rb:113:in `message'
/Users/kylef/gems/gems/cocoapods-0.33.1/lib/cocoapods/installer/target_installer/aggregate_target_installer.rb:14:in `install!'
/Users/kylef/gems/gems/cocoapods-0.33.1/lib/cocoapods/installer.rb:384:in `block (2 levels) in install_libraries'
/Users/kylef/gems/gems/cocoapods-0.33.1/lib/cocoapods/installer.rb:381:in `each'
/Users/kylef/gems/gems/cocoapods-0.33.1/lib/cocoapods/installer.rb:381:in `block in install_libraries'
/Users/kylef/gems/gems/cocoapods-0.33.1/lib/cocoapods/user_interface.rb:113:in `message'
/Users/kylef/gems/gems/cocoapods-0.33.1/lib/cocoapods/installer.rb:374:in `install_libraries'
/Users/kylef/gems/gems/cocoapods-0.33.1/lib/cocoapods/installer.rb:117:in `block in generate_pods_project'
/Users/kylef/gems/gems/cocoapods-0.33.1/lib/cocoapods/user_interface.rb:52:in `section'
/Users/kylef/gems/gems/cocoapods-0.33.1/lib/cocoapods/installer.rb:114:in `generate_pods_project'
/Users/kylef/gems/gems/cocoapods-0.33.1/lib/cocoapods/installer.rb:91:in `install!'
/Users/kylef/gems/gems/cocoapods-0.33.1/lib/cocoapods/command/project.rb:40:in `run_install_with_update'
/Users/kylef/gems/gems/cocoapods-0.33.1/lib/cocoapods/command/project.rb:70:in `run'
/Users/kylef/gems/gems/claide-0.6.1/lib/claide/command.rb:281:in `run'
/Users/kylef/gems/gems/cocoapods-0.33.1/lib/cocoapods/command.rb:48:in `run'
/Users/kylef/gems/gems/cocoapods-0.33.1/bin/pod:33:in `<top (required)>'
/Users/kylef/gems/bin/pod:23:in `load'
/Users/kylef/gems/bin/pod:23:in `<main>'
@alloy
Copy link
Member

alloy commented Aug 20, 2014

The only thing I think we should be doing here is to guard against not being able to read the license file and print an error.

As for the solution in this case, you can inline the license text in the spec or otherwise maybe add a plain text copy of the PDF to the repo?

@fabiopelosin
Copy link
Member

@alloy 👍 That attribute is definitely intended only for simple text files.

@segiddins
Copy link
Member

The only thing I think we should be doing here is to guard against not being able to read the license file and print an error.

Not sure it needs to be an error. We just should rescue exceptions when creating the metadata files.

@fabiopelosin
Copy link
Member

It should definitely be an error to inform the user that the acknowledgements file is incorrect, and in this case the podspec itself is incorrect.

@segiddins
Copy link
Member

How is the podspec incorrect?

@fabiopelosin
Copy link
Member

How is the podspec incorrect?

It is specifying a PDF file. The specified license file should be a simple text file (txt, markdown)... For example a picture of the license (e.g. jpg) would not be useful.

The purpose of this attribute in the specification is to allow to access the contents of the text of the license via the license file directly in order to generate the acknowledgment files. The docs could be more precise about simple text files to clear any doubt.

@orta orta changed the title CocoaPods exploses with PDF license files CocoaPods explodes with PDF license files Aug 21, 2014
@segiddins
Copy link
Member

So should the linter check that the file is a plain-text file?

@fabiopelosin
Copy link
Member

I would check for markdown or txt extension

@fabiopelosin
Copy link
Member

👍

The decision to support only those extensions is based on the following reasons:

  • They cover the almost all the license used in libraries.
  • We need plain text to convert to markdown (txt is simply not formatted which is fine)
  • I would prefer to keep this logic KISS (no HTML to text conversion or similar features)

@kylef
Copy link
Contributor Author

kylef commented Sep 11, 2014

Thanks, wasn't sure if it wasn't supported or it was a bug. 👍

@alloy
Copy link
Member

alloy commented Sep 11, 2014

It would be better to use e.g. the file tool with the --mime option, but as Core doesn’t actually need to have the files and Core doesn’t have Executable, we’re leaving it as is for now.

@fabiopelosin
Copy link
Member

@alloy I didn't know about file file --mime. Very nice, however according to the man pages there is too much magic within it 😉 and simple always triumphs magic.

Ashton-W pushed a commit to Ashton-W/Core that referenced this issue Nov 2, 2015
Closes CocoaPods/CocoaPods#2407

For now, only files with no extension or .txt, .md, or.markdown extensions are allowed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
d1:easy An easy ticket that is a good start for first-time contributors t2:defect These are known bugs. The issue should also contain steps to reproduce. PRs welcome!
Projects
None yet
Development

No branches or pull requests

4 participants