Пример #1
0
        private void DeleteNodeJSFunction(Durados.DeleteEventArgs e)
        {
            NodeJS nodeJS = new NodeJS();

            string  ruleId   = e.PrimaryKey;
            DataRow ruleRow  = Map.GetConfigDatabase().Views[Rule].GetDataRow(ruleId);
            string  viewId   = ruleRow[Rules].ToString();
            string  viewName = null;

            if (viewId != null)
            {
                viewName = new ConfigAccess().GetViewNameByPK(viewId, Map.GetConfigDatabase().ConnectionString);

                if (string.IsNullOrEmpty(viewName))
                {
                    throw new Durados.DuradosException(string.Format(Messages.ViewNameNotFound, viewId));
                }
            }
            else
            {
                throw new Durados.DuradosException(string.Format(Messages.ViewNameNotFound, string.Empty));
            }

            string actionName   = ruleRow[Name].ToString();
            string functionName = Map.AppName + "_" + viewName + "_" + actionName;
            string folder       = Map.AppName + "/" + viewName + "/" + actionName;

            nodeJS.Delete(folder, functionName);
        }
Пример #2
0
        public virtual IHttpActionResult Download(string functionName)
        {
            try
            {
                View         view = GetView("_root");
                Durados.Rule rule = GetRule(view, functionName);

                if (rule == null)
                {
                    return(ResponseMessage(Request.CreateResponse(HttpStatusCode.NotFound, Messages.RuleNotFound)));
                }

                if (!(rule.WorkflowAction == Durados.WorkflowAction.Lambda || rule.WorkflowAction == Durados.WorkflowAction.NodeJS))
                {
                    return(ResponseMessage(Request.CreateResponse(HttpStatusCode.BadRequest, "not a lambda function")));
                }

                NodeJS nodejs = new NodeJS();
                return(Ok(nodejs.Download(view.GetRuleCredentials(rule), rule.LambdaName)));
            }
            catch (Exception exception)
            {
                throw new BackAndApiUnexpectedResponseException(exception, this);
            }
        }
Пример #3
0
        public void Can_load_modules()
        {
            // Act
            NodeJS.Install();
            var wasInstalled = NodeJS.CheckInstallation();
            var modulesExist = Directory.Exists(NodeJS.PackageDirectory);

            // Assert
            wasInstalled.ShouldBeTrue();
            modulesExist.ShouldBeTrue();
        }
Пример #4
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();
        }
Пример #5
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);
        }
Пример #6
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();
        }
Пример #7
0
        private void CreateNodeJSFunction(Durados.CreateEventArgs e)
        {
            NodeJS nodeJS = new NodeJS();

            string fileName = null;

            if (e.Values.ContainsKey(FileName))
            {
                fileName = e.Values[FileName].ToString();
            }

            string viewId = null;

            if (e.Values.ContainsKey("Rules_Parent"))
            {
                viewId = e.Values["Rules_Parent"].ToString();
            }
            string viewName = null;

            if (viewId != null)
            {
                viewName = new ConfigAccess().GetViewNameByPK(viewId, Map.GetConfigDatabase().ConnectionString);

                if (string.IsNullOrEmpty(viewName))
                {
                    throw new Durados.DuradosException(string.Format(Messages.ViewNameNotFound, viewId));
                }
            }

            string actionName = e.Values[Name].ToString();


            string cloudProvider = GetCloudVendor(e.Values);

            if (fileName == null)
            {
                fileName = actionName + ".zip";
            }
            string functionName = Map.AppName + "_" + viewName + "_" + actionName;
            string folder       = Map.AppName + "/" + viewName + "/" + actionName;

            nodeJS.Create(Maps.NodeJSBucket, folder, fileName, functionName, "handler", "handler", cloudProvider);
        }
Пример #8
0
        private void UpdateNodeJSFunction(Durados.EditEventArgs e)
        {
            NodeJS nodeJS = new NodeJS();

            string fileName = null;

            if (e.Values.ContainsKey(FileName))
            {
                fileName = e.Values[FileName].ToString();
            }

            string  ruleId   = e.PrimaryKey;
            DataRow ruleRow  = Map.GetConfigDatabase().Views[Rule].GetDataRow(ruleId);
            string  viewId   = ruleRow[Rules].ToString();
            string  viewName = null;

            if (viewId != null)
            {
                viewName = new ConfigAccess().GetViewNameByPK(viewId, Map.GetConfigDatabase().ConnectionString);

                if (string.IsNullOrEmpty(viewName))
                {
                    throw new Durados.DuradosException(string.Format(Messages.ViewNameNotFound, viewId));
                }
            }
            else
            {
                throw new Durados.DuradosException(string.Format(Messages.ViewNameNotFound, string.Empty));
            }

            string actionName = ruleRow[Name].ToString();

            if (fileName == null)
            {
                fileName = actionName + ".zip";
            }
            string functionName = Map.AppName + "_" + viewName + "_" + actionName;
            string folder       = Map.AppName + "/" + viewName + "/" + actionName;

            nodeJS.Update(Maps.NodeJSBucket, folder, fileName, functionName);
        }
Пример #9
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);
        }
Пример #10
0
        public void Test_implementsSearchForNewer()
        {
            var node = new NodeJS(false);

            Assert.IsTrue(node.implementsSearchForNewer());
        }
Пример #11
0
        private void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            this.TextBlock_Path.Text = string.Join("\n", Variables.Paths);
            DotNetCore DotNetDependency = new DotNetCore();

            if (DotNetDependency.VerifyInstallationStatus())
            {
                this.TextBlock_DotNetCore.Text = string.Join("; ", DotNetDependency.GetInstalledVersions());
            }
            else
            {
                this.TextBlock_DotNetCore.Text = "Not Installed";
            }

            NodeJS NodeJSDependency = new NodeJS();

            if (NodeJSDependency.VerifyInstallationStatus())
            {
                this.TextBlock_NodeJS.Text = string.Join("; ", NodeJSDependency.GetInstalledVersions());
            }
            else
            {
                this.TextBlock_DotNetCore.Text = "Not Installed";
            }

            Python PythonDependency = new Python();

            if (PythonDependency.VerifyInstallationStatus())
            {
                this.TextBlock_Python.Text = string.Join("; ", PythonDependency.GetInstalledVersions());
            }
            else
            {
                this.TextBlock_Python.Text = "Not Installed";
            }
            Flutter FlutterDependency = new Flutter();

            if (FlutterDependency.VerifyInstallationStatus())
            {
                this.TextBlock_Flutter.Text = string.Join("; ", FlutterDependency.GetInstalledVersions());
            }
            else
            {
                this.TextBlock_Flutter.Text = "Not Installed";
            }

            Dart DartDependency = new Dart();

            if (DartDependency.VerifyInstallationStatus())
            {
                this.TextBlock_Dart.Text = string.Join("; ", DartDependency.GetInstalledVersions());
            }
            else
            {
                this.TextBlock_Dart.Text = "Not Installed";
            }

            Git GitDependency = new Git();

            if (GitDependency.VerifyInstallationStatus())
            {
                this.TextBlock_Git.Text = string.Join("; ", GitDependency.GetInstalledVersions());
            }
            else
            {
                this.TextBlock_Git.Text = "Not Installed";
            }
        }