From 6a5beaefaf7760b10f2b08c6b0973f9f07c388c6 Mon Sep 17 00:00:00 2001 From: Jamie Phillips Date: Tue, 19 Dec 2017 14:29:55 -0500 Subject: [PATCH 1/2] Upgrading the cake build version. --- tools/packages.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/packages.config b/tools/packages.config index 7814120..747e13e 100644 --- a/tools/packages.config +++ b/tools/packages.config @@ -1,4 +1,4 @@ - + From 8088b3ea2bd60e2a2e1624378f7427f371837cce Mon Sep 17 00:00:00 2001 From: Charles Phillips Date: Mon, 1 Oct 2018 19:31:23 -0400 Subject: [PATCH 2/2] Converted to .NET Standard 2.0 and Cake 0.28.0 --- .appveyor.yml | 5 + nuspec/nuget/Cake.Ftp.nuspec | 6 +- setup.cake | 6 +- src/Cake.Ftp.Tests/Cake.Ftp.Tests.csproj | 100 ++------ src/Cake.Ftp.Tests/FtpTests.cs | 55 ++--- src/Cake.Ftp.Tests/Properties/AssemblyInfo.cs | 36 --- src/Cake.Ftp.Tests/packages.config | 11 - src/Cake.Ftp.sln | 27 ++- src/Cake.Ftp/Cake.Ftp.csproj | 76 ++----- src/Cake.Ftp/Cake.Ftp.csproj.DotSettings | 2 - src/Cake.Ftp/Cake.Ftp.xml | 215 ++++++++++++++++++ src/Cake.Ftp/Properties/AssemblyInfo.cs | 36 --- src/Cake.Ftp/packages.config | 4 - tools/packages.config | 2 +- 14 files changed, 303 insertions(+), 278 deletions(-) delete mode 100644 src/Cake.Ftp.Tests/Properties/AssemblyInfo.cs delete mode 100644 src/Cake.Ftp.Tests/packages.config delete mode 100644 src/Cake.Ftp/Cake.Ftp.csproj.DotSettings create mode 100644 src/Cake.Ftp/Cake.Ftp.xml delete mode 100644 src/Cake.Ftp/Properties/AssemblyInfo.cs delete mode 100644 src/Cake.Ftp/packages.config diff --git a/.appveyor.yml b/.appveyor.yml index afb3780..08b93d3 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,3 +1,8 @@ +#---------------------------------# +# Build Image # +#---------------------------------# +image: Visual Studio 2017 + #---------------------------------# # Build Script # #---------------------------------# diff --git a/nuspec/nuget/Cake.Ftp.nuspec b/nuspec/nuget/Cake.Ftp.nuspec index b1d2974..b9fbaef 100644 --- a/nuspec/nuget/Cake.Ftp.nuspec +++ b/nuspec/nuget/Cake.Ftp.nuspec @@ -16,8 +16,8 @@ CakeFtp, Cake, Ftp, Script, Build, Addin - - - + + + diff --git a/setup.cake b/setup.cake index 6e17a9c..1d7571f 100644 --- a/setup.cake +++ b/setup.cake @@ -8,7 +8,9 @@ BuildParameters.SetParameters(context: Context, title: "Cake.Ftp", repositoryOwner: "cake-contrib", repositoryName: "Cake.Ftp", - appVeyorAccountName: "cakecontrib"); + appVeyorAccountName: "cakecontrib", + shouldRunDupFinder: false, + shouldRunInspectCode: false); BuildParameters.PrintParameters(Context); @@ -18,4 +20,4 @@ ToolSettings.SetToolSettings(context: Context, testCoverageFilter: "+[*]* -[xunit.*]* -[Cake.Core]* -[Cake.Testing]* -[*.Tests]* ", testCoverageExcludeByAttribute: "*.ExcludeFromCodeCoverage*", testCoverageExcludeByFile: "*/*Designer.cs;*/*.g.cs;*/*.g.i.cs"); -Build.Run(); +Build.RunDotNetCore(); diff --git a/src/Cake.Ftp.Tests/Cake.Ftp.Tests.csproj b/src/Cake.Ftp.Tests/Cake.Ftp.Tests.csproj index 91b330f..7af455f 100644 --- a/src/Cake.Ftp.Tests/Cake.Ftp.Tests.csproj +++ b/src/Cake.Ftp.Tests/Cake.Ftp.Tests.csproj @@ -1,87 +1,25 @@ - - - + + - Debug - AnyCPU - {5F129555-2839-42FE-AB4B-72B9F6B6EBE6} - Library - Properties - Cake.Ftp.Tests - Cake.Ftp.Tests - v4.6 - 512 - + netcoreapp2.1 + + false - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - ..\packages\Cake.Core.0.22.2\lib\net46\Cake.Core.dll - - - ..\packages\Cake.Testing.0.22.2\lib\net46\Cake.Testing.dll - - - ..\packages\NSubstitute.2.0.3\lib\net45\NSubstitute.dll - - - - - - - - - - - ..\packages\xunit.abstractions.2.0.1\lib\net35\xunit.abstractions.dll - True - - - ..\packages\xunit.assert.2.2.0\lib\netstandard1.1\xunit.assert.dll - - - ..\packages\xunit.extensibility.core.2.2.0\lib\netstandard1.1\xunit.core.dll - - - ..\packages\xunit.extensibility.execution.2.2.0\lib\net452\xunit.execution.desktop.dll - - - - - - - + - - {6D4530F4-F5F6-456F-92B7-685CB5A01887} - Cake.Ftp - + + + + + + + all + runtime; build; native; contentfiles; analyzers + + - + - - - \ No newline at end of file + + diff --git a/src/Cake.Ftp.Tests/FtpTests.cs b/src/Cake.Ftp.Tests/FtpTests.cs index a4e2ab3..e81d9f2 100644 --- a/src/Cake.Ftp.Tests/FtpTests.cs +++ b/src/Cake.Ftp.Tests/FtpTests.cs @@ -1,7 +1,7 @@ using System; using Cake.Ftp.Tests.Fixtures; +using FluentAssertions; using Xunit; -using Cake.Testing; namespace Cake.Ftp.Tests { public sealed class FtpTests { @@ -15,8 +15,8 @@ public void Should_Throw_If_File_System_Is_Null() { var result = Record.Exception(() => fixture.UploadFile()); // Then - Assert.IsType(result); - Assert.Equal("fileSystem", ((ArgumentNullException)result).ParamName); + result.Should().BeOfType().Subject + .ParamName.Should().Equals("fileSystem"); } [Fact] @@ -28,8 +28,8 @@ public void Should_Throw_If_Cake_Environment_Is_Null() { var result = Record.Exception(() => fixture.UploadFile()); // Then - Assert.IsType(result); - Assert.Equal("environment", ((ArgumentNullException)result).ParamName); + result.Should().BeOfType().Subject + .ParamName.Should().Equals("environment"); } [Fact] @@ -41,8 +41,8 @@ public void Should_Throw_If_FTP_Service_Is_Null() { var result = Record.Exception(() => fixture.UploadFile()); // Then - Assert.IsType(result); - Assert.Equal("ftpService", ((ArgumentNullException)result).ParamName); + result.Should().BeOfType().Subject + .ParamName.Should().Equals("ftpService"); } } @@ -56,8 +56,8 @@ public void Should_Throw_If_Server_Uri_Is_Null() { var result = Record.Exception(() => fixture.UploadFile()); // Then - Assert.IsType(result); - Assert.Equal("serverUri", ((ArgumentNullException)result).ParamName); + result.Should().BeOfType().Subject + .ParamName.Should().Equals("serverUri"); } [Fact] @@ -69,8 +69,8 @@ public void Should_Throw_If_File_To_Upload_Is_Null() { var result = Record.Exception(() => fixture.UploadFile()); // Then - Assert.IsType(result); - Assert.Equal("fileToUpload", ((ArgumentNullException)result).ParamName); + result.Should().BeOfType().Subject + .ParamName.Should().Equals("fileToUpload"); } [Fact] @@ -82,8 +82,8 @@ public void Should_Throw_If_Username_Is_Null() { var result = Record.Exception(() => fixture.UploadFile()); // Then - Assert.IsType(result); - Assert.Equal("Username", ((ArgumentNullException)result).ParamName); + result.Should().BeOfType().Subject + .ParamName.Should().Equals("Username"); } [Fact] @@ -95,8 +95,8 @@ public void Should_Throw_If_Password_Is_Null() { var result = Record.Exception(() => fixture.UploadFile()); // Then - Assert.IsType(result); - Assert.Equal("Password", ((ArgumentNullException)result).ParamName); + result.Should().BeOfType().Subject + .ParamName.Should().Equals("Password"); } [Fact] @@ -108,8 +108,8 @@ public void Should_Throw_If_Url_Is_Not_FTP_Scheme() { var result = Record.Exception(() => fixture.UploadFile()); // Then - Assert.IsType(result); - Assert.Equal("serverUri", ((ArgumentOutOfRangeException)result).ParamName); + result.Should().BeOfType().Subject + .ParamName.Should().Equals("serverUri"); } [Fact] @@ -121,7 +121,7 @@ public void Should_Upload_File_Without_Error() { var result = Record.Exception(() => fixture.UploadFile()); // Then - Assert.Equal(null, result); + result.Should().BeNull(); } } @@ -135,8 +135,9 @@ public void Should_Throw_If_Server_Uri_Is_Null() { var result = Record.Exception(() => fixture.DeleteFile()); // Then - Assert.IsType(result); - Assert.Equal("serverUri", ((ArgumentNullException)result).ParamName); + result.Should().BeOfType().Subject + .ParamName.Should().Equals("serverUri"); + } [Fact] @@ -148,8 +149,8 @@ public void Should_Throw_If_Username_Is_Null() { var result = Record.Exception(() => fixture.DeleteFile()); // Then - Assert.IsType(result); - Assert.Equal("Username", ((ArgumentNullException)result).ParamName); + result.Should().BeOfType().Subject + .ParamName.Should().Equals("Username"); } [Fact] @@ -161,8 +162,8 @@ public void Should_Throw_If_Password_Is_Null() { var result = Record.Exception(() => fixture.DeleteFile()); // Then - Assert.IsType(result); - Assert.Equal("Password", ((ArgumentNullException)result).ParamName); + result.Should().BeOfType().Subject + .ParamName.Should().Equals("Password"); } [Fact] @@ -174,8 +175,8 @@ public void Should_Throw_If_Url_Is_Not_FTP_Scheme() { var result = Record.Exception(() => fixture.DeleteFile()); // Then - Assert.IsType(result); - Assert.Equal("serverUri", ((ArgumentOutOfRangeException)result).ParamName); + result.Should().BeOfType().Subject + .ParamName.Should().Equals("serverUri"); } [Fact] @@ -187,7 +188,7 @@ public void Should_Delete_File_Without_Error() { var result = Record.Exception(() => fixture.DeleteFile()); // Then - Assert.Equal(null, result); + result.Should().BeNull(); } } } diff --git a/src/Cake.Ftp.Tests/Properties/AssemblyInfo.cs b/src/Cake.Ftp.Tests/Properties/AssemblyInfo.cs deleted file mode 100644 index 0151a43..0000000 --- a/src/Cake.Ftp.Tests/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Cake.Ftp.Tests")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Cake.Ftp.Tests")] -[assembly: AssemblyCopyright("Copyright © 2016")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("5f129555-2839-42fe-ab4b-72b9f6b6ebe6")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/Cake.Ftp.Tests/packages.config b/src/Cake.Ftp.Tests/packages.config deleted file mode 100644 index 1f60595..0000000 --- a/src/Cake.Ftp.Tests/packages.config +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/src/Cake.Ftp.sln b/src/Cake.Ftp.sln index 98e18bd..17ea0b7 100644 --- a/src/Cake.Ftp.sln +++ b/src/Cake.Ftp.sln @@ -1,11 +1,11 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.25420.1 +# Visual Studio 15 +VisualStudioVersion = 15.0.28010.2036 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cake.Ftp", "Cake.Ftp\Cake.Ftp.csproj", "{6D4530F4-F5F6-456F-92B7-685CB5A01887}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cake.Ftp.Tests", "Cake.Ftp.Tests\Cake.Ftp.Tests.csproj", "{58263244-85AE-4A30-B3F2-2AE8DF4AB1AA}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cake.Ftp.Tests", "Cake.Ftp.Tests\Cake.Ftp.Tests.csproj", "{5F129555-2839-42FE-AB4B-72B9F6B6EBE6}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cake.Ftp", "Cake.Ftp\Cake.Ftp.csproj", "{CAB6CDD6-E2B9-4657-B933-0F428C22151A}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -13,16 +13,19 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {6D4530F4-F5F6-456F-92B7-685CB5A01887}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {6D4530F4-F5F6-456F-92B7-685CB5A01887}.Debug|Any CPU.Build.0 = Debug|Any CPU - {6D4530F4-F5F6-456F-92B7-685CB5A01887}.Release|Any CPU.ActiveCfg = Release|Any CPU - {6D4530F4-F5F6-456F-92B7-685CB5A01887}.Release|Any CPU.Build.0 = Release|Any CPU - {5F129555-2839-42FE-AB4B-72B9F6B6EBE6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {5F129555-2839-42FE-AB4B-72B9F6B6EBE6}.Debug|Any CPU.Build.0 = Debug|Any CPU - {5F129555-2839-42FE-AB4B-72B9F6B6EBE6}.Release|Any CPU.ActiveCfg = Release|Any CPU - {5F129555-2839-42FE-AB4B-72B9F6B6EBE6}.Release|Any CPU.Build.0 = Release|Any CPU + {58263244-85AE-4A30-B3F2-2AE8DF4AB1AA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {58263244-85AE-4A30-B3F2-2AE8DF4AB1AA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {58263244-85AE-4A30-B3F2-2AE8DF4AB1AA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {58263244-85AE-4A30-B3F2-2AE8DF4AB1AA}.Release|Any CPU.Build.0 = Release|Any CPU + {CAB6CDD6-E2B9-4657-B933-0F428C22151A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CAB6CDD6-E2B9-4657-B933-0F428C22151A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CAB6CDD6-E2B9-4657-B933-0F428C22151A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CAB6CDD6-E2B9-4657-B933-0F428C22151A}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {61CD2000-94FE-4C8A-9DEC-0DD9903E6633} + EndGlobalSection EndGlobal diff --git a/src/Cake.Ftp/Cake.Ftp.csproj b/src/Cake.Ftp/Cake.Ftp.csproj index 0cfd445..545b41a 100644 --- a/src/Cake.Ftp/Cake.Ftp.csproj +++ b/src/Cake.Ftp/Cake.Ftp.csproj @@ -1,69 +1,19 @@ - - - + + - Debug - AnyCPU - {6D4530F4-F5F6-456F-92B7-685CB5A01887} - Library - Properties - Cake.Ftp - Cake.Ftp - v4.6 - 512 - + netstandard2.0 - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - bin\Debug\Cake.Ftp.XML + + + C:\Users\cphil\code\Cake.Ftp\src\Cake.Ftp\Cake.Ftp.xml - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - bin\Release\Cake.Ftp.XML + + + C:\Users\cphil\code\Cake.Ftp\src\Cake.Ftp\Cake.Ftp.xml + - - ..\packages\Cake.Core.0.22.2\lib\net46\Cake.Core.dll - - - - - - - - - + - - - - - - - - - - - - - - - - \ No newline at end of file + + diff --git a/src/Cake.Ftp/Cake.Ftp.csproj.DotSettings b/src/Cake.Ftp/Cake.Ftp.csproj.DotSettings deleted file mode 100644 index 73e9656..0000000 --- a/src/Cake.Ftp/Cake.Ftp.csproj.DotSettings +++ /dev/null @@ -1,2 +0,0 @@ - - CSharp60 \ No newline at end of file diff --git a/src/Cake.Ftp/Cake.Ftp.xml b/src/Cake.Ftp/Cake.Ftp.xml new file mode 100644 index 0000000..b636748 --- /dev/null +++ b/src/Cake.Ftp/Cake.Ftp.xml @@ -0,0 +1,215 @@ + + + + Cake.Ftp + + + + + Extension methods. + + + + + Throws an exception if the specified parameter's value is null. + + The type of the parameter. + The value of the argument. + The name of the parameter to include in any thrown exception. + Thrown if is null + + + + Throws an exception if the specified parameter's value is null, empty or consists only of white-space characters. + + The value of the argument. + The name of the parameter to include in any thrown exception. + Thrown if is null + Thrown if is empty or consists only of white-space characters + + + + Throws an exception if the specified parameter's value does not match FTP URI scheme. + + The value of the argument. + The name of the parameter to include in any thrown exception. + Thrown if is null + Thrown if is empty or consists only of white-space characters + + + + Contains functionality for working with FTP + + + + + Uploads the file to the FTP server using the supplied credentials. + + + + Task("UploadFile") + .Does(() => { + var fileToUpload = File("some.txt"); + FtpUploadFile("ftp://myserver/random/test.htm", fileToUpload, "some-user", "some-password"); + }); + + + The context. + FTP URI requring FTP:// scehma. + The file to be uploaded. + Username of the FTP account. + Password of the FTP account. + + + + Uploads the file to the FTP server using the supplied credentials. + + + + Task("UploadFile") + .Does(() => { + var fileToUpload = File("some.txt"); + var settings = new FtpSettings() {Username = "some-user", Password = "some-password"}; + FtpUploadFile("ftp://myserver/random/test.htm", fileToUpload, settings); + }); + + + The context. + FTP URI requring FTP:// scehma. + The file to be uploaded. + The settings. + + + + Delets the file on the FTP server using the supplied credentials. + + + + Task("DeleteFile") + .Does(() => { + FtpDeleteFile("ftp://myserver/random/test.htm", "some-user", "some-password"); + }); + + + The context. + FTP URI requring FTP:// scehma. + Username of the FTP account. + Password of the FTP account. + + + + Delets the file on the FTP server using the supplied credentials. + + + + Task("DeleteFile") + .Does(() => { + var settings = new FtpSettings() {Username = "some-user", Password = "some-password"}; + FtpDeleteFile("ftp://myserver/random/test.htm", settings); + }); + + + The context. + FTP URI requring FTP:// scehma. + The settings. + + + + The FTP Client. + + + + + Constructor + + The filesystem. + The cake environment. + The FTP Service. + + + + Uploads file to specified location using the supplied credentials. + + FTP Service URI. + The file to upload. + The settings. + + + + Deletes a file at the specified URI. + + FTP File URI. + The settings. + + + + Contains settings used by + + + + + Gets or sets the FTP username. + + + + + Gets or sets the FTP password. + + + + + The FTP Service. + + + + + Intializes a new instance of the class. + + + + + + Uploads a file. + + The URI for the FTP server. + The file to upload. + The FTP username. + The FTP password. + + + + Deletes a file. + + The URI for the FTP server. + The FTP username. + The FTP password. + + + + Interface for the class. + + + + + Uploads a file. + + The URI for the FTP server. + The file to upload. + The FTP username. + The FTP password. + + + + Deletes a file. + + The URI for the FTP server. + The FTP username. + The FTP password. + + + + Indicates to Code Analysis that a method validates a particular parameter. + + + + diff --git a/src/Cake.Ftp/Properties/AssemblyInfo.cs b/src/Cake.Ftp/Properties/AssemblyInfo.cs deleted file mode 100644 index a0f9002..0000000 --- a/src/Cake.Ftp/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Cake.Ftp")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Cake.Ftp")] -[assembly: AssemblyCopyright("Copyright © 2016")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("6d4530f4-f5f6-456f-92b7-685cb5a01887")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/Cake.Ftp/packages.config b/src/Cake.Ftp/packages.config deleted file mode 100644 index 3e2e2ce..0000000 --- a/src/Cake.Ftp/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/tools/packages.config b/tools/packages.config index 747e13e..0501888 100644 --- a/tools/packages.config +++ b/tools/packages.config @@ -1,4 +1,4 @@ - +