Beispiel #1
0
        private PluginPackageManager(DirectoryPath pluginDirPath,
                                     DirectoryPath pluginHomeDirPath,
                                     DirectoryPath packageDirPath,
                                     NuGetInstalledPluginRepository <TMeta> packageCache,
                                     Func <ISettings, NuGet.SourceRepositoryProvider> providerCreator =
                                     null)
        {
            var settings = Settings.LoadDefaultSettings(packageDirPath.FullPath, null, new NuGetMachineWideSettings());

            _currentFramework  = GetCurrentFramework();
            SourceRepositories = providerCreator?.Invoke(settings) ?? new NuGet.SourceRepositoryProvider(settings);
            PluginRepo         = packageCache;

            var localRepo = SourceRepositories.CreateRepository(
                new PackageSource(packageDirPath.FullPath, "Local", true),
                FeedType.FileSystemPackagesConfig);

            Solution = new NuGetPluginSolution <TMeta>(
                pluginDirPath, pluginHomeDirPath, packageDirPath,
                PluginRepo,
                SourceRepositories,
                settings,
                _currentFramework
                );
        }
 public NuGetPluginInstallSession(NuGetInstalledPluginRepository <TMeta> repo,
                                  PluginPackage <TMeta> plugin)
 {
     _repo  = repo;
     Plugin = plugin;
     CurrentlyInstalling = true;
 }
Beispiel #3
0
        /// <summary>Instantiates a new package manager</summary>
        /// <param name="pluginDirPath"></param>
        /// <param name="pluginHomeDirPath"></param>
        /// <param name="packageDirPath"></param>
        /// <param name="configFilePath"></param>
        /// <param name="providerCreator"></param>
        /// <returns></returns>
        public static async Task <PluginPackageManager <TMeta> > Create(
            DirectoryPath pluginDirPath,
            DirectoryPath pluginHomeDirPath,
            DirectoryPath packageDirPath,
            FilePath configFilePath,
            Func <ISettings, NuGet.SourceRepositoryProvider> providerCreator = null)
        {
            pluginDirPath  = pluginDirPath.Collapse();
            packageDirPath = packageDirPath.Collapse();

            if (pluginDirPath.EnsureExists() == false)
            {
                throw new ArgumentException($"Root path {pluginDirPath.FullPath} doesn't exist and couldn't be created.");
            }

            if (packageDirPath.EnsureExists() == false)
            {
                throw new ArgumentException($"Package path {packageDirPath.FullPath} doesn't exist and couldn't be created.");
            }

            if (configFilePath.Directory.Exists() == false)
            {
                throw new ArgumentException($"Config file's directory {configFilePath.Directory.FullPath} doesn't exist and couldn't be created.");
            }

            var packageCache = await NuGetInstalledPluginRepository <TMeta> .LoadAsync(configFilePath, pluginHomeDirPath);

            return(new PluginPackageManager <TMeta>(
                       pluginDirPath,
                       pluginHomeDirPath,
                       packageDirPath,
                       packageCache,
                       providerCreator));
        }
        internal PluginPackageManager(DirectoryPath pluginDirPath,
                                      DirectoryPath pluginHomeDirPath,
                                      DirectoryPath packageDirPath,
                                      FilePath configFilePath,
                                      Func <ISettings, SourceRepositoryProvider> providerCreator = null)
        {
            pluginDirPath  = pluginDirPath.Collapse();
            packageDirPath = packageDirPath.Collapse();

            if (pluginDirPath.Exists() == false)
            {
                throw new ArgumentException($"Root path {pluginDirPath.FullPath} doesn't exist.");
            }

            if (packageDirPath.Exists() == false)
            {
                throw new ArgumentException($"Package path {packageDirPath.FullPath} doesn't exist.");
            }

            if (configFilePath.Root.Exists() == false)
            {
                throw new ArgumentException($"Config's root directory {configFilePath.Root.FullPath} doesn't exist.");
            }

            var packageCacheTask = NuGetInstalledPluginRepository <TMeta> .LoadAsync(configFilePath);

            var settings = Settings.LoadDefaultSettings(packageDirPath.FullPath, null, new MachineWideSettings());

            _currentFramework   = GetCurrentFramework();
            _sourceRepositories = providerCreator?.Invoke(settings) ?? new SourceRepositoryProvider(settings);
            _pluginRepo         = packageCacheTask.Result;
            _solution           = new NuGetPluginSolution <TMeta>(
                pluginDirPath, pluginHomeDirPath, packageDirPath,
                _pluginRepo,
                _sourceRepositories,
                settings,
                _currentFramework
                );
        }