private bool ValidateApplicationPackage(string appFolderFullPath)
        {
            string commandsFolder = Path.Combine(appFolderFullPath, InstallBuilder.CommandsFolderName);

            if (!Directory.Exists(commandsFolder))
            {
                WriteError("The specified package is not an application. The package was added but no commands were installed.");
                return(false);
            }

            var blockedCommands = _commandsRepository.Commands.Where(cmd =>
                                                                     !CommandNameValidator.IsCommandNameValid(cmd) ||
                                                                     CommandNameValidator.ShouldNameBeSkipped(cmd));

            if (blockedCommands.Any())
            {
                WriteError(string.Format(
                               "The application cannot be installed because the following command names are not allowed: {0}.",
                               string.Join(", ", blockedCommands)));

                return(false);
            }

            return(true);
        }
示例#2
0
        private bool ValidateExportedCommands()
        {
            // Get the commands that would conflict with runtime commands
            var invalidExportedCommands = _project.Commands.Keys.Where(exported => !CommandNameValidator.IsCommandNameValid(exported));

            if (invalidExportedCommands.Any())
            {
                _buildReport.Error.WriteLine(
                    string.Format(
                        "The following names are not allowed as commands: {0}.",
                        string.Join(", ", invalidExportedCommands))
                    .Red());

                return(false);
            }

            return(true);
        }