コード例 #1
0
        public void Clean_RemovesManifestFrom_BuildAndIntermediateOutput()
        {
            var expectedManifest = LoadBuildManifest();
            var testAsset        = "RazorComponentApp";

            ProjectDirectory = CreateAspNetSdkTestAsset(testAsset);

            var build = new BuildCommand(ProjectDirectory);

            build.Execute().Should().Pass();

            var intermediateOutputPath = build.GetIntermediateDirectory(DefaultTfm, "Debug").ToString();
            var outputPath             = build.GetOutputDirectory(DefaultTfm, "Debug").ToString();

            // GenerateStaticWebAssetsManifest should generate the manifest file.
            var path = Path.Combine(intermediateOutputPath, "StaticWebAssets.build.json");

            new FileInfo(path).Should().Exist();
            var manifest = StaticWebAssetsManifest.FromJsonBytes(File.ReadAllBytes(path));

            AssertManifest(manifest, expectedManifest);

            // GenerateStaticWebAssetsManifest should copy the file to the output folder.
            var finalPath = Path.Combine(outputPath, "ComponentApp.staticwebassets.json");

            new FileInfo(finalPath).Should().Exist();
            var finalManifest = StaticWebAssetsManifest.FromJsonBytes(File.ReadAllBytes(finalPath));

            AssertManifest(finalManifest, expectedManifest);

            var clean = new CleanCommand(Log, ProjectDirectory.Path);

            clean.Execute().Should().Pass();

            // Obj folder manifest does not exist
            new FileInfo(path).Should().NotExist();

            // Bin folder manifest does not exist
            new FileInfo(finalPath).Should().NotExist();
        }
        public void Clean_should_remove_bin_output(bool multiTarget)
        {
            TestAsset helloWorldAsset = SetUpHelloWorld(multiTarget);

            _testRoot = helloWorldAsset.TestRoot;

            var packCommand = new PackCommand(Log, helloWorldAsset.TestRoot);

            packCommand.Execute().Should().Pass();

            var cleanCommand = new CleanCommand(Log, helloWorldAsset.TestRoot);

            cleanCommand.Execute().Should().Pass();

            var    outputDirectory = packCommand.GetOutputDirectory("netcoreapp2.1");
            string windowShimPath  = Path.Combine(outputDirectory.FullName, $"shims/netcoreapp2.1/win-x64/{_customToolCommandName}.exe");

            File.Exists(windowShimPath).Should().BeFalse($"Shim {windowShimPath} should not exists");
            string osxShimPath = Path.Combine(outputDirectory.FullName, $"shims/netcoreapp2.1/osx.10.12-x64/{_customToolCommandName}");

            File.Exists(osxShimPath).Should().BeFalse($"Shim {osxShimPath} should not exists");
        }
コード例 #3
0
ファイル: MachineSender.cs プロジェクト: v-chfeng/WinCleaner
        public static bool SendCMD(RailID railID, CleanCommand cmd)
        {
            switch (cmd)
            {
            case CleanCommand.StartAutoClean:
                mockReceiver.StartAutoClean(railID);
                break;

            case CleanCommand.PauseAutoClean:
                mockReceiver.PauseAutoClean(railID);
                break;

            case CleanCommand.ContinueClean:
                mockReceiver.ContinueClean(railID);
                break;

            case CleanCommand.StopAutoClean:
                mockReceiver.StopAutoClean(railID);
                break;
            }

            return(true);
        }
コード例 #4
0
        public void TestClean()
        {
            string contents = @"{
  ""version"": ""1.0"",
  ""defaultProvider"": ""cdnjs"",
  ""defaultDestination"": ""wwwroot/lib/"",
  ""libraries"": [
    {
      ""library"": ""[email protected]"",
      ""files"": [ ""jquery.min.js"", ""core.js"" ]
    }
  ]
}";

            File.WriteAllText(Path.Combine(WorkingDir, "libman.json"), contents);

            var restoreCommand = new RestoreCommand(HostEnvironment);

            restoreCommand.Configure(null).Execute();

            Assert.IsTrue(File.Exists(Path.Combine(WorkingDir, "wwwroot", "lib", "jquery.min.js")));
            Assert.IsTrue(File.Exists(Path.Combine(WorkingDir, "wwwroot", "lib", "core.js")));

            var command = new CleanCommand(HostEnvironment);

            command.Configure(null);

            int result = command.Execute();

            Assert.AreEqual(0, result);

            Assert.IsFalse(File.Exists(Path.Combine(WorkingDir, "wwwroot", "lib", "jquery.min.js")));
            Assert.IsFalse(File.Exists(Path.Combine(WorkingDir, "wwwroot", "lib", "core.js")));
            Assert.IsFalse(Directory.Exists(Path.Combine(WorkingDir, "wwwroot", "lib")));
            Assert.IsFalse(Directory.Exists(Path.Combine(WorkingDir, "wwwroot")));
        }
コード例 #5
0
        public ProjectViewModel(SolutionViewModel solutionViewModel, IProject model)
            : base(model)
        {
            shell = IoC.Get <IShell>();

            Items = new ObservableCollection <ProjectItemViewModel>();

            Items.BindCollections(model.Items, p => { return(ProjectItemViewModel.Create(p)); }, (pivm, p) => pivm.Model == p);

            ConfigureCommand = ReactiveCommand.Create();

            ConfigureCommand.Subscribe(o =>
            {
                if (configuration == null)
                {
                    configuration = new ProjectConfigurationDialogViewModel(model, () =>
                    {
                        configuration = null;
                    });

                    shell.AddDocument(configuration);
                }
                else
                {
                    shell.SelectedDocument = configuration;
                }
                //shell.ModalDialog.ShowDialog();
            });

            DebugCommand = ReactiveCommand.Create();
            DebugCommand.Subscribe(_ =>
            {
                //shell.Debug(model);
            });

            BuildCommand = ReactiveCommand.Create();
            BuildCommand.Subscribe(o => { shell.Build(model); });

            CleanCommand = ReactiveCommand.Create();

            CleanCommand.Subscribe(o => { shell.Clean(model); });

            ManageReferencesCommand = ReactiveCommand.Create();

            ManageReferencesCommand.Subscribe(o => { });

            SetProjectCommand = ReactiveCommand.Create();

            SetProjectCommand.Subscribe(o =>
            {
                model.Solution.StartupProject = model;
                model.Solution.Save();

                shell.InvalidateCodeAnalysis();

                foreach (var project in solutionViewModel.Projects)
                {
                    project.Invalidate();
                }
            });

            OpenInExplorerCommand = ReactiveCommand.Create();
            OpenInExplorerCommand.Subscribe(o => { Process.Start(Model.CurrentDirectory); });

            NewItemCommand = ReactiveCommand.Create();
            NewItemCommand.Subscribe(_ =>
            {
                shell.ModalDialog = new NewItemDialogViewModel(model);
                shell.ModalDialog.ShowDialog();
            });

            RemoveCommand = ReactiveCommand.Create();
            RemoveCommand.Subscribe(async o =>
            {
                await shell.CloseDocumentsForProjectAsync(Model);
                Model.Solution.RemoveProject(Model);
                Model.Solution.Save();
            });
        }
コード例 #6
0
        public ICommand CreateCommand(ScriptCsArgs args)
        {
            if (args.ScriptName != null)
            {
                var executeCommand = new ExecuteScriptCommand(
                    args.ScriptName,
                    _scriptServiceRoot.FileSystem,
                    _scriptServiceRoot.Executor,
                    _scriptServiceRoot.ScriptPackResolver);

                if (args.Restore)
                {
                    var restoreCommand = new RestoreCommand(
                        args.ScriptName,
                        _scriptServiceRoot.FileSystem,
                        _scriptServiceRoot.PackageAssemblyResolver);

                    return new CompositeCommand(restoreCommand, executeCommand);
                }

                return executeCommand;
            }

            if (args.Install != null)
            {
                var installCommand = new InstallCommand(
                    args.Install,
                    args.AllowPreReleaseFlag,
                    _scriptServiceRoot.FileSystem,
                    _scriptServiceRoot.PackageAssemblyResolver,
                    _scriptServiceRoot.PackageInstaller);

                var restoreCommand = new RestoreCommand(
                    args.Install,
                    _scriptServiceRoot.FileSystem,
                    _scriptServiceRoot.PackageAssemblyResolver);

                return new CompositeCommand(installCommand, restoreCommand);
            }

            if (args.Clean)
            {
                var cleanCommand = new CleanCommand(
                    args.ScriptName,
                    _scriptServiceRoot.FileSystem,
                    _scriptServiceRoot.PackageAssemblyResolver);

                return cleanCommand;
            }

            if (args.Save)
            {
                return new SaveCommand(_scriptServiceRoot.PackageAssemblyResolver);
            }

            if (args.Version)
            {
                return new VersionCommand();
            }

            return new InvalidCommand();
        }