Skip to content

Commit

Permalink
Merge branch 'stable'
Browse files Browse the repository at this point in the history
* stable:
  (GH-507)(specs) Failing dependency version single tree
  (GH-507)(spec) add constrained versions to project
  (GH-507)(spec) Pkg Dependency single chain
  (spec) build packages at test time
  • Loading branch information
ferventcoder committed Dec 16, 2015
2 parents 2e3db40 + d6a5489 commit df03b54
Show file tree
Hide file tree
Showing 121 changed files with 1,030 additions and 135 deletions.
24 changes: 23 additions & 1 deletion Scenarios.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Chocolatey Usage Scenarios

### ChocolateyInstallCommand [ 30 Scenario(s), 254 Observation(s) ]
### ChocolateyInstallCommand [ 32 Scenario(s), 270 Observation(s) ]

#### when force installing a package that depends on an unavailable newer version of an installed dependency forcing dependencies

Expand Down Expand Up @@ -223,6 +223,18 @@
* should not have warning package result
* should not install a package in the lib directory

#### when installing a package with a dependent package that also depdends on a less constrained but still valid dependency of the same package

* [PENDING] should contain a message that everything installed successfully
* [PENDING] should have a successful package result
* [PENDING] should install a package in the lib directory
* [PENDING] should install the dependency in the lib directory
* [PENDING] should install the expected version of the constrained dependency
* [PENDING] should install the expected version of the dependency
* [PENDING] should install where install location reports
* [PENDING] should not have inconclusive package result
* [PENDING] should not have warning package result

#### when installing a package with config transforms

* should add the insert value in the config due to XDT InsertIfMissing
Expand Down Expand Up @@ -280,6 +292,16 @@
* [PENDING] should not upgrade the exact version dependency
* [PENDING] should not upgrade the minimum version dependency

#### when installing a package with dependencies on an older version of a package than is already installed

* [PENDING] should contain a message that it was unable to install any packages
* [PENDING] should have an error package result
* [PENDING] should not have a successful package result
* [PENDING] should not have inconclusive package result
* [PENDING] should not have warning package result
* [PENDING] should not install the conflicting package in the lib directory
* [PENDING] should not upgrade the exact version dependency

#### when installing a side by side package

* config should match package result name
Expand Down
44 changes: 44 additions & 0 deletions src/chocolatey.tests.integration/NUnitSetup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
namespace chocolatey.tests.integration
{
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using NUnit.Framework;
using SimpleInjector;
Expand All @@ -24,6 +26,7 @@ namespace chocolatey.tests.integration
using chocolatey.infrastructure.app.commands;
using chocolatey.infrastructure.app.configuration;
using chocolatey.infrastructure.filesystem;
using chocolatey.infrastructure.platforms;
using chocolatey.infrastructure.registration;
using chocolatey.infrastructure.services;

Expand All @@ -39,8 +42,13 @@ public override void BeforeEverything()
Container = SimpleInjectorContainer.Container;
fix_application_parameter_variables(Container);
var config = Container.GetInstance<ChocolateyConfiguration>();
config.Information.PlatformType = PlatformType.Windows;
//config.Information.IsInteractive = false;
//config.PromptForConfirmation = false;

var force = config.Force;
config.Force = true;
build_packages(Container, config);
unpack_self(Container,config);
config.Force = force;

Expand Down Expand Up @@ -99,6 +107,42 @@ private void unpack_self(Container container, ChocolateyConfiguration config)
var unpackCommand = container.GetInstance<ChocolateyUnpackSelfCommand>();
unpackCommand.run(config);
}

private void build_packages(Container container, ChocolateyConfiguration config)
{
var input = config.Input;

var fileSystem = container.GetInstance<IFileSystem>();
var contextDir = fileSystem.combine_paths(fileSystem.get_directory_name(fileSystem.get_current_assembly_path()), "context");

// short-circuit building packages if they are already there.
if (fileSystem.get_files(contextDir, "*.nupkg").Any())
{
System.Console.WriteLine("Packages have already been built. Skipping... - If you need to rebuild packages, delete all nupkg files in {0}.".format_with(contextDir));
return;
}

var files = fileSystem.get_files(contextDir, "*.nuspec", SearchOption.AllDirectories);

var command = container.GetInstance<ChocolateyPackCommand>();
foreach (var file in files.or_empty_list_if_null())
{
config.Input = file;
System.Console.WriteLine("Building {0}".format_with(file));
command.run(config);
}

System.Console.WriteLine("Moving all nupkgs in {0} to context directory.".format_with(fileSystem.get_current_directory()));
var nupkgs = fileSystem.get_files(fileSystem.get_current_directory(), "*.nupkg");

foreach (var nupkg in nupkgs.or_empty_list_if_null())
{
fileSystem.copy_file(nupkg,fileSystem.combine_paths(contextDir,fileSystem.get_file_name(nupkg)),overwriteExisting:true);
fileSystem.delete_file(nupkg);
}

config.Input = input;
}
}

// ReSharper restore InconsistentNaming
Expand Down
12 changes: 5 additions & 7 deletions src/chocolatey.tests.integration/Scenario.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,16 @@
namespace chocolatey.tests.integration
{
using System.IO;
using System.Reflection;
using System.Threading;
using NuGet;
using chocolatey.infrastructure.app;
using chocolatey.infrastructure.app.configuration;
using chocolatey.infrastructure.app.domain;
using chocolatey.infrastructure.app.nuget;
using chocolatey.infrastructure.app.services;
using chocolatey.infrastructure.commands;
using chocolatey.infrastructure.filesystem;
using chocolatey.infrastructure.platforms;

public class Scenario
{

private static IChocolateyPackageService _service;

private static readonly DotNetFileSystem _fileSystem = new DotNetFileSystem();
Expand Down Expand Up @@ -88,7 +84,7 @@ public static void install_package(ChocolateyConfiguration config, string packag
{
if (_service == null)
{
_service= NUnitSetup.Container.GetInstance<IChocolateyPackageService>();
_service = NUnitSetup.Container.GetInstance<IChocolateyPackageService>();
}

var originalPackageName = config.PackageNames;
Expand All @@ -114,6 +110,8 @@ private static ChocolateyConfiguration baseline_configuration()
// prior commands, so ensure that all items go back to the default values here
var config = NUnitSetup.Container.GetInstance<ChocolateyConfiguration>();

config.Information.PlatformType = PlatformType.Windows;
config.Information.IsInteractive = false;
config.AcceptLicense = true;
config.AllowMultipleVersions = false;
config.AllowUnofficialBuild = true;
Expand Down Expand Up @@ -183,4 +181,4 @@ public static ChocolateyConfiguration pin()
return config;
}
}
}
}
Loading

0 comments on commit df03b54

Please sign in to comment.