Exemplo n.º 1
0
        public override void GetDynamicOptions(string category, IRequestObject requestObject)
        {
            using (var request = requestObject.As <NuGetRequest>()) {
                try {
                    request.Debug("Calling '{0}::GetDynamicOptions' '{1}'", "NuGet", category);

                    switch ((category ?? string.Empty).ToLowerInvariant())
                    {
                    case "package":
                        request.YieldDynamicOption("FilterOnTag", Constants.OptionType.StringArray, false);
                        request.YieldDynamicOption("Contains", Constants.OptionType.String, false);
                        request.YieldDynamicOption("AllowPrereleaseVersions", Constants.OptionType.Switch, false);
                        break;

                    case "source":
                        request.YieldDynamicOption("ConfigFile", Constants.OptionType.String, false);
                        request.YieldDynamicOption("SkipValidate", Constants.OptionType.Switch, false);
                        break;

                    case "install":
                        request.YieldDynamicOption("Destination", Constants.OptionType.Path, true);
                        request.YieldDynamicOption("SkipDependencies", Constants.OptionType.Switch, false);
                        request.YieldDynamicOption("ContinueOnFailure", Constants.OptionType.Switch, false);
                        request.YieldDynamicOption("ExcludeVersion", Constants.OptionType.Switch, false);
                        request.YieldDynamicOption("PackageSaveMode", Constants.OptionType.String, false, new[] {
                            "nuspec", "nupkg", "nuspec;nupkg"
                        });
                        break;
                    }
                } catch {
                    // this makes it ignore new OptionCategories that it doesn't know about.
                }
            }
        }
Exemplo n.º 2
0
        public void InitializeProvider(IRequestObject requestObject)
        {
            _features.AddOrSet("exe", new[] {
                Assembly.GetAssembly(typeof(NuGet.PackageSource)).Location
            });

            // create a strongly-typed request object.
            using (var request = requestObject.As <NuGetRequest>()) {
                // Nice-to-have put a debug message in that tells what's going on.
                request.Debug("Calling '{0}::InitializeProvider'", ProviderName);

                // Check to see if we're ok to proceed.
                if (!request.IsReady(false))
                {
                }
            }
        }
Exemplo n.º 3
0
 public IEnumerable <string> UnpackArchive(string localFilename, string destinationFolder, IRequestObject requestObject)
 {
     return(new FuncRequestObject <IEnumerable <string> >(this, requestObject.As <IHostApi>(), (request) => Provider.UnpackArchive(localFilename, destinationFolder, request).ByRefEnumerable()).Value);
 }