Commit 384ac16a authored by Nolan Waite's avatar Nolan Waite

Can make Xcode workspaces

parent 5f1bb7de
...@@ -22,6 +22,7 @@ module Pod ...@@ -22,6 +22,7 @@ module Pod
autoload :Config, 'cocoapods/xcode/config' autoload :Config, 'cocoapods/xcode/config'
autoload :CopyResourcesScript, 'cocoapods/xcode/copy_resources_script' autoload :CopyResourcesScript, 'cocoapods/xcode/copy_resources_script'
autoload :Project, 'cocoapods/xcode/project' autoload :Project, 'cocoapods/xcode/project'
autoload :Workspace, 'cocoapods/xcode/workspace'
end end
autoload :Pathname, 'pathname' autoload :Pathname, 'pathname'
......
framework 'Foundation'
module Pod
module Xcode
class Workspace
def initialize(*projpaths)
@projpaths = projpaths
end
def <<(projpath)
@projpaths << projpath
end
TEMPLATE = %q[<?xml version="1.0" encoding="UTF-8"?><Workspace version="1.0"></Workspace>]
def to_s
doc = NSXMLDocument.alloc.initWithXMLString(TEMPLATE, options:0, error:nil)
@projpaths.each do |projpath|
el = NSXMLNode.elementWithName("FileRef")
el.addAttribute(NSXMLNode.attributeWithName("location", stringValue:"group:#{projpath}"))
doc.rootElement.addChild(el)
end
NSString.alloc.initWithData(doc.XMLData, encoding:NSUTF8StringEncoding)
end
end
end
end
require File.expand_path('../../../spec_helper', __FILE__)
describe "Pod::Xcode::Workspace" do
before do
@workspace = Pod::Xcode::Workspace.new('Pods/Pods.xcodeproj', 'App.xcodeproj')
@doc = NSXMLDocument.alloc.initWithXMLString(@workspace.to_s, options:0, error:nil)
end
it "is the right workspace version" do
@doc.rootElement.attributeForName("version").stringValue.should == "1.0"
end
it "contains the projects" do
@doc.nodesForXPath("/Workspace/FileRef", error:nil).map do |node|
node.attributeForName("location").stringValue.sub(/^group:/, '')
end.sort.should == ['App.xcodeproj', 'Pods/Pods.xcodeproj']
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment