Skip to content

Commit

Permalink
Merge branch 'stable'
Browse files Browse the repository at this point in the history
* stable:
  (GH-906) Fix source path when installing "*.nuspec"
  (GH-523) Install "*.nupkg" - Be explicit about version
  • Loading branch information
ferventcoder committed Mar 22, 2017
2 parents db5cb13 + 94a448d commit 3be0f1a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
12 changes: 12 additions & 0 deletions src/chocolatey.tests.integration/scenarios/PackScenarios.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ public void generated_package_should_be_in_current_directory()

File.Exists(package_path).ShouldBeTrue();
}

[Fact]
public void sources_should_be_set_to_current_directory()
{
Configuration.Sources.ShouldEqual(Scenario.get_top_level());
}
}

[Concern(typeof(ChocolateyPackCommand))]
Expand Down Expand Up @@ -100,6 +106,12 @@ public void generated_package_should_be_in_specified_output_directory()

File.Exists(package_path).ShouldBeTrue();
}

[Fact]
public void sources_should_be_set_to_specified_output_directory()
{
Configuration.Sources.ShouldEqual("PackageOutput");
}
}

private const string NuspecContent = @"<?xml version=""1.0"" encoding=""utf-8""?>
Expand Down
6 changes: 5 additions & 1 deletion src/chocolatey/infrastructure.app/services/NugetService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,10 @@ public void pack_run(ChocolateyConfiguration config)
}

string outputFile = builder.Id + "." + builder.Version + Constants.PackageExtension;
string outputPath = _fileSystem.combine_paths(config.OutputDirectory ?? _fileSystem.get_current_directory(), outputFile);
string outputFolder = config.OutputDirectory ?? _fileSystem.get_current_directory();
string outputPath = _fileSystem.combine_paths(outputFolder, outputFile);

config.Sources = outputFolder;

this.Log().Info(config.QuietOutput ? ChocolateyLoggers.LogFileOnly : ChocolateyLoggers.Normal, () => "Attempting to build package from '{0}'.".format_with(_fileSystem.get_file_name(nuspecFilePath)));

Expand Down Expand Up @@ -376,6 +379,7 @@ public ConcurrentDictionary<string, PackageResult> install_run(ChocolateyConfigu
else
{
var packageFile = new OptimizedZipPackage(_fileSystem.get_full_path(packageName));
version = packageFile.Version;
packageNames.Add(packageFile.Id);
}
}
Expand Down

0 comments on commit 3be0f1a

Please sign in to comment.