예제 #1
0
        public Build()
        {
            Cake.Log.Verbosity = Verbosity.Diagnostic;

            StandardGlobalInfo globalInfo = CreateStandardGlobalInfo()
                                            .AddNPM()
                                            .SetCIBuildTag();

            Task("Check-Repository")
            .Does(() =>
            {
                globalInfo.TerminateIfShouldStop();
            });

            Task("Clean")
            .IsDependentOn("Check-Repository")
            .Does(() =>
            {
                Cake.CleanDirectories(globalInfo.ReleasesFolder);

                globalInfo.GetNPMSolution().Clean();
            });

            Task("Build")
            .IsDependentOn("Check-Repository")
            .IsDependentOn("Clean")
            .Does(() =>
            {
                globalInfo.GetNPMSolution().Build();
            });

            Task("Unit-Testing")
            .IsDependentOn("Build")
            .WithCriteria(() => Cake.InteractiveMode() == InteractiveMode.NoInteraction ||
                          Cake.ReadInteractiveOption("RunUnitTests", "Run Unit Tests?", 'Y', 'N') == 'Y')
            .Does(() =>
            {
                globalInfo.GetNPMSolution().Test();
            });


            Task("Create-Packages")
            .WithCriteria(() => globalInfo.IsValid)
            .IsDependentOn("Unit-Testing")
            .Does(() =>
            {
                globalInfo.GetNPMSolution().RunPack();
            });

            Task("Push-Packages")
            .IsDependentOn("Create-Packages")
            .WithCriteria(() => globalInfo.IsValid)
            .Does(() =>
            {
                globalInfo.PushArtifacts();
            });

            // The Default task for this script can be set here.
            Task("Default")
            .IsDependentOn("Push-Packages");
        }