diff --git a/.build.custom/ilmerge.internalize.ignore.dll.txt b/.build.custom/ilmerge.internalize.ignore.dll.txt index 15e662b505..c823182d83 100644 --- a/.build.custom/ilmerge.internalize.ignore.dll.txt +++ b/.build.custom/ilmerge.internalize.ignore.dll.txt @@ -1,2 +1,4 @@ chocolatey.* -NuGet.* \ No newline at end of file +NuGet.* +SimpleInjector.* +Rhino.Licensing.* \ No newline at end of file diff --git a/build.debug.bat b/build.debug.bat new file mode 100644 index 0000000000..12355ea50e --- /dev/null +++ b/build.debug.bat @@ -0,0 +1,35 @@ +@echo off + +::Project UppercuT - http://uppercut.googlecode.com +::No edits to this file are required - http://uppercut.pbwiki.com + +if '%1' == '/?' goto usage +if '%1' == '-?' goto usage +if '%1' == '?' goto usage +if '%1' == '/help' goto usage + +SET DIR=%cd% +SET BUILD_DIR=%~d0%~p0% +SET NANT="%BUILD_DIR%lib\Nant\nant.exe" +SET build.config.settings="%DIR%\.uppercut" + +%NANT% /logger:"NAnt.Core.DefaultLogger" /quiet /nologo /f:"%BUILD_DIR%.build\default.build" -D:build.config.settings=%build.config.settings% -D:msbuild.configuration="Debug" -D:run.nuget="false" -D:test.framework="None" -D:cover.framework="None" -D:run.codesign="false" %* + +::#-D:run.ilmerge="false" + +if %ERRORLEVEL% NEQ 0 goto errors + +call %DIR%\documentscenarios.bat + +goto finish + +:usage +echo. +echo Usage: build.bat +echo. +goto finish + +:errors +EXIT /B %ERRORLEVEL% + +:finish \ No newline at end of file diff --git a/src/chocolatey.console/Program.cs b/src/chocolatey.console/Program.cs index cc35c6c48b..dbd1f8060f 100644 --- a/src/chocolatey.console/Program.cs +++ b/src/chocolatey.console/Program.cs @@ -59,7 +59,7 @@ private static void Main(string[] args) "LogFileOnly".Log().Info(() => "".PadRight(60, '=')); - var config = container.GetInstance(); + var config = Config.get_configuration_settings(); var fileSystem = container.GetInstance(); var warnings = new List(); @@ -71,7 +71,6 @@ private static void Main(string[] args) license, warning => { warnings.Add(warning); } ); - Config.initialize_with(config); report_version_and_exit_if_requested(args, config); diff --git a/src/chocolatey.resources/helpers/functions/Install-ChocolateyPackage.ps1 b/src/chocolatey.resources/helpers/functions/Install-ChocolateyPackage.ps1 index 7578dcdbbb..294dcf2ca1 100644 --- a/src/chocolatey.resources/helpers/functions/Install-ChocolateyPackage.ps1 +++ b/src/chocolatey.resources/helpers/functions/Install-ChocolateyPackage.ps1 @@ -91,6 +91,12 @@ a 32 bit installation on a 64 bit system. Prefer HTTPS when available. Can be HTTP, FTP, or File URIs. +In 0.10.6+, `File` and `FileFullPath` are aliases for Url. These +aliases, if used in earlier versions of Chocolatey, produce `ERROR: +Cannot bind parameter because parameter 'fileType' is specified more +than once.` See https://github.com/chocolatey/choco/issues/1284. Do not +use these aliases with the community package repository until 2018. + .PARAMETER Url64bit OPTIONAL - If there is a 64 bit resource available, use this parameter. Chocolatey will automatically determine if the user is @@ -102,6 +108,13 @@ this parameter. Prefer HTTPS when available. Can be HTTP, FTP, or File URIs. +In 0.10.6+, `File64` and `FileFullPath64` are aliases for Url64Bit. +These aliases, if used in earlier versions of Chocolatey, produce +`ERROR: Cannot bind parameter because parameter 'fileType' is specified +more than once.` See https://github.com/chocolatey/choco/issues/1284. +Do not use these aliases with the community package repository until +2018. + .PARAMETER ValidExitCodes Array of exit codes indicating success. Defaults to `@(0)`. @@ -261,9 +274,9 @@ param( [parameter(Mandatory=$false, Position=1)] [alias("installerType","installType")][string] $fileType = 'exe', [parameter(Mandatory=$false, Position=2)][string[]] $silentArgs = '', - [parameter(Mandatory=$false, Position=3)][string] $url = '', + [alias("file","fileFullPath")][parameter(Mandatory=$false, Position=3)][string] $url = '', [parameter(Mandatory=$false, Position=4)] - [alias("url64")][string] $url64bit = '', + [alias("url64","file64","fileFullPath64")][string] $url64bit = '', [parameter(Mandatory=$false)] $validExitCodes = @(0), [parameter(Mandatory=$false)][string] $checksum = '', [parameter(Mandatory=$false)][string] $checksumType = '', diff --git a/src/chocolatey/GetChocolatey.cs b/src/chocolatey/GetChocolatey.cs index 56a8f2c5a6..a0685934a8 100644 --- a/src/chocolatey/GetChocolatey.cs +++ b/src/chocolatey/GetChocolatey.cs @@ -54,10 +54,10 @@ private static void add_assembly_resolver() { var requestedAssembly = new AssemblyName(args.Name); if (requestedAssembly.get_public_key_token().is_equal_to(ApplicationParameters.OfficialChocolateyPublicKey) - && !requestedAssembly.Name.is_equal_to("chocolatey.licensed") + && !requestedAssembly.Name.is_equal_to("chocolatey.licensed") && !requestedAssembly.Name.EndsWith(".resources", StringComparison.OrdinalIgnoreCase)) { - return typeof(Lets).Assembly; + return typeof(Lets).Assembly; } try @@ -83,11 +83,12 @@ private static void add_assembly_resolver() /// /// The place where all the magic happens. /// + /// Chocolatey - the most magical place on Windows public class GetChocolatey { private readonly Container _container; + private readonly ChocolateyLicense _license; private Action _propConfig; - private ChocolateyLicense _license; /// /// Initializes a new instance of the class. @@ -119,9 +120,9 @@ public GetChocolatey SetCustomLogging(ILog logger) public GetChocolatey Set(Action propConfig) { _propConfig = propConfig; - return this; + return this; } - + /// /// Registers a container component. Does not require a dependency on Simple Injector. /// Will override existing component if registered. @@ -129,9 +130,12 @@ public GetChocolatey Set(Action propConfig) /// The service. /// The implementation. /// This instance + /// + /// This requires you to use ILMerged SimpleInjector. If you use SimpleInjector in your codebase, you must now use Chocolatey's version. This is required to not be internalized so licensed code will work appropriately. + /// public GetChocolatey RegisterContainerComponent(Type service, Type implementation) { - _container.Register(service,implementation,Lifestyle.Singleton); + _container.Register(service, implementation, Lifestyle.Singleton); return this; } @@ -142,8 +146,11 @@ public GetChocolatey RegisterContainerComponent(Type service, Type implementatio /// The type of the service. /// The type of the Implementation. /// This instance - public GetChocolatey RegisterContainerComponent() - where Service : class + /// + /// This requires you to use ILMerged SimpleInjector. If you use SimpleInjector in your codebase, you must now use Chocolatey's version. This is required to not be internalized so licensed code will work appropriately. + /// + public GetChocolatey RegisterContainerComponent() + where Service : class where Implementation : class, Service { return RegisterContainerComponent(Lifestyle.Singleton); @@ -152,17 +159,19 @@ public GetChocolatey RegisterContainerComponent() /// /// Registers a container component. /// Will override existing component if registered. - /// NOTE: This requires you take a dependency on SimpleInjector. /// /// The type of the service. /// The type of the Implementation. /// The lifestyle. /// This instance - public GetChocolatey RegisterContainerComponent(Lifestyle lifestyle) - where Service : class + /// + /// This requires you to use ILMerged SimpleInjector. If you use SimpleInjector in your codebase, you must now use Chocolatey's version. This is required to not be internalized so licensed code will work appropriately. + /// + public GetChocolatey RegisterContainerComponent(Lifestyle lifestyle) + where Service : class where Implementation : class, Service { - _container.Register(lifestyle); + _container.Register(lifestyle); return this; } @@ -173,20 +182,25 @@ public GetChocolatey RegisterContainerComponent(Lifestyl /// The type of the ervice. /// The implementation creator. /// This instance + /// + /// This requires you to use ILMerged SimpleInjector. If you use SimpleInjector in your codebase, you must now use Chocolatey's version. This is required to not be internalized so licensed code will work appropriately. + /// public GetChocolatey RegisterContainerComponent(Func implementationCreator) where Service : class { - _container.Register(implementationCreator,Lifestyle.Singleton); + _container.Register(implementationCreator, Lifestyle.Singleton); return this; } /// /// Register container components when you need to do multiple setups and want to work with the container directly. /// Will override existing components if registered. - /// NOTE: This requires you take a dependency on SimpleInjector. /// /// The container setup. /// This instance + /// + /// This requires you to use ILMerged SimpleInjector. If you use SimpleInjector in your codebase, you must now use Chocolatey's version. This is required to not be internalized so licensed code will work appropriately. + /// public GetChocolatey RegisterContainerComponents(Action containerSetup) { if (containerSetup != null) @@ -198,44 +212,81 @@ public GetChocolatey RegisterContainerComponents(Action containerSetu } /// - /// Call this method to run chocolatey after you have set the options. + /// Returns the Chocolatey container. + /// WARNING: Once you call GetInstance of any kind, no more items can be registered on the container + /// + /// The IoC Container (implemented as a SimpleInjector.Container) + /// + /// This requires you to use ILMerged SimpleInjector. If you use SimpleInjector in your codebase, you must now use Chocolatey's version. This is required to not be internalized so licensed code will work appropriately. + /// + public Container Container() + { + return _container; + } + + /// + /// Call this method to run Chocolatey after you have set the options. + /// WARNING: Once this is called, you will not be able to register additional container components. /// public void Run() { + ensure_environment(); extract_resources(); - var configuration = create_configuration(new List()); - var runner = new GenericRunner(); - runner.run(configuration, _container, isConsole: false, parseArgs: null); + + ensure_original_configuration(new List(), + (config) => + { + config.RegularOutput = true; + var runner = new GenericRunner(); + runner.run(config, _container, isConsole: false, parseArgs: command => + { + command.handle_validation(config); + }); + }); } /// /// Call this method to run chocolatey after you have set the options. - /// Commandline arguments to add to configuration. + /// WARNING: Once this is called, you will not be able to register additional container components. /// + /// Commandline arguments to add to configuration. public void RunConsole(string[] args) { + ensure_environment(); extract_resources(); - var configuration = create_configuration(new List(args)); - var runner = new ConsoleApplication(); - runner.run(args, configuration, _container); + + ensure_original_configuration(new List(args), + (config) => + { + var runner = new ConsoleApplication(); + runner.run(args, config, _container); + }); + } /// /// Run chocolatey after setting the options, and list the results. + /// WARNING: Once this is called, you will not be able to register additional container components. /// /// The typer of results you're expecting back. public IEnumerable List() { + ensure_environment(); extract_resources(); - var configuration = create_configuration(new List()); - configuration.RegularOutput = true; - var runner = new GenericRunner(); - return runner.list(configuration, _container, isConsole: false, parseArgs: null); + + return ensure_original_configuration(new List(), + (config) => + { + config.RegularOutput = true; + var runner = new GenericRunner(); + return runner.list(config, _container, isConsole: false, parseArgs: null); + }); } /// /// Run chocolatey after setting the options, /// and get the count of items that would be returned if you listed the results. + /// WARNING: Once this is called, you will not be able to register additional container components. /// /// /// Is intended to be more efficient then simply calling List and then Count() on the returned list. @@ -243,24 +294,66 @@ public IEnumerable List() /// public int ListCount() { + ensure_environment(); extract_resources(); - var configuration = create_configuration(new List()); - configuration.RegularOutput = true; - var runner = new GenericRunner(); - return runner.count(configuration, _container, isConsole: false, parseArgs: null); + + return ensure_original_configuration(new List(), + (config) => + { + config.RegularOutput = true; + var runner = new GenericRunner(); + return runner.count(config, _container, isConsole: false, parseArgs: null); + }); } + private void ensure_original_configuration(IList args, Action action) + { + var success = ensure_original_configuration(args, + (config) => + { + if (action != null) action.Invoke(config); + return true; + }); + } + + private T ensure_original_configuration(IList args, Func function) + { + var originalConfig = Config.get_configuration_settings().deep_copy(); + var configuration = create_configuration(args); + var returnValue = default(T); + try + { + if (function != null) + { + returnValue = function.Invoke(configuration); + } + } + finally + { + // reset that configuration each time + configuration = originalConfig; + Config.initialize_with(originalConfig); + } + + return returnValue; + } + + /// + /// Creates the configuration. + /// + /// The arguments. + /// The configuration for Chocolatey private ChocolateyConfiguration create_configuration(IList args) { - var configuration = new ChocolateyConfiguration(); + // get or create a ChocolateyConfiguration. This maps directly + // to the same thing that is loaded into the container + var configuration = Config.get_configuration_settings(); ConfigurationBuilder.set_up_configuration( - args, - configuration, - _container, - _license, + args, + configuration, + _container, + _license, null); - - Config.initialize_with(configuration); configuration.PromptForConfirmation = false; configuration.AcceptLicense = true; @@ -272,11 +365,38 @@ private ChocolateyConfiguration create_configuration(IList args) return configuration; } + /// + /// Gets the configuration. Should be used purely for informational purposes + /// + /// The configuration for Chocolatey + /// Only call this once you have registered all container components with Chocolatey public ChocolateyConfiguration GetConfiguration() { + ensure_environment(); + return create_configuration(new List()); } + private void ensure_environment() + { + string chocolateyInstall = string.Empty; + +#if !DEBUG + chocolateyInstall = Environment.GetEnvironmentVariable(ApplicationParameters.ChocolateyInstallEnvironmentVariableName, EnvironmentVariableTarget.Machine); + if (string.IsNullOrWhiteSpace(chocolateyInstall)) + { + chocolateyInstall = Environment.GetEnvironmentVariable(ApplicationParameters.ChocolateyInstallEnvironmentVariableName, EnvironmentVariableTarget.User); + } +#endif + + if (string.IsNullOrWhiteSpace(chocolateyInstall)) + { + chocolateyInstall = Environment.GetEnvironmentVariable(ApplicationParameters.ChocolateyInstallEnvironmentVariableName); + } + + Environment.SetEnvironmentVariable(ApplicationParameters.ChocolateyInstallEnvironmentVariableName, chocolateyInstall); + } + private void extract_resources() { //refactor - thank goodness this is temporary, cuz manifest resource streams are dumb @@ -288,7 +408,15 @@ private void extract_resources() "tools" }; - AssemblyFileExtractor.extract_all_resources_to_relative_directory(_container.GetInstance(), Assembly.GetAssembly(typeof(ChocolateyResourcesAssembly)), ApplicationParameters.InstallLocation, folders, ApplicationParameters.ChocolateyFileResources); + try + { + AssemblyFileExtractor.extract_all_resources_to_relative_directory(_container.GetInstance(), Assembly.GetAssembly(typeof(ChocolateyResourcesAssembly)), ApplicationParameters.InstallLocation, folders, ApplicationParameters.ChocolateyFileResources); + } + catch (Exception ex) + { + this.Log().Error("Unable to extract resources. Please ensure the ChocolateyInstall environment variable is set properly. Details:{0} {1}".format_with(Environment.NewLine,ex.ToString())); + } + } } diff --git a/src/chocolatey/infrastructure.app/ApplicationParameters.cs b/src/chocolatey/infrastructure.app/ApplicationParameters.cs index 3d55651e9e..d4330537cb 100644 --- a/src/chocolatey/infrastructure.app/ApplicationParameters.cs +++ b/src/chocolatey/infrastructure.app/ApplicationParameters.cs @@ -66,7 +66,8 @@ public static class ApplicationParameters public static readonly string ChocolateyPackageInfoStoreLocation = _fileSystem.combine_paths(InstallLocation, ".chocolatey"); public static readonly string ExtensionsLocation = _fileSystem.combine_paths(InstallLocation, "extensions"); public static readonly string TemplatesLocation = _fileSystem.combine_paths(InstallLocation, "templates"); - public static readonly string ChocolateyCommunityFeedPushSource = "https://chocolatey.org/"; + public static readonly string ChocolateyCommunityFeedPushSourceOld = "https://chocolatey.org/"; + public static readonly string ChocolateyCommunityFeedPushSource = "https://push.chocolatey.org/"; public static readonly string ChocolateyCommunityFeedSource = "https://chocolatey.org/api/v2/"; public static readonly string ChocolateyLicensedFeedSource = "https://licensedpackages.chocolatey.org/api/v2/"; public static readonly string ChocolateyLicensedFeedSourceName = "chocolatey.licensed"; diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyApiKeyCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyApiKeyCommand.cs index 1b393f00ba..6a745d646d 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyApiKeyCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyApiKeyCommand.cs @@ -45,7 +45,7 @@ public virtual void configure_argument_parser(OptionSet optionSet, ChocolateyCon "Source [REQUIRED] - The source location for the key", option => configuration.Sources = option.remove_surrounding_quotes()) .Add("k=|key=|apikey=|api-key=", - "ApiKey - The api key for the source.", + "ApiKey - The API key for the source. This is the authentication that identifies you and allows you to push to a source. With some sources this is either a key or it could be a user name and password specified as 'user:password'.", option => configuration.ApiKeyCommand.Key = option.remove_surrounding_quotes()) ; } @@ -82,12 +82,28 @@ choco setapikey [] "chocolatey".Log().Info(ChocolateyLoggers.Important, "Examples"); "chocolatey".Log().Info(@" choco apikey - choco apikey -s""https://somewhere/out/there"" - choco apikey -s""https://somewhere/out/there/"" -k=""value"" - choco apikey -s""https://chocolatey.org/"" -k=""123-123123-123"" + choco apikey -s https://somewhere/out/there + choco apikey -s=""https://somewhere/out/there/"" -k=""value"" + choco apikey -s ""https://push.chocolatey.org/"" -k=""123-123123-123"" + choco apikey -s ""http://internal_nexus"" -k=""user:password"" + +For source location, this can be a folder/file share or an +http location. When it comes to urls, they can be different from the packages +url (where packages are searched and installed from). As an example, for +Chocolatey's community package package repository, the package url is +https://chocolatey.org/api/v2, but the push url is https://push.chocolatey.org +(and the deprecated https://chocolatey.org/ as a push url). Check the +documentation for your choice of repository to learn what the push url is. + +For the key, this can be an apikey that is provided by your source repository. +With some sources, like Nexus, this can be a NuGet API key or it could be a +user name and password specified as 'user:password' for the API key. Please see +your repository's documentation (for Nexus, please see +https://bit.ly/nexus2apikey). + "); - "chocolatey".Log().Info(ChocolateyLoggers.Important, "Connecting to Chocolatey.org"); + "chocolatey".Log().Info(ChocolateyLoggers.Important, "Connecting to Chocolatey.org (Community Package Repository)"); "chocolatey".Log().Info(() => @" In order to save your API key for {0}, log in (or register, confirm and then log in) to diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyPushCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyPushCommand.cs index 8fa8f539ab..7f57268465 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyPushCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyPushCommand.cs @@ -74,6 +74,28 @@ public virtual void handle_additional_argument_parsing(IList unparsedArg if (string.IsNullOrWhiteSpace(configuration.Sources)) { configuration.Sources = ApplicationParameters.ChocolateyCommunityFeedPushSource; + var newSourceKey = _configSettingsService.get_api_key(configuration, null); + + if (string.IsNullOrWhiteSpace(newSourceKey)) + { + configuration.Sources = ApplicationParameters.ChocolateyCommunityFeedPushSourceOld; + var oldSourceKey = _configSettingsService.get_api_key(configuration, null); + + if (string.IsNullOrWhiteSpace(oldSourceKey)) + { + configuration.Sources = ApplicationParameters.ChocolateyCommunityFeedPushSource; + } + else + { + this.Log().Warn(ChocolateyLoggers.Important, @"ACTION: Please update your apikey to use + '{0}' + instead of + '{1}'. + The latter source url is now considered deprecated and will not be + checked as the default source in Chocolatey v1.0. For details, run + `choco apikey -?`".format_with(ApplicationParameters.ChocolateyCommunityFeedPushSource, ApplicationParameters.ChocolateyCommunityFeedPushSourceOld)); + } + } } if (!string.IsNullOrWhiteSpace(configuration.Sources)) diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateySourceCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateySourceCommand.cs index 8b9a42be89..8da74aefd0 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateySourceCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateySourceCommand.cs @@ -47,7 +47,7 @@ public virtual void configure_argument_parser(OptionSet optionSet, ChocolateyCon "Name - the name of the source. Required with some actions. Defaults to empty.", option => configuration.SourceCommand.Name = option.remove_surrounding_quotes()) .Add("s=|source=", - "Source - The source. Defaults to empty.", + "Source - The source. This can be a folder/file share or an http location. If it is a url, it will be a location you can go to in a browser and it returns OData with something that says Packages in the browser, similar to what you see when you go to https://chocolatey.org/api/v2/. Defaults to empty.", option => configuration.Sources = option.remove_surrounding_quotes()) .Add("u=|user=", "User - used with authenticated feeds. Defaults to empty.", @@ -125,12 +125,18 @@ choco sources [list]|add|remove|disable|enable [] "chocolatey".Log().Info(@" choco source choco source list - choco source add -n=bob -s""https://somewhere/out/there/api/v2/"" - choco source add -n=bob -s""'https://somewhere/out/there/api/v2/'"" -cert=\Users\bob\bob.pfx - choco source add -n=bob -s""'https://somewhere/out/there/api/v2/'"" -u=bob -p=12345 + choco source add -n=bob -s=""https://somewhere/out/there/api/v2/"" + choco source add -n=bob -s ""'https://somewhere/out/there/api/v2/'"" -cert=\Users\bob\bob.pfx + choco source add -n=bob -s ""'https://somewhere/out/there/api/v2/'"" -u=bob -p=12345 choco source disable -n=bob choco source enable -n=bob choco source remove -n=bob + +When it comes to the source location, this can be a folder/file share or an http +location. If it is a url, it will be a location you can go to in a browser and +it returns OData with something that says Packages in the browser, similar to +what you see when you go to https://chocolatey.org/api/v2/. + "); "chocolatey".Log().Info(ChocolateyLoggers.Important, "Options and Switches"); diff --git a/src/chocolatey/infrastructure.app/runners/GenericRunner.cs b/src/chocolatey/infrastructure.app/runners/GenericRunner.cs index b735fadfa9..3b82da8945 100644 --- a/src/chocolatey/infrastructure.app/runners/GenericRunner.cs +++ b/src/chocolatey/infrastructure.app/runners/GenericRunner.cs @@ -139,9 +139,7 @@ public void run(ChocolateyConfiguration config, Container container, bool isCons } fail_when_license_is_missing_or_invalid_if_requested(config); - SecurityProtocol.set_protocol(config, provideWarning:true); - EventManager.publish(new PreRunMessage(config)); var command = find_command(config, container, isConsole, parseArgs); @@ -195,27 +193,50 @@ private void remove_nuget_cache(Container container) public IEnumerable list(ChocolateyConfiguration config, Container container, bool isConsole, Action parseArgs) { + var tasks = container.GetAllInstances(); + foreach (var task in tasks) + { + task.initialize(); + } + fail_when_license_is_missing_or_invalid_if_requested(config); + SecurityProtocol.set_protocol(config, provideWarning: true); + EventManager.publish(new PreRunMessage(config)); - var command = find_command(config, container, isConsole, parseArgs) as IListCommand; - if (command == null) + try { - if (!string.IsNullOrWhiteSpace(config.CommandName)) + var command = find_command(config, container, isConsole, parseArgs) as IListCommand; + if (command == null) + { + if (!string.IsNullOrWhiteSpace(config.CommandName)) + { + throw new Exception("The implementation of '{0}' does not support listing '{1}'".format_with(config.CommandName, typeof(T).Name)); + } + return new List(); + } + else { - throw new Exception("The implementation of '{0}' does not support listing '{1}'".format_with(config.CommandName, typeof(T).Name)); + this.Log().Debug("_ {0}:{1} - Normal List Mode _".format_with(ApplicationParameters.Name, command.GetType().Name)); + return command.list(config); } - return new List(); } - else + finally { - this.Log().Debug("_ {0}:{1} - Normal List Mode _".format_with(ApplicationParameters.Name, command.GetType().Name)); - return command.list(config); + EventManager.publish(new PostRunMessage(config)); + + foreach (var task in tasks.or_empty_list_if_null()) + { + task.shutdown(); + } + + remove_nuget_cache(container); } } public int count(ChocolateyConfiguration config, Container container, bool isConsole, Action parseArgs) { fail_when_license_is_missing_or_invalid_if_requested(config); + SecurityProtocol.set_protocol(config, provideWarning: true); var command = find_command(config, container, isConsole, parseArgs) as IListCommand; if (command == null) diff --git a/src/chocolatey/infrastructure.app/services/NugetService.cs b/src/chocolatey/infrastructure.app/services/NugetService.cs index 9320c3859d..5feb17407a 100644 --- a/src/chocolatey/infrastructure.app/services/NugetService.cs +++ b/src/chocolatey/infrastructure.app/services/NugetService.cs @@ -319,9 +319,8 @@ public void push_run(ChocolateyConfiguration config) NugetPush.push_package(config, _fileSystem.get_full_path(nupkgFilePath)); - if (config.Sources.is_equal_to(ApplicationParameters.ChocolateyCommunityFeedPushSource) && config.RegularOutput) + if (config.RegularOutput && (config.Sources.is_equal_to(ApplicationParameters.ChocolateyCommunityFeedPushSource) ||config.Sources.is_equal_to(ApplicationParameters.ChocolateyCommunityFeedPushSourceOld))) { - this.Log().Warn(ChocolateyLoggers.Important, () => @" Your package may be subject to moderation. A moderator will review the diff --git a/src/chocolatey/infrastructure.app/templates/NuspecTemplate.cs b/src/chocolatey/infrastructure.app/templates/NuspecTemplate.cs index cb28bf9435..b8b1d4da45 100644 --- a/src/chocolatey/infrastructure.app/templates/NuspecTemplate.cs +++ b/src/chocolatey/infrastructure.app/templates/NuspecTemplate.cs @@ -61,7 +61,7 @@ public class NuspecTemplate https://_Software_Location_REMOVE_OR_FILL_OUT_ - + diff --git a/src/chocolatey/infrastructure/licensing/LicenseValidation.cs b/src/chocolatey/infrastructure/licensing/LicenseValidation.cs index 07ac93b163..3f12f8b64d 100644 --- a/src/chocolatey/infrastructure/licensing/LicenseValidation.cs +++ b/src/chocolatey/infrastructure/licensing/LicenseValidation.cs @@ -40,6 +40,7 @@ public static ChocolateyLicense validate() //no IFileSystem at this point if (File.Exists(licenseFile)) { + "chocolatey".Log().Debug("Evaluating license file found at '{0}'".format_with(licenseFile)); var license = new LicenseValidator(PUBLIC_KEY, licenseFile); try