예제 #1
0
        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");
            }
        }
예제 #2
0
 static void TestSlacker()
 {
     var client = new SlackService(new ConsoleOutput(), "placeholder");
     client.SendMessage("test message");
 }