question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

feat: configurable `pod` command / try local `bundle exec pod`

See original GitHub issue

Feature Request

Description

Some projects may chose to not install pod globally, but locally via bundle. In this case, pod is normally not in the $PATH. However, it would be accessible via bundle exec pod.

Because cap expects pod to be accessible from the $PATH, any command using pod would fail with that setup.

Currently we work around this in our project by generating a binstub for pod (bundle binstubs cocoapods) and adding it to the $PATH using an .envrc file like this:

# Add the gem binstubs directory to `PATH`.
export PATH="$PWD/bin:$PATH"

Platform(s)

macOS / iOS

Preferred Solution

Not entirely sure.

It would be nice, if the command for pod could be configured or alternatively the path to the bin could be configured explicitly. Both solutions could be supported simultaneously. I would not put this in the capacitor.config.json, but rather add a capacitor key to the package.json:

{
  "capacitor": {
    "pod": "bundle exec pod"
    // or alternatively:
    "pod": "./bin/pod"
  }
}

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
buschtoenscommented, Nov 16, 2020

Thanks for mentioning. That’d be fine as well though. If users for some reason cannot use binstubs, they could create an executable (chmod +x) shell script instead:

#!/usr/bin/env sh
bundle exec pod $@
export CAPACITOR_COCOAPODS_PATH="./bin/custom-pod"
2reactions
buschtoenscommented, Sep 23, 2020

We use a monorepo setup that looks like this: (irrelevant files & directories omitted)

.
β”œβ”€β”€ .bundle
β”‚  └── config
β”œβ”€β”€ bin
|  |   # These binstubs were generated via
|  |   # `bundle binstubs cocoapods`
|  |   # and are checked into the repo.
β”‚  β”œβ”€β”€ pod
β”‚  └── sandbox-pod
β”œβ”€β”€ gems
β”‚  └── ruby/
|      # Contains the `Gemfile` dependencies. Created by
|      # `bundle install`
|      # Not checked into the repository.
|      # See further down this comment for the contents.
β”œβ”€β”€ packages
β”‚  β”œβ”€β”€ capacitor-app/
β”‚  ...
β”‚  β”œβ”€β”€ plugin.auth/
β”‚  β”œβ”€β”€ plugin.pdf/
β”‚  └── scripts/
β”œβ”€β”€ .envrc
β”œβ”€β”€ .gitignore
β”œβ”€β”€ .ruby-version
β”œβ”€β”€ Brewfile
β”œβ”€β”€ Gemfile
β”œβ”€β”€ Gemfile.lock
β”œβ”€β”€ lerna.json
β”œβ”€β”€ package.json
β”œβ”€β”€ README.md
└── yarn.lock

For our tool chain version management we have (among others) these entries in our Brewfile:

brew "direnv"
brew "volta"
brew "rbenv"
brew "openjdk@11"

And this .envrc:

# Add the gem binstubs directory and the JDK@11 to the `PATH`.
export PATH="$(dirname "$0")/bin:$(brew --prefix openjdk@11)/bin:$PATH"

And this .bundle/config:

---
BUNDLE_PATH: "./gems"
BUNDLE_FROZEN: "true"

And here’s the contents created by bundle install:

./gems/ruby/2.7.0
β”œβ”€β”€ bin
β”‚  β”œβ”€β”€ bin-proxy
β”‚  β”œβ”€β”€ dotenv
β”‚  β”œβ”€β”€ fastlane
β”‚  β”œβ”€β”€ fuzzy_match
β”‚  β”œβ”€β”€ generate-api
β”‚  β”œβ”€β”€ httpclient
β”‚  β”œβ”€β”€ pod
β”‚  β”œβ”€β”€ rake
β”‚  β”œβ”€β”€ rougify
β”‚  β”œβ”€β”€ sandbox-pod
β”‚  β”œβ”€β”€ terminal-notifier
β”‚  β”œβ”€β”€ ww
β”‚  β”œβ”€β”€ xcodeproj
β”‚  β”œβ”€β”€ xcpretty
β”‚  └── xcpretty-travis-formatter
β”œβ”€β”€ build_info
β”œβ”€β”€ cache
β”‚  β”œβ”€β”€ activesupport-4.2.11.3.gem
β”‚  ...
β”‚  └── xcpretty-travis-formatter-1.0.0.gem
β”œβ”€β”€ doc
β”œβ”€β”€ extensions
β”‚  └── x86_64-darwin-19
β”œβ”€β”€ gems
β”‚  β”œβ”€β”€ activesupport-4.2.11.3
β”‚  ...
β”‚  └── xcpretty-travis-formatter-1.0.0
└── specifications
   β”œβ”€β”€ activesupport-4.2.11.3.gemspec
   ...
   └── xcpretty-travis-formatter-1.0.0.gemspec

Our Gemfile looks like this:

source "https://rubygems.org"

gem "fastlane"
gem "cocoapods"
# ...

fastlane_plugins_path = File.join(
  File.dirname(__FILE__),
  'packages',
  'capacitor-app',
  'ios',
  'App',
  'fastlane',
  'Pluginfile'
)
eval_gemfile(fastlane_plugins_path) if File.exist?(fastlane_plugins_path)

And the Pluginfile:

# Autogenerated by fastlane
#
# Ensure this file is checked in to source control!

gem 'fastlane-plugin-sentry'
Read more comments on GitHub >

github_iconTop Results From Across the Web

Fastlane failed to run pod install - Mobile - CircleCI Discuss
It's a bug with recent versions of Rubygems and certain combinations of Rubygems and Bundler. I'll bring this to the attention of our...
Read more >
pod-install | Yarn - Package Manager
A fast, zero-dependency package for cutting down on common issues developers have when running pod install . Install pod-install instantly. Usage. npx pod-Β ......
Read more >
command `pod install` failed. cause: /bin/bash -c - You.com
Pod Install. [ 1 ] Open terminal and type: sudo gem install cocoapods. Gem will get installed in Ruby inside the System library....
Read more >
Command-line Reference - CocoaPods Guides
Installation. The commands listed in this group provide support for installing and integrating the dependencies specified in a Podfile.
Read more >
CocoaPods Setup ft. Apple Silicon - thegoodalright.dev
System Ruby; Homebrew; RVM; rbenv; asdf. Gems Management. Bundler; Gemset. Pods Management. Pod Install Quirks; Project Setup. Conclusion (or Rant)Β ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found