bin/calabash-ios-setup.rb in calabash-cucumber-0.9.25 vs bin/calabash-ios-setup.rb in calabash-cucumber-0.9.26

- old
+ new

@@ -260,26 +260,12 @@ build_phase_entry = PBXProject::PBXTypes::BasicValue.new(:value => bf.guid, :comment => bf.comment) pbx.sections['PBXFrameworksBuildPhase'][0].files << build_phase_entry - cfnet = pbx.find_item :name => "CFNetwork.framework", :type => PBXProject::PBXTypes::PBXFileReference - unless cfnet - f = PBXProject::PBXTypes::PBXFileReference.new(:path => "System/Library/Frameworks/CFNetwork.framework", :lastKnownFileType => "wrapper.framework", :sourceTree => 'SDKROOT') - f.comment = "CFNetwork.framework" - f.name = f.comment - pbx.add_item f - bf = PBXProject::PBXTypes::PBXBuildFile.new(:comment => "CFNetwork.framework in Frameworks", :fileRef => f.guid) - bf.comment = "CFNetwork.framework in Frameworks" - pbx.add_item bf - group.add_children f - build_phase_entry = PBXProject::PBXTypes::BasicValue.new(:value => bf.guid, :comment => bf.comment) - pbx.sections['PBXFrameworksBuildPhase'][0].files << build_phase_entry - end - targets = pbx.sections['PBXNativeTarget'] target = nil if targets.count == 0 msg("Error") do puts "Unable to find targets in project." @@ -315,9 +301,31 @@ target = found = targets.find { |t| t.name.value == answer || t.name.value=="\"#{answer}\""} end end end end + + #CFNetwork + cfnet = pbx.find_item :name => "CFNetwork.framework", :type => PBXProject::PBXTypes::PBXFileReference + + if cfnet + msg("Warning") do + puts "You are already using CFNetwork.framework" + puts "Please make sure you have added it to your target #{target.name.value}." + end + else + f = PBXProject::PBXTypes::PBXFileReference.new(:path => "System/Library/Frameworks/CFNetwork.framework", :lastKnownFileType => "wrapper.framework", :sourceTree => 'SDKROOT') + f.comment = "CFNetwork.framework" + f.name = f.comment + pbx.add_item f + bf = PBXProject::PBXTypes::PBXBuildFile.new(:comment => "CFNetwork.framework in Frameworks", :fileRef => f.guid) + bf.comment = "CFNetwork.framework in Frameworks" + pbx.add_item bf + group.add_children f + build_phase_entry = PBXProject::PBXTypes::BasicValue.new(:value => bf.guid, :comment => bf.comment) + pbx.sections['PBXFrameworksBuildPhase'][0].files << build_phase_entry + end + ##project level build conf project_bc_id = pbx.sections['PBXProject'][0].buildConfigurationList.value project_bc_list = pbx.find_item :guid => project_bc_id, :type => PBXProject::PBXTypes::XCConfigurationList project_bc_ref = project_bc_list.buildConfigurations.find { |bc| bc.comment =="Debug" } \ No newline at end of file