Ejemplo n.º 1
0
        public async Task ExecuteAsync(CommandLineArgs commandLineArgs)
        {
            if (commandLineArgs.Target == null)
            {
                throw new CliUsageException(
                          "Module name is missing!" +
                          Environment.NewLine + Environment.NewLine +
                          GetUsageInfo()
                          );
            }

            var withSourceCode = commandLineArgs.Options.ContainsKey("with-source-code");

            var skipDbMigrations = Convert.ToBoolean(
                commandLineArgs.Options.GetOrNull(Options.DbMigrations.Skip) ?? "false");

            var solutionFile = GetSolutionFile(commandLineArgs);

            var version = commandLineArgs.Options.GetOrNull(Options.Version.Short, Options.Version.Long);

            if (version == null)
            {
                version = SolutionAbpVersionFinder.Find(solutionFile);
            }

            await SolutionModuleAdder.AddAsync(
                solutionFile,
                commandLineArgs.Target,
                commandLineArgs.Options.GetOrNull(Options.StartupProject.Short, Options.StartupProject.Long),
                version,
                skipDbMigrations,
                withSourceCode
                );
        }
Ejemplo n.º 2
0
    public async Task ExecuteAsync(CommandLineArgs commandLineArgs)
    {
        if (commandLineArgs.Target == null)
        {
            throw new CliUsageException(
                      "Module name is missing!" +
                      Environment.NewLine + Environment.NewLine +
                      GetUsageInfo()
                      );
        }

        var newTemplate    = commandLineArgs.Options.ContainsKey(Options.NewTemplate.Long);
        var template       = commandLineArgs.Options.GetOrNull(Options.Template.Short, Options.Template.Long);
        var newProTemplate = !string.IsNullOrEmpty(template) && template == ModuleProTemplate.TemplateName;
        var withSourceCode = newTemplate || newProTemplate || commandLineArgs.Options.ContainsKey(Options.SourceCode.Long);
        var addSourceCodeToSolutionFile = withSourceCode && commandLineArgs.Options.ContainsKey("add-to-solution-file");
        var skipDbMigrations            = newTemplate || newProTemplate || commandLineArgs.Options.ContainsKey(Options.DbMigrations.Skip);
        var solutionFile = GetSolutionFile(commandLineArgs);

        var version = commandLineArgs.Options.GetOrNull(Options.Version.Short, Options.Version.Long);

        if (version == null)
        {
            version = SolutionPackageVersionFinder.Find(solutionFile);
        }

        var moduleInfo = await SolutionModuleAdder.AddAsync(
            solutionFile,
            commandLineArgs.Target,
            version,
            skipDbMigrations,
            withSourceCode,
            addSourceCodeToSolutionFile,
            newTemplate,
            newProTemplate
            );

        _lastAddedModuleInfo = new AddModuleInfoOutput
        {
            DisplayName                 = moduleInfo.DisplayName,
            Name                        = moduleInfo.Name,
            DocumentationLinks          = moduleInfo.DocumentationLinks,
            InstallationCompleteMessage = moduleInfo.InstallationCompleteMessage
        };
    }
Ejemplo n.º 3
0
        public async Task ExecuteAsync(CommandLineArgs commandLineArgs)
        {
            if (commandLineArgs.Target == null)
            {
                throw new CliUsageException(
                          "Module name is missing!" +
                          Environment.NewLine + Environment.NewLine +
                          GetUsageInfo()
                          );
            }

            var newTemplate = commandLineArgs.Options.ContainsKey(Options.NewTemplate.Long);

            var template       = commandLineArgs.Options.GetOrNull(Options.Template.Short, Options.Template.Long);
            var newProTemplate = !string.IsNullOrEmpty(template) && template == ModuleProTemplate.TemplateName;

            var withSourceCode = newTemplate || newProTemplate || commandLineArgs.Options.ContainsKey(Options.SourceCode.Long);
            var addSourceCodeToSolutionFile = withSourceCode && commandLineArgs.Options.ContainsKey("add-to-solution-file");

            var skipDbMigrations = newTemplate || newProTemplate || Convert.ToBoolean(
                commandLineArgs.Options.GetOrNull(Options.DbMigrations.Skip) ?? "false");

            var solutionFile = GetSolutionFile(commandLineArgs);

            var version = commandLineArgs.Options.GetOrNull(Options.Version.Short, Options.Version.Long);

            if (version == null)
            {
                version = SolutionAbpVersionFinder.Find(solutionFile);
            }

            await SolutionModuleAdder.AddAsync(
                solutionFile,
                commandLineArgs.Target,
                commandLineArgs.Options.GetOrNull(Options.StartupProject.Short, Options.StartupProject.Long),
                version,
                skipDbMigrations,
                withSourceCode,
                addSourceCodeToSolutionFile,
                newTemplate,
                newProTemplate
                );
        }
Ejemplo n.º 4
0
 public AddModuleCommand(SolutionModuleAdder solutionModuleAdder)
 {
     SolutionModuleAdder = solutionModuleAdder;
     Logger = NullLogger <AddModuleCommand> .Instance;
 }
Ejemplo n.º 5
0
 public AddModuleCommand(SolutionModuleAdder solutionModuleAdder, SolutionPackageVersionFinder solutionPackageVersionFinder)
 {
     SolutionModuleAdder          = solutionModuleAdder;
     SolutionPackageVersionFinder = solutionPackageVersionFinder;
     Logger = NullLogger <AddModuleCommand> .Instance;
 }