コード例 #1
0
ファイル: UpgradeCommand.cs プロジェクト: KinNeko-De/Honey
        public void Execute(string[] args)
        {
            string  packageId;
            Version packageVersion;
            string  packageSource;
            string  applicationInstallationDir;

            switch (args[1])
            {
            case "--filepath":
                packageSource = Path.GetDirectoryName(args[2]);
                string nugetPackage = Path.GetFileNameWithoutExtension(args[2]);
                var    match        = System.Text.RegularExpressions.Regex.Match(nugetPackage, @"(.*)\.([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)*)");
                packageId      = match.Groups[1].Value;
                packageVersion = new Version(match.Groups[2].Value);

                try
                {
                    applicationInstallationDir = args[3];
                }
                catch (IndexOutOfRangeException e)
                {
                    throw new InvalidOperationException("Target directory was not specified. it will be read from registry later but now you have to add an argument for it :)", e);
                }
                break;

            default:
                packageId      = args[1];
                packageVersion = new Version(args[2]);
                packageSource  = args[3];
                try
                {
                    applicationInstallationDir = args[4];
                }
                catch (IndexOutOfRangeException e)
                {
                    throw new InvalidOperationException("Target directory was not specified. it will be read from registry later but now you have to add an argument for it :)", e);
                }
                break;
            }

            HoneyInstallLocation        honeyInstallLocation       = new HoneyInstallLocation();
            IDeploymentComponentFactory deploymentComponentFactory = new DeploymentComponentFactory(honeyInstallLocation, new PathInstallLocation(applicationInstallationDir));

            INugetPackageRepository nugetPackageRepository = new NugetPackageRepository(new NugetPackageRepositoryConfig(honeyInstallLocation), new PackageSourceRepositoryFactory());
            IPackageListRepository  packageListRepository  = new PackageListRepository(new HoneyInstallLocation(), null);
            IDeploymentController   deploymentController   = new DeploymentController(logger, deploymentComponentFactory, nugetPackageRepository, packageListRepository);

            deploymentController.Upgrade(packageId, packageVersion, packageSource);
        }
コード例 #2
0
 public override void Context()
 {
     repositoryMock  = MockRepository.GenerateStub <IRepository>();
     repository      = new NugetPackageRepository(repositoryMock);
     expectedPackage = new NugetPackage();
 }
コード例 #3
0
 public override void Context()
 {
     repositoryMock = MockRepository.GenerateStub<IRepository>();
     repository = new NugetPackageRepository(repositoryMock);
     expectedPackage = new NugetPackage();
 }