I want to add a framework to my project using Cocoapods. But I don't want to change Podfile manually. I want to use a command line to edit the Podfile like this:
some_command ./Podfile --add AFNetworking --target MyTarget
Is it possible?
Unfortunately, there isn't such command.
The closer you can do is creating a .sh
file that opens the Podfile
and writes on it. Example:
podwrite.sh
#!/bin/sh
FILE="Path/To/Podfile"
/bin/cat <<EOM >$FILE
source 'https://github.com/CocoaPods/Specs.git'
target 'MyTarget' do
use_frameworks!
pod 'AFNetworking'
end
EOM
Call via terminal:
sh podwrite.sh
Output on the podfile:
source 'https://github.com/CocoaPods/Specs.git'
target 'MyTarget' do
use_frameworks!
pod 'AFNetworking'
end