public void SetUp() { _builder = new FeedBuilder(); _implementationDir = new TemporaryDirectory("0install-unit-tests"); }
private ExitCode Finish() { if (_additionalArgs.Count != 3) return PrintHelp(); string snapshotFile = _additionalArgs[1]; string feedFile = _additionalArgs[2]; if (FileExists(feedFile)) return ExitCode.IOError; var feedBuilder = new FeedBuilder(); var session = CaptureSession.Load(snapshotFile, feedBuilder); session.InstallationDir = _installationDirectory; session.Diff(_handler); feedBuilder.MainCandidate = string.IsNullOrEmpty(_mainExe) ? feedBuilder.Candidates.FirstOrDefault() : feedBuilder.Candidates.FirstOrDefault(x => StringUtils.EqualsIgnoreCase(FileUtils.UnifySlashes(x.RelativePath), _mainExe)); session.Finish(); if (!string.IsNullOrEmpty(_zipFile)) { if (FileExists(_zipFile)) return ExitCode.IOError; var relativeUri = new Uri(Path.GetFullPath(feedFile)).MakeRelativeUri(new Uri(Path.GetFullPath(_zipFile))); session.CollectFiles(_zipFile, relativeUri, _handler); Log.Warn("If you wish to upload this feed and ZIP archive, make sure to turn the <archive>'s relative href into an absolute one."); } feedBuilder.Build().Save(feedFile); return ExitCode.OK; }