CocoaPods / cocoapods-acknowledgements

CocoaPods plugin that generates a plist which includes the installation metadata
MIT License
111 stars 17 forks source link

Add option to add plist to target or not #43

Open JustinFincher opened 7 years ago

JustinFincher commented 7 years ago

When I uses this plugin, I encountered a situation where the plist bundled in settings.bundle is better not added to target’s Copy Bundle Resources process.
So I made some changes to lib/cocoapods_acknowledgements.rb, and by settings :settings_bundle => true, :add_to_target => false, plist will not be automatically added to Copy Bundle Resources process.

orta commented 7 years ago

πŸ‘ Looks good, yeah, can you please add some tests and a CHANGELOG, then this is good to go - thanks!

JustinFincher commented 7 years ago

Hi, when I was doing local tests for my own project, I found that the new self.settings_bundle_in_project in the master branch won't return the full relative path.
For example, my own project has the following structure:

β”œβ”€β”€ Cetacea
β”‚Β Β  β”œβ”€β”€ Cetacea-iOS
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ Cetacea-iOS
β”‚Β Β  β”‚Β Β  β”‚Β Β  └── Settings.bundle
β”‚Β Β  β”‚Β Β  └── Cetacea-iOS.xcodeproj
β”‚Β Β  β”œβ”€β”€ Cetacea-Mac
β”‚Β Β  β”‚Β Β  └── Cetacea-Mac.xcodeproj
β”‚Β Β  β”œβ”€β”€ CetaceaSharedFramework
β”‚Β Β  β”‚Β Β  └── CetaceaSharedFramework.xcodeproj
β”‚Β Β  β”œβ”€β”€ Cetacea.xcworkspace
β”‚Β Β  β”œβ”€β”€ Podfile
β”‚Β Β  β”œβ”€β”€ Pods
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ Pods.xcodeproj

When I am using the https://github.com/CocoaPods/cocoapods-acknowledgements/commit/6469aeb39a9f23adc0f3361b7f711ee47b42b29e (tag 1.1.2), I got:

settings_bundle = Cetacea-iOS/Cetacea-iOS/Settings.bundle

When I am using the https://github.com/CocoaPods/cocoapods-acknowledgements/commit/eadb27752cb93f8d66c29eb9c4953971796961b9 commit, I got:

settings_bundle = Cetacea-iOS/Settings.bundle

I got no file or folder error:

Errno::ENOENT - No such file or directory @ rb_sysopen

My guess is that cocoapods's working folder is the root Cetacea folder, and when using the newest commit, file = project.files.find { |f| f.path =~ /Settings\.bundle$/ } returns the relative path from the project, not the root folder, so the path can't be accessed. So I revert back to the old self.settings_bundle_in_project method in https://github.com/SecondRenaissance/cocoapods-acknowledgements-inhouse/commit/eb5bc7b03274fbfb1fb1b7afdaec1be318929384.

imnosov commented 6 years ago

@orta Could you please merge this pull request?

orta commented 6 years ago

I wasn't sure if @JustinFincher was finished with it? happy to do so if he is

JustinFincher commented 6 years ago

The basic functionality is done. but I haven’t done the tests and changelog part because late on I abandoned my project 🀣. I will try to write some tests when I get home, and remove the install bash script as that script is only for my convenient use.

JustinFincher commented 6 years ago

@orta Hi, can you give me some examples about how to test this plugin? Because I found the repo seems doesn't have test files or patterns for me to follow. Should I provide a sample iOS project?

orta commented 6 years ago

I assume that I used to run it against my iOS projects, the no-tests is a shame yeah - you're welcome to add an example iOS app to work against

kdawgwilk commented 6 years ago

I just gave this branch a go on our project when master was failing to add the plist files with the correct path to the Xcode project and this fixed our issues πŸ‘ Maybe that is the testing you were needing?

kdawgwilk commented 6 years ago

Sorry I spoke too soon :( It appeared to fix the issue but after cleaning things up and running fresh I still had the same issues

jparise commented 1 year ago

I just proposed #65, which does something similar (makes project integration optional) by handling the installer's integrate_targets: false option.

If it's accepted, my change could further be extended with a plugin-level option to explicitly enable this behavior, which would match this PR, although the implicit behavior might be enough to handle most cases on its own.