コード例 #1
0
ファイル: ImportCommand.cs プロジェクト: jnus/OctopusClients
        protected override async Task Execute()
        {
            if (string.IsNullOrWhiteSpace(Type))
            {
                throw new CommandException("Please specify the type of object to import using the paramter: --type=XYZ");
            }
            if (string.IsNullOrWhiteSpace(FilePath))
            {
                throw new CommandException("Please specify the full path and name of the export file to import using the parameter: --filePath=XYZ");
            }

            commandOutputProvider.Debug("Finding importer '{Type:l}'", Type);
            var importer = importerLocator.Find(Type, Repository, FileSystem, commandOutputProvider);

            if (importer == null)
            {
                throw new CommandException("Error: Unrecognized importer '" + Type + "'");
            }

            commandOutputProvider.Debug("Validating the import");
            var validationResult = await importer.Validate(string.Format("FilePath={0}", FilePath), string.Format("Project={0}", Project)).ConfigureAwait(false);

            if (validationResult && !DryRun)
            {
                commandOutputProvider.Debug("Beginning the import");
                await importer.Import(string.Format("FilePath={0}", FilePath), string.Format("Project={0}", Project)).ConfigureAwait(false);
            }
        }
コード例 #2
0
        protected override async Task Execute()
        {
            commandOutputProvider.Warning($"The {AssemblyExtensions.GetExecutableName()} import/export commands have been deprecated. See https://g.octopushq.com/DataMigration for alternative options.");

            if (string.IsNullOrWhiteSpace(Type))
            {
                throw new CommandException("Please specify the type of object to import using the parameter: --type=XYZ");
            }
            if (string.IsNullOrWhiteSpace(FilePath))
            {
                throw new CommandException("Please specify the full path and name of the export file to import using the parameter: --filePath=XYZ");
            }

            commandOutputProvider.Debug("Finding importer '{Type:l}'", Type);
            var importer = importerLocator.Find(Type, Repository, FileSystem, commandOutputProvider);

            if (importer == null)
            {
                throw new CommandException("Error: Unrecognized importer '" + Type + "'");
            }

            commandOutputProvider.Debug("Validating the import");
            var validationResult = await importer.Validate(string.Format("FilePath={0}", FilePath), string.Format("Project={0}", Project)).ConfigureAwait(false);

            if (validationResult && !DryRun)
            {
                commandOutputProvider.Debug("Beginning the import");
                await importer.Import(string.Format("FilePath={0}", FilePath), string.Format("Project={0}", Project)).ConfigureAwait(false);
            }
        }
コード例 #3
0
        protected override void Execute()
        {
            if (string.IsNullOrWhiteSpace(Type))
            {
                throw new CommandException("Please specify the type of object to import using the paramter: --type=XYZ");
            }
            if (string.IsNullOrWhiteSpace(FilePath))
            {
                throw new CommandException("Please specify the full path and name of the export file to import using the parameter: --filePath=XYZ");
            }

            Log.Debug("Finding importer '" + Type + "'");
            var importer = importerLocator.Find(Type, Repository, FileSystem, Log);

            if (importer == null)
            {
                throw new CommandException("Error: Unrecognized importer '" + Type + "'");
            }

            Log.Debug("Validating the import");
            var validationResult = importer.Validate(string.Format("FilePath={0}", FilePath), string.Format("Project={0}", Project));

            if (validationResult && !DryRun)
            {
                Log.Debug("Beginning the import");
                importer.Import(string.Format("FilePath={0}", FilePath), string.Format("Project={0}", Project));
            }
        }