有没有可以修改Podfile的命令行工具?
Is there a command line tool that can modify the Podfile?
我想使用 Cocoapods 为我的项目添加一个框架。但我不想手动更改 Podfile。我想使用命令行来编辑 Podfile,如下所示:
some_command ./Podfile --add AFNetworking --target MyTarget
可以吗?
很遗憾,没有这样的命令。
您可以做的更接近的是创建一个 .sh
文件,打开 Podfile
并在其上写入。示例:
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
通过终端调用:
sh podwrite.sh
podfile 上的输出:
source 'https://github.com/CocoaPods/Specs.git'
target 'MyTarget' do
use_frameworks!
pod 'AFNetworking'
end
我想使用 Cocoapods 为我的项目添加一个框架。但我不想手动更改 Podfile。我想使用命令行来编辑 Podfile,如下所示:
some_command ./Podfile --add AFNetworking --target MyTarget
可以吗?
很遗憾,没有这样的命令。
您可以做的更接近的是创建一个 .sh
文件,打开 Podfile
并在其上写入。示例:
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
通过终端调用:
sh podwrite.sh
podfile 上的输出:
source 'https://github.com/CocoaPods/Specs.git'
target 'MyTarget' do
use_frameworks!
pod 'AFNetworking'
end