我们想从cocoapods prepare_command
脚本向项目的目标添加一个脚本阶段。是否有任何环境变量(如PROJECT_DIR
)来从prepare_command
脚本获取当前项目路径?
以下是podspec
的示例Pod::Spec.new do |spec|
spec.platform = :ios
spec.name = '...'
...
spec.prepare_command = <<-CMD
ruby add_phase.rb
CMD
和用于添加构建阶段的ruby脚本:
#!/usr/bin/ruby
require 'xcodeproj'
project_dir = ??
project_files = Dir.glob(File.join(project_dir, "*.xcodeproj"))
...