Cli: Automatically run `pod install` when a template ships with a Podfile

Created on 6 May 2019  路  7Comments  路  Source: react-native-community/cli

New React Native template has CocoaPods integration and other templates might soon have it too.

Unfortunately, the drawback is that you need to run pod install yourself after initing a project.

We want to improve this workflow and make CLI run pod install automatically for users when CocoaPods is available or attempt installing.

Since this code is only going to be run when platform is Mac, we can assume gem is available and run sudo gem install cocoapods as per the docs.

We can also allow users to skip that step where we only print an information that they should install CocoaPods afterwards in order to run iOS application.

feature request

Most helpful comment

I would discourage using sudo installation option for Cocoapods as it is rarely used. Usually people use Ruby installed with a help of rbenv instead of system one. Either way providing instructions how to install Cocoapods instead of installing it by cli looks like more wise approach. As end user suppose to know what is Cocoapods if they are going to use it as an iOS dependency manager.

All 7 comments

Any idea on how we would let the user skip the step of installing cocoapods and running pod install?

A --skip-pods flag? Why would you want to skip it tho?

We can also allow users to skip that step where we only print an information that they should install CocoaPods afterwards in order to run iOS application.

Just asked because of this :P

Ah, sorry! I meant something like this:

CocoaPods was not found on your laptop. Do you want to install it? [y/n]

(and you can go with n if you don't want to do it).

I would discourage using sudo installation option for Cocoapods as it is rarely used. Usually people use Ruby installed with a help of rbenv instead of system one. Either way providing instructions how to install Cocoapods instead of installing it by cli looks like more wise approach. As end user suppose to know what is Cocoapods if they are going to use it as an iOS dependency manager.

Agreed, we should leave installation of CocoaPods to the user, as there are multiple ways it can be installed. The best we can do is to propose a bunch of solutions and link to official CP docs.

IMO it's not harmful to ask the user if the CLI should automatically install it or not, the approach suggested is the one recommended in the docs, for me it just looks a bit weird to ask for user's password when doing it as it uses sudo (you can see on #373).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Steffi3rd picture Steffi3rd  路  3Comments

owinter86 picture owinter86  路  3Comments

Jyrno42 picture Jyrno42  路  4Comments

thymikee picture thymikee  路  4Comments

mauricioscotton picture mauricioscotton  路  3Comments