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

Is there a way to ignore existing Podfile? #33

Open
grigorye opened this issue Aug 12, 2019 · 6 comments
Open

Is there a way to ignore existing Podfile? #33

grigorye opened this issue Aug 12, 2019 · 6 comments

Comments

@grigorye
Copy link

grigorye commented Aug 12, 2019

I'm currently in progress of working on a module inside a big project. The module is kept in a subfolder of the root where the project Podfile is located. I'm not interested at the moment in integration with the project. However when I do pod gen in the subfolder, it detects the Podfile at the upper level and tries to interpret it, producing some warnings (irrelevant to the module I work on/potentially triggered due to loading Podfile multiple times) and actually misbehaving e.g. by outputting Open subfolder/gen/Module/Module.xcworkspace to work on Module (i.e. path is relative to Podfile not to the current directory).

The workaround for me is to rename Podfile to e.g. Podfile.ignored. But it would be great to have a way to ignore the Podfile by specifying e.g. --no-use-podfile or something like that. Probably I miss something (I'm not experienced with Ruby gems/command line option parsers).

@grigorye grigorye changed the title Is there a way to ignore Podfile? Is there a way to ignore existing Podfile? Aug 12, 2019
@segiddins
Copy link
Contributor

--no-use-podfile should work

@grigorye
Copy link
Author

grigorye commented Oct 25, 2019

--no-use-podfile should work

Unfortunately it doesn't.

$ bundle show cocoapods
/Users/gentin/.transient/bundle/vendor/gems/cocoapods-1.8.4
$ bundle show cocoapods-generate
/Users/gentin/.transient/bundle/vendor/gems/cocoapods-generate-1.6.0
$ cat Gemfile
# frozen_string_literal: true

source "https://rubygems.org"

git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }

# gem "rails"

gem "cocoapods-generate", "~> 1.6"

gem "cocoapods", "~> 1.8"
$ ls
Example/		Gemfile.lock		Module/			README.md
Gemfile			LICENSE			Module.podspec		_Pods.xcodeproj@
$ ls ..
Module/		Podfile
$ cat ../Podfile
bar
$ bundle exec pod gen --no-use-podfile
[in /Users/gentin/tmp/no-use-podfile]
[!] Error computing podfile,
[!] Invalid `Podfile` file: undefined local variable or method `bar' for #<Pod::Podfile:0x00007ff549863b48>.

 #  from /Users/gentin/tmp/no-use-podfile/Podfile:1
 #  -------------------------------------------
 >  bar
 #  -------------------------------------------
....
$ mv ../Podfile ../Podfile.bak
$ bundle exec pod gen --no-use-podfile

Generating Module in `gen/Module`
Open `gen/Module/Module.xcworkspace` to work on Module

@grigorye
Copy link
Author

Btw, the workaround that I ended up using is creating (empty) Podfile in the same directory as the podspec.

@segiddins
Copy link
Contributor

In that example, it doesn’t look like you’re actually passing the flag?

@grigorye
Copy link
Author

grigorye commented Oct 25, 2019

@segiddins Uh, sorry, it was my error during "copy-pasting", it had --no-use-podfile in all invocations - corrected the example. (Just in case, I checked/redid it again).

This is the script of the invocations:

mkdir no-use-podfile
cd no-use-podfile/

# I use (brewed) cocoapods to create the module from standard template; confirm the defaults when asked.
pod lib create Module

# Make "bad" Podfile to illustrate the problem
echo bar > Podfile
cd Module/
# Bundle "recent" cocoapods/cocoapods-generate
bundle init
bundle add cocoapods
bundle add cocoapods-generate
# Try first, this fails due to usage of (bad) Podfile (that is the problem)
bundle exec pod gen --no-use-podfile

# Illustrate the workaround
mv ../Podfile ../Podfile.bak
# This succeeds
bundle exec pod gen --no-use-podfile

# This illustrates another workaround (empty Podfile alongside .podspec)
mv ../Podfile.bak ../Podfile
echo > Podfile
# This succeeds, because (empty) Podfile is "consulted" (instead of one in the parent directory)
bundle exec pod gen --no-use-podfile

@yuhanle
Copy link

yuhanle commented Oct 30, 2020

I need --no-use-podfile too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants