static void TestPublisher() { var client = new PublishingWebService(new ConsoleOutput(), "http://wurmassistant.aldurslab.net", "api/WurmAssistant3/", "*****@*****.**", "placeholder"); client.Authenticate(); client.GetLatestVersion("Stable"); var info = new FileInfo("pak.dat"); File.WriteAllText(info.FullName, "test"); client.Publish(info, new Version(0, 0, 0, 1), "Stable"); }
public void Execute() { var publisher = new PublishingWebService(output, webServiceRootUrl, webServiceControllerPath, webServiceLogin, webServicePassword); var slacker = new SlackService(output, slackIntegrationSubUrl); var lastPublishedVersion = publisher.GetLatestVersion(buildType); output.Write("last version is " + lastPublishedVersion); var releaseDirs = GetReleaseDirInfos(); var latestVersion = releaseDirs.Max(info => info.Version); output.Write("latest version is " + latestVersion); if (latestVersion > lastPublishedVersion) { var builder = new ChangelogBuilder(releaseDirs, output); var changelog = builder.Build(); var binDir = new DirectoryInfo(packageBinPath); var tempPackageDir = new DirectoryInfo(Path.Combine(tempDir, "package")); DirectoryOps.CopyRecursively(binDir.FullName, tempPackageDir.FullName); var targetChangelogFile = new FileInfo(Path.Combine(tempPackageDir.FullName, "changelog.txt")); File.WriteAllText(targetChangelogFile.FullName, changelog); var zipper = new FastZip(); var zipFile = new FileInfo(Path.Combine(tempDir, "package.zip")); zipper.CreateZip(zipFile.FullName, tempPackageDir.FullName, true, null); publisher.Publish(zipFile, latestVersion, buildType); output.Write("Publishing operation completed."); slacker.SendMessage(string.Format("Published {0} version of {1}.", latestVersion, appName)); } else { output.Write("latest version was already published, no publish executed"); } }