Beispiel #1
0
        public void Can_load_modules()
        {
            // Act
            NodeJS.Install();
            var wasInstalled = NodeJS.CheckInstallation();
            var modulesExist = Directory.Exists(NodeJS.PackageDirectory);

            // Assert
            wasInstalled.ShouldBeTrue();
            modulesExist.ShouldBeTrue();
        }
Beispiel #2
0
        public static void Initialize(TestContext _)
        {
            if (Directory.Exists(NodeJS.InstallationDirectory))
            {
                foreach (var item in Directory.EnumerateFiles(NodeJS.InstallationDirectory, "*.js"))
                {
                    File.Delete(item);
                }
            }

            NodeJS.Install();
        }
Beispiel #3
0
        public bool Execute()
        {
            if (string.IsNullOrEmpty(ProjectDirectory))
            {
                ProjectDirectory = Path.GetDirectoryName(BuildEngine.ProjectFileOfTaskNode);
            }
            if (!Directory.Exists(ProjectDirectory))
            {
                throw new DirectoryNotFoundException($"Could not find directory at '{ProjectDirectory}'.");
            }

            NodeJS.Install((message, _, __) =>
            {
                Message($"{nameof(CompileSassFiles)}: {message}", MessageImportance.High);
            });

            var options = new CompilerOptions
            {
                Minify             = Minify,
                OutputDirectory    = OutputDirectory,
                AddSourceComments  = AddSourceComments,
                GenerateSourceMaps = GenerateSourceMaps,
                SourceMapDirectory = SourceMapDirectory,
                ConfigurationFile  = (File.Exists(OptionsFile) ? OptionsFile : null)
            };

            int failures = 0;

            foreach (string sassFile in SassCompiler.GetSassFiles(ProjectDirectory))
            {
                CompilerResult result = SassCompiler.Compile(sassFile, options);

                foreach (CompilerError err in result.Errors)
                {
                    LogError(err);
                }
                if (result.Success)
                {
                    LogResult(result);
                }
                else
                {
                    failures++;
                }
            }

            return(failures == 0);
        }
Beispiel #4
0
        public void Can_load_modules()
        {
            // Arrange
            var node_modules = Path.Combine(NodeJS.InstallationDirectory, "node_modules");

            //if (Directory.Exists(node_modules)) Directory.Delete(node_modules, recursive: true);

            // Act
            NodeJS.Install();
            var installed    = NodeJS.CheckInstallation();
            var modulesExist = Directory.Exists(node_modules);

            // Assert
            installed.ShouldBeTrue();
            modulesExist.ShouldBeTrue();
        }
Beispiel #5
0
        public bool Execute()
        {
            NodeJS.Install((msg, _, __) => { BuildEngine.Info(msg); });

            string projectFolder  = Path.GetDirectoryName(BuildEngine.ProjectFileOfTaskNode);
            string configFilePath = (ConfigurationFile?.GetMetadata("FullPath") ?? Compiler.FindConfigurationFile(projectFolder));

            var options = new Configuration.CompilerOptions(
                configFilePath,
                Minify,
                GenerateSourceMaps);

            CompilerResult result = Compiler.Run(options, projectFolder);

            foreach (CompilerError err in result.Errors)
            {
                Log(err);
            }
            Log(result);

            return(result.HasErrors == false);
        }