示例#1
0
        public static object Targets(IParameters parameters)
        {
            var stage = parameters.Required<string>("stage");
            var machine = parameters.Required<string>("machine");

            var deployService = new Copy {
                FromPath = "service",
                ToPath = machine.WhenBuilt(m => String.Format(@"c:\deployments\install\{0}\service", m)),
            };
            var deployWeb = new Copy {
                FromPath = "web",
                ToPath = machine.WhenBuilt(m => String.Format(@"c:\deployments\install\{0}\web", m)),
            };

            var remoteMachineOne = GetRemoteMachine(stage, machine, "one");
            var remoteMachineTwo = GetRemoteMachine(stage, machine, "two");

            Task<IEnumerable<RemoteMachine>> serviceMachines = new[] {remoteMachineOne, remoteMachineTwo};
            Task<IEnumerable<RemoteMachine>> webMachines = new[] {remoteMachineTwo};

            var deployArchive = new StagedDeployArchive(stage, "archive");
            var service = deployArchive.Add("service", "service", deployService).WithRemoteDeploy(serviceMachines.SelectTasks(m => m.DeployTargets("Service")));
            var web = deployArchive.Add("web", "web", deployWeb).WithRemoteDeploy(webMachines.SelectTasks(m => m.DeployTargets("Web")));

            return new {
                Service = service,
                Web = web,
            };
        }
示例#2
0
        public void ShouldTaskListOfStringsAndProduceListOfPrinters()
        {
            var output = new StringWriter();
            Task<IEnumerable<string>> strings = new[] {"one", "two", "three"};
            Task<IEnumerable<FakePrintTask>> printers = strings.SelectTasks(s => new FakePrintTask(output, s));

            printers.TestBuild();

            Assert.That(printers.Value.Count(), Is.EqualTo(3));
            Assert.That(printers.Value, Has.All.AssignableTo(typeof (FakePrintTask)));
            Assert.That(output.ToString(), Is.EqualTo("one;two;three;"));
        }
示例#3
0
文件: Build.cs 项目: joshski/bounce
        public static object Targets(IParameters parameters)
        {
            var v4 = new VisualStudioSolution {SolutionPath = @"Bounce.sln", Configuration = "Debug"};
            var v35 = new VisualStudioSolution {SolutionPath = @"Bounce.sln", Configuration = "Debug_3_5" };

            var v4Tests = new NUnitTests
            {
                DllPaths = v4.Projects.Where(p => p.Name.EndsWith("Tests")).Select(p => p.OutputFile),
                NUnitConsolePath = @"References\NUnit\nunit-console.exe"
            };

            var v35Tests = new NUnitTests
            {
                DllPaths = v35.Projects.Where(p => p.Name.EndsWith("Tests")).Select(p => p.OutputFile),
                NUnitConsolePath = @"References\NUnit\nunit-console.exe"
            };

            Task<IEnumerable<string>> dests = new [] {"sdf"};
            dests.SelectTasks(dest => new Copy {ToPath = dest});

            const string nugetExe = @"References\NuGet\NuGet.exe";
            var nugetPackage = new NuGetPackage
            {
                NuGetExePath = nugetExe,
                Spec = v4.Projects["Bounce.Framework"].ProjectFile.WithDependencyOn(v4Tests, v35Tests, v35),
            };

            var nugetPush = new NuGetPush
            {
                ApiKey = EnvironmentVariables.Required<string>("NUGET_API_KEY"),
                NuGetExePath = nugetExe,
                Package = nugetPackage.Package,
            };

            return new
            {
                Net4Binaries = v4,
                Net35Binaries = v35,
                Net4Tests = v4Tests,
                Net35Tests = v35Tests,
                Binaries = new All(v4, v35),
                Tests = new All(v4Tests, v35Tests),
                NuGet = nugetPush,
                NuGetPackage = nugetPackage,
            };
        }