Skip to content

Instantly share code, notes, and snippets.

@sharpred
Created January 25, 2017 11:36
Show Gist options
  • Save sharpred/d7d049e80ba82dbbf0451e5ae3dc2f47 to your computer and use it in GitHub Desktop.
Save sharpred/d7d049e80ba82dbbf0451e5ae3dc2f47 to your computer and use it in GitHub Desktop.
use cocoapods xcodeproj gem to add a file to your xcode project from the command line
require 'xcodeproj'
project_path = "./platforms/ios/helloWorld.xcodeproj"
project = Xcodeproj::Project.open(project_path)
#add the bundle as a reference
bundle_path = "../../includes/OTABundle.bundle"
bundleRef = project.new_file(bundle_path);
# Get the `copy files` build phase
buildphase = project.objects.select{|x| x.class == Xcodeproj::Project::Object::PBXResourcesBuildPhase}[0];
#add the bundle to the build phase
buildphase.add_file_reference(bundleRef);
project.save()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment