public bool CreatePodfile(Podfile podfile, string podfilePath) { if (CancellationToken.IsCancellationRequested) { Log.LogError("Task was canceled."); return(false); } var podfileContents = $"{(podfile.UseFrameworks ? "use_frameworks!" : "")}\n" + $"platform :{podfile.PlatformName}, '{podfile.PlatformVersion}'\n" + $"target '{podfile.TargetName}' do\n"; foreach (var pod in podfile.Pods) { podfileContents += $" pod '{pod.Id}', '{pod.Version}'\n"; } podfileContents += $"end"; Ssh.CreateDirectory(CrossPath.GetDirectoryNameSsh(podfilePath)); using (var stream = Utilities.GetStreamFromText(podfileContents)) { Ssh.CreateFile(stream, podfilePath); } return(true); }
public bool CreatePodfileXCodeProject(string podfileRoot, Podfile podfile, bool?noRepoUpdate = null) { if (CancellationToken.IsCancellationRequested) { Log.LogError("Task was canceled."); return(false); } var podfilePath = CrossPath.CombineSsh(podfileRoot, "Podfile"); var podfileLockPath = CrossPath.CombineSsh(podfileRoot, "Podfile.lock"); // see if we can avoid updating the master repo noRepoUpdate = noRepoUpdate == true || (noRepoUpdate == null && Ssh.FileExists(podfileLockPath)); // create and restore a Podfile return(CreatePodfile(podfile, podfilePath) && RestorePodfile(podfileRoot, noRepoUpdate)); }