From cd7cac5e974175fea1f3590210c478acc1be3724 Mon Sep 17 00:00:00 2001 From: "C. Augusto Proiete" Date: Sat, 15 May 2021 23:20:15 -0300 Subject: [PATCH 1/8] (#7) Update README Closes #7 --- README.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/README.md b/README.md index f59277c..2ce8cf3 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,10 @@ Cake Addin for working with CSV files using the CSVHelper library. [![License](http://img.shields.io/:license-apache-blue.svg)](https://github.com/RadioSystems/Cake.CsvHelper/blob/master/LICENSE) +## Give a Star! :star: + +If you like or are using this project please give it a star. Thanks! + ## Information | | Stable | Pre-release | @@ -41,3 +45,17 @@ On Windows PowerShell run: ```powershell ./build ``` + +## Discussion + +For questions and to discuss ideas & feature requests, use the [GitHub discussions on the Cake GitHub repository](https://github.com/cake-build/cake/discussions), under the [Extension Q&A](https://github.com/cake-build/cake/discussions/categories/extension-q-a) category. + +[![Join in the discussion on the Cake repository](https://img.shields.io/badge/GitHub-Discussions-green?logo=github)](https://github.com/cake-build/cake/discussions) + +## Release History + +Click on the [Releases](https://github.com/cake-contrib/Cake.ISO/releases) tab on GitHub. + +--- + +_Copyright © 2017-2021 Cake Contributors - Provided under the [MIT License](LICENSE)._ From 12e85fc538a7cfd729cb0353dc5375ae130f8b47 Mon Sep 17 00:00:00 2001 From: "C. Augusto Proiete" Date: Sun, 16 May 2021 02:38:20 -0300 Subject: [PATCH 2/8] (#8) Change license from Apache 2.0 to MIT Closes #8 --- LICENSE | 222 +++-------------------------- README.md | 10 +- nuspec/nuget/Cake.CsvHelper.nuspec | 10 +- 3 files changed, 27 insertions(+), 215 deletions(-) diff --git a/LICENSE b/LICENSE index 2fb7155..30d3327 100644 --- a/LICENSE +++ b/LICENSE @@ -1,201 +1,21 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2017 Radio Systems Corporation - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. +MIT License + +Copyright (c) 2017-2021 Cake Contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index 2ce8cf3..90f26dd 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,6 @@ Cake Addin for working with CSV files using the CSVHelper library. -[![License](http://img.shields.io/:license-apache-blue.svg)](https://github.com/RadioSystems/Cake.CsvHelper/blob/master/LICENSE) - ## Give a Star! :star: If you like or are using this project please give it a star. Thanks! @@ -30,12 +28,6 @@ If you like or are using this project please give it a star. Thanks! - [Documentation](https://radiosystems.github.io/Cake.CsvHelper) -## Chat Room - -Come join in the conversation about Cake.CsvHelper in our Gitter Chat Room - -[![Join the chat at https://gitter.im/cake-contrib/Lobby](https://badges.gitter.im/cake-contrib/Lobby.svg)](https://gitter.im/cake-contrib/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) - ## Build To build this package we are using Cake. @@ -54,7 +46,7 @@ For questions and to discuss ideas & feature requests, use the [GitHub discussio ## Release History -Click on the [Releases](https://github.com/cake-contrib/Cake.ISO/releases) tab on GitHub. +Click on the [Releases](https://github.com/cake-contrib/Cake.CsvHelper/releases) tab on GitHub. --- diff --git a/nuspec/nuget/Cake.CsvHelper.nuspec b/nuspec/nuget/Cake.CsvHelper.nuspec index d781083..d19c248 100644 --- a/nuspec/nuget/Cake.CsvHelper.nuspec +++ b/nuspec/nuget/Cake.CsvHelper.nuspec @@ -3,15 +3,15 @@ Cake.CsvHelper 0.0.0 - Radio Systems Corporation - Radio Systems Corporation + cake-contrib + cake-contrib Cake Addin for working with CSV files using the CSVHelper library. A set of aliases for Cake to help with running Gulp scripts as part of a build. - https://github.com/RadioSystems/Cake.CsvHelper/blob/master/LICENSE - https://github.com/RadioSystems/Cake.CsvHelper + https://github.com/cake-contrib/Cake.CsvHelper/blob/master/LICENSE + https://github.com/cake-contrib/Cake.CsvHelper https://cdn.rawgit.com/cake-contrib/graphics/a5cf0f881c390650144b2243ae551d5b9f836196/png/cake-contrib-medium.png false - Copyright (c) Radio Systems Corporation 2017 - Present + Copyright (c) 2017-2021 Cake Contributors Cake, Script, Build, CsvHelper, CSV, Addin From 60cd9eea958c2b0d728d0b279fe5e6fe8ab28766 Mon Sep 17 00:00:00 2001 From: "C. Augusto Proiete" Date: Sun, 16 May 2021 03:02:49 -0300 Subject: [PATCH 3/8] (#3) Add cake-addin tag to Cake.CsvHelper NuGet package Closes #3 --- nuspec/nuget/Cake.CsvHelper.nuspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nuspec/nuget/Cake.CsvHelper.nuspec b/nuspec/nuget/Cake.CsvHelper.nuspec index d19c248..7ea8612 100644 --- a/nuspec/nuget/Cake.CsvHelper.nuspec +++ b/nuspec/nuget/Cake.CsvHelper.nuspec @@ -12,7 +12,7 @@ https://cdn.rawgit.com/cake-contrib/graphics/a5cf0f881c390650144b2243ae551d5b9f836196/png/cake-contrib-medium.png false Copyright (c) 2017-2021 Cake Contributors - Cake, Script, Build, CsvHelper, CSV, Addin + cake csv-helper csvhelper csv cake-addin cake-build cake-contrib addin script build From 3767ff8302748631bd36219c31e71d9ad242c968 Mon Sep 17 00:00:00 2001 From: "C. Augusto Proiete" Date: Sun, 16 May 2021 03:04:28 -0300 Subject: [PATCH 4/8] (#6) Update Cake.CsvHelper NuGet package icon to the new Cake-Contrib logo for Cake addins Closes #6 --- nuspec/nuget/Cake.CsvHelper.nuspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nuspec/nuget/Cake.CsvHelper.nuspec b/nuspec/nuget/Cake.CsvHelper.nuspec index 7ea8612..9146317 100644 --- a/nuspec/nuget/Cake.CsvHelper.nuspec +++ b/nuspec/nuget/Cake.CsvHelper.nuspec @@ -9,7 +9,7 @@ A set of aliases for Cake to help with running Gulp scripts as part of a build. https://github.com/cake-contrib/Cake.CsvHelper/blob/master/LICENSE https://github.com/cake-contrib/Cake.CsvHelper - https://cdn.rawgit.com/cake-contrib/graphics/a5cf0f881c390650144b2243ae551d5b9f836196/png/cake-contrib-medium.png + https://cdn.jsdelivr.net/gh/cake-contrib/graphics/png/addin/cake-contrib-addin-medium.png false Copyright (c) 2017-2021 Cake Contributors cake csv-helper csvhelper csv cake-addin cake-build cake-contrib addin script build From 05fcf554f474b5c32a23f491983f96ba028ea9fb Mon Sep 17 00:00:00 2001 From: "C. Augusto Proiete" Date: Tue, 18 May 2021 23:24:54 -0300 Subject: [PATCH 5/8] Revert "(#8) Change license from Apache 2.0 to MIT" This reverts commit 12e85fc538a7cfd729cb0353dc5375ae130f8b47. --- LICENSE | 222 ++++++++++++++++++++++++++--- README.md | 10 +- nuspec/nuget/Cake.CsvHelper.nuspec | 10 +- 3 files changed, 215 insertions(+), 27 deletions(-) diff --git a/LICENSE b/LICENSE index 30d3327..2fb7155 100644 --- a/LICENSE +++ b/LICENSE @@ -1,21 +1,201 @@ -MIT License - -Copyright (c) 2017-2021 Cake Contributors - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2017 Radio Systems Corporation + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/README.md b/README.md index 90f26dd..2ce8cf3 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ Cake Addin for working with CSV files using the CSVHelper library. +[![License](http://img.shields.io/:license-apache-blue.svg)](https://github.com/RadioSystems/Cake.CsvHelper/blob/master/LICENSE) + ## Give a Star! :star: If you like or are using this project please give it a star. Thanks! @@ -28,6 +30,12 @@ If you like or are using this project please give it a star. Thanks! - [Documentation](https://radiosystems.github.io/Cake.CsvHelper) +## Chat Room + +Come join in the conversation about Cake.CsvHelper in our Gitter Chat Room + +[![Join the chat at https://gitter.im/cake-contrib/Lobby](https://badges.gitter.im/cake-contrib/Lobby.svg)](https://gitter.im/cake-contrib/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) + ## Build To build this package we are using Cake. @@ -46,7 +54,7 @@ For questions and to discuss ideas & feature requests, use the [GitHub discussio ## Release History -Click on the [Releases](https://github.com/cake-contrib/Cake.CsvHelper/releases) tab on GitHub. +Click on the [Releases](https://github.com/cake-contrib/Cake.ISO/releases) tab on GitHub. --- diff --git a/nuspec/nuget/Cake.CsvHelper.nuspec b/nuspec/nuget/Cake.CsvHelper.nuspec index 9146317..f9468cb 100644 --- a/nuspec/nuget/Cake.CsvHelper.nuspec +++ b/nuspec/nuget/Cake.CsvHelper.nuspec @@ -3,15 +3,15 @@ Cake.CsvHelper 0.0.0 - cake-contrib - cake-contrib + Radio Systems Corporation + Radio Systems Corporation Cake Addin for working with CSV files using the CSVHelper library. A set of aliases for Cake to help with running Gulp scripts as part of a build. - https://github.com/cake-contrib/Cake.CsvHelper/blob/master/LICENSE - https://github.com/cake-contrib/Cake.CsvHelper + https://github.com/RadioSystems/Cake.CsvHelper/blob/master/LICENSE + https://github.com/RadioSystems/Cake.CsvHelper https://cdn.jsdelivr.net/gh/cake-contrib/graphics/png/addin/cake-contrib-addin-medium.png false - Copyright (c) 2017-2021 Cake Contributors + Copyright (c) Radio Systems Corporation 2017 - Present cake csv-helper csvhelper csv cake-addin cake-build cake-contrib addin script build From 46ee7797a2776a4e74d3c77dce532bfa4b7c6d80 Mon Sep 17 00:00:00 2001 From: "C. Augusto Proiete" Date: Wed, 19 May 2021 00:34:43 -0300 Subject: [PATCH 6/8] Revert "(#8) Change license from Apache 2.0 to MIT" This reverts commit 12e85fc538a7cfd729cb0353dc5375ae130f8b47. --- README.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/README.md b/README.md index 2ce8cf3..9450445 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,3 @@ For questions and to discuss ideas & feature requests, use the [GitHub discussio ## Release History Click on the [Releases](https://github.com/cake-contrib/Cake.ISO/releases) tab on GitHub. - ---- - -_Copyright © 2017-2021 Cake Contributors - Provided under the [MIT License](LICENSE)._ From df961309e1879d719a95262b42db5231d35a0b52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Pluci=C5=84ski?= Date: Sun, 5 Dec 2021 13:08:59 +0100 Subject: [PATCH 7/8] Upgraded do cake 2.0.0. Following cake-contrib guidelines --- .appveyor.yml | 3 +- .config/dotnet-tools.json | 12 + .editorconfig | 255 ++++++++++++++++++ build.ps1 | 194 +------------ nuspec/nuget/Cake.CsvHelper.nuspec | 18 +- .../Cake.CsvHelper.Tests.csproj | 167 ++---------- .../CsvHelperAliasesTests.cs | 37 +-- src/Cake.CsvHelper.Tests/CsvHelperTests.cs | 191 +++++++------ .../Fixtures/CsvHelpersFixture.cs | 91 ++++--- src/Cake.CsvHelper.Tests/Fixtures/Person.cs | 8 + .../Fixtures/PersonMap.cs | 15 ++ .../Properties/AssemblyInfo.cs | 36 --- src/Cake.CsvHelper.Tests/app.config | 11 - src/Cake.CsvHelper.Tests/packages.config | 52 ---- src/Cake.CsvHelper.sln | 14 +- src/Cake.CsvHelper/Cake.CsvHelper.csproj | 80 ++---- src/Cake.CsvHelper/CsvHelperAliases.cs | 52 ++-- src/Cake.CsvHelper/CsvHelperSettings.cs | 161 +++++------ src/Cake.CsvHelper/CsvHelpers.cs | 97 +++++-- src/Cake.CsvHelper/Properties/AssemblyInfo.cs | 36 --- src/Cake.CsvHelper/packages.config | 5 - src/Directory.Build.props | 82 ++++++ src/stylecop.json | 18 ++ tools/packages.config | 4 - 24 files changed, 812 insertions(+), 827 deletions(-) create mode 100644 .config/dotnet-tools.json create mode 100644 .editorconfig create mode 100644 src/Cake.CsvHelper.Tests/Fixtures/Person.cs create mode 100644 src/Cake.CsvHelper.Tests/Fixtures/PersonMap.cs delete mode 100644 src/Cake.CsvHelper.Tests/Properties/AssemblyInfo.cs delete mode 100644 src/Cake.CsvHelper.Tests/app.config delete mode 100644 src/Cake.CsvHelper.Tests/packages.config delete mode 100644 src/Cake.CsvHelper/Properties/AssemblyInfo.cs delete mode 100644 src/Cake.CsvHelper/packages.config create mode 100644 src/Directory.Build.props create mode 100644 src/stylecop.json delete mode 100644 tools/packages.config diff --git a/.appveyor.yml b/.appveyor.yml index afb3780..2794dd0 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -2,7 +2,7 @@ # Build Script # #---------------------------------# build_script: - - ps: .\build.ps1 -Target AppVeyor + - ps: .\build.ps1 --target AppVeyor # Tests test: off @@ -22,5 +22,4 @@ branches: # Build Cache # #---------------------------------# cache: -- Source\packages -> Source\**\packages.config - tools -> setup.cake \ No newline at end of file diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json new file mode 100644 index 0000000..31e896e --- /dev/null +++ b/.config/dotnet-tools.json @@ -0,0 +1,12 @@ +{ + "version": 1, + "isRoot": true, + "tools": { + "cake.tool": { + "version": "2.0.0", + "commands": [ + "dotnet-cake" + ] + } + } +} \ No newline at end of file diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..7359804 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,255 @@ +# EditorConfig is awesome: http://EditorConfig.org + +# top-most EditorConfig file +root = true + +# C# files +[*.cs] + +#### Core EditorConfig Options #### + +# Indentation and spacing +indent_size = 4 +indent_style = space +tab_width = 4 + +# New line preferences +end_of_line = crlf +insert_final_newline = true + +#### .NET Coding Conventions #### + +# Organize usings +dotnet_separate_import_directive_groups = true +dotnet_sort_system_directives_first = true +file_header_template = unset + +# this. and Me. preferences +dotnet_style_qualification_for_event = false:warning +dotnet_style_qualification_for_field = false:warning +dotnet_style_qualification_for_method = false:warning +dotnet_style_qualification_for_property = false:warning + +# Language keywords vs BCL types preferences +dotnet_style_predefined_type_for_locals_parameters_members = true:warning +dotnet_style_predefined_type_for_member_access = true:warning + +# Parentheses preferences +dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent +dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent +dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent +dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent + +# Modifier preferences +dotnet_style_require_accessibility_modifiers = for_non_interface_members:warning + +# Expression-level preferences +dotnet_style_coalesce_expression = true:suggestion +dotnet_style_collection_initializer = true:suggestion +dotnet_style_explicit_tuple_names = true:suggestion +dotnet_style_null_propagation = true:suggestion +dotnet_style_object_initializer = true:suggestion +dotnet_style_operator_placement_when_wrapping = beginning_of_line +dotnet_style_prefer_auto_properties = true:silent +dotnet_style_prefer_compound_assignment = true:suggestion +dotnet_style_prefer_conditional_expression_over_assignment = true:silent +dotnet_style_prefer_conditional_expression_over_return = true:silent +dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion +dotnet_style_prefer_inferred_tuple_names = true:suggestion +dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion +dotnet_style_prefer_simplified_boolean_expressions = true:suggestion +dotnet_style_prefer_simplified_interpolation = true:suggestion + +# Field preferences +dotnet_style_readonly_field = true:suggestion + +# Parameter preferences +dotnet_code_quality_unused_parameters = all:suggestion + +#### C# Coding Conventions #### + +# var preferences +csharp_style_var_elsewhere = false:silent +csharp_style_var_for_built_in_types = false:silent +csharp_style_var_when_type_is_apparent = false:silent + +# Expression-bodied members +csharp_style_expression_bodied_accessors = true:silent +csharp_style_expression_bodied_constructors = false:silent +csharp_style_expression_bodied_indexers = true:silent +csharp_style_expression_bodied_lambdas = true:silent +csharp_style_expression_bodied_local_functions = false:silent +csharp_style_expression_bodied_methods = false:silent +csharp_style_expression_bodied_operators = false:silent +csharp_style_expression_bodied_properties = true:silent + +# Pattern matching preferences +csharp_style_pattern_matching_over_as_with_null_check = true:suggestion +csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion +csharp_style_prefer_switch_expression = true:suggestion + +# Null-checking preferences +csharp_style_conditional_delegate_call = true:suggestion + +# Modifier preferences +csharp_prefer_static_local_function = true:suggestion +csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:silent + +# Code-block preferences +csharp_prefer_braces = true:silent +csharp_prefer_simple_using_statement = true:suggestion + +# Expression-level preferences +csharp_prefer_simple_default_expression = true:suggestion +csharp_style_deconstructed_variable_declaration = true:suggestion +csharp_style_inlined_variable_declaration = true:suggestion +csharp_style_pattern_local_over_anonymous_function = true:suggestion +csharp_style_prefer_index_operator = true:suggestion +csharp_style_prefer_range_operator = true:suggestion +csharp_style_throw_expression = true:suggestion +csharp_style_unused_value_assignment_preference = discard_variable:suggestion +csharp_style_unused_value_expression_statement_preference = discard_variable:silent + +# 'using' directive preferences +csharp_using_directive_placement = outside_namespace:warning + +#### C# Formatting Rules #### + +# New line preferences +csharp_new_line_before_catch = true +csharp_new_line_before_else = true +csharp_new_line_before_finally = true +csharp_new_line_before_members_in_anonymous_types = true +csharp_new_line_before_members_in_object_initializers = true +csharp_new_line_before_open_brace = all +csharp_new_line_between_query_expression_clauses = true + +# Indentation preferences +csharp_indent_block_contents = true +csharp_indent_braces = false +csharp_indent_case_contents = true +csharp_indent_case_contents_when_block = false +csharp_indent_labels = flush_left +csharp_indent_switch_labels = true + +# Space preferences +csharp_space_after_cast = false +csharp_space_after_colon_in_inheritance_clause = true +csharp_space_after_comma = true +csharp_space_after_dot = false +csharp_space_after_keywords_in_control_flow_statements = true +csharp_space_after_semicolon_in_for_statement = true +csharp_space_around_binary_operators = before_and_after +csharp_space_around_declaration_statements = false +csharp_space_before_colon_in_inheritance_clause = true +csharp_space_before_comma = false +csharp_space_before_dot = false +csharp_space_before_open_square_brackets = false +csharp_space_before_semicolon_in_for_statement = false +csharp_space_between_empty_square_brackets = false +csharp_space_between_method_call_empty_parameter_list_parentheses = false +csharp_space_between_method_call_name_and_opening_parenthesis = false +csharp_space_between_method_call_parameter_list_parentheses = false +csharp_space_between_method_declaration_empty_parameter_list_parentheses = false +csharp_space_between_method_declaration_name_and_open_parenthesis = false +csharp_space_between_method_declaration_parameter_list_parentheses = false +csharp_space_between_parentheses = false +csharp_space_between_square_brackets = false + +# Wrapping preferences +csharp_preserve_single_line_blocks = true +csharp_preserve_single_line_statements = false + +#### Naming styles #### + +# Naming rules + +dotnet_naming_rule.interface_should_be_begins_with_i.severity = warning +dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface +dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i + +dotnet_naming_rule.types_should_be_pascal_case.severity = warning +dotnet_naming_rule.types_should_be_pascal_case.symbols = types +dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case + +dotnet_naming_rule.method_should_be_pascal_case.severity = warning +dotnet_naming_rule.method_should_be_pascal_case.symbols = method +dotnet_naming_rule.method_should_be_pascal_case.style = pascal_case + +dotnet_naming_rule.public_or_protected_field_should_be_pascal_case.severity = warning +dotnet_naming_rule.public_or_protected_field_should_be_pascal_case.symbols = public_or_protected_field +dotnet_naming_rule.public_or_protected_field_should_be_pascal_case.style = pascal_case + +dotnet_naming_rule.private_or_internal_static_field_should_be_pascal_case.severity = warning +dotnet_naming_rule.private_or_internal_static_field_should_be_pascal_case.symbols = private_or_internal_static_field +dotnet_naming_rule.private_or_internal_static_field_should_be_pascal_case.style = pascal_case + +#dotnet_naming_rule.private_or_internal_field_should_be_camelcase.severity = warning +#dotnet_naming_rule.private_or_internal_field_should_be_camelcase.symbols = private_or_internal_field +#dotnet_naming_rule.private_or_internal_field_should_be_camelcase.style = camelcase + +dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = warning +dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members +dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case + +# Symbol specifications + +dotnet_naming_symbols.interface.applicable_kinds = interface +dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.interface.required_modifiers = + +dotnet_naming_symbols.method.applicable_kinds = method +dotnet_naming_symbols.method.applicable_accessibilities = public +dotnet_naming_symbols.method.required_modifiers = + +dotnet_naming_symbols.public_or_protected_field.applicable_kinds = field +dotnet_naming_symbols.public_or_protected_field.applicable_accessibilities = public, protected +dotnet_naming_symbols.public_or_protected_field.required_modifiers = + +dotnet_naming_symbols.private_or_internal_field.applicable_kinds = field +dotnet_naming_symbols.private_or_internal_field.applicable_accessibilities = internal, private, private_protected +dotnet_naming_symbols.private_or_internal_field.required_modifiers = + +dotnet_naming_symbols.private_or_internal_static_field.applicable_kinds = field +dotnet_naming_symbols.private_or_internal_static_field.applicable_accessibilities = internal, private, private_protected +dotnet_naming_symbols.private_or_internal_static_field.required_modifiers = static + +dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum +dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.types.required_modifiers = + +dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method +dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.non_field_members.required_modifiers = + +# Naming styles + +dotnet_naming_style.pascal_case.required_prefix = +dotnet_naming_style.pascal_case.required_suffix = +dotnet_naming_style.pascal_case.word_separator = +dotnet_naming_style.pascal_case.capitalization = pascal_case + +dotnet_naming_style.begins_with_i.required_prefix = I +dotnet_naming_style.begins_with_i.required_suffix = +dotnet_naming_style.begins_with_i.word_separator = +dotnet_naming_style.begins_with_i.capitalization = pascal_case + +dotnet_naming_style.camelcase.required_prefix = +dotnet_naming_style.camelcase.required_suffix = +dotnet_naming_style.camelcase.word_separator = +dotnet_naming_style.camelcase.capitalization = camel_case + +dotnet_naming_rule.instance_fields_should_be_camel_case.severity = suggestion +dotnet_naming_rule.instance_fields_should_be_camel_case.symbols = instance_fields +dotnet_naming_rule.instance_fields_should_be_camel_case.style = instance_field_style +dotnet_naming_symbols.instance_fields.applicable_kinds = field +dotnet_naming_style.instance_field_style.capitalization = camel_case +dotnet_naming_style.instance_field_style.required_prefix = _ + +# Rules: + +# SA1101: Prefix local calls with this +dotnet_diagnostic.SA1101.severity = none +dotnet_diagnostic.SA1309.severity = none +dotnet_diagnostic.SA1600.severity = none +dotnet_diagnostic.SA1633.severity = none \ No newline at end of file diff --git a/build.ps1 b/build.ps1 index 1f2d7a3..21821d2 100644 --- a/build.ps1 +++ b/build.ps1 @@ -1,189 +1,13 @@ -########################################################################## -# This is the Cake bootstrapper script for PowerShell. -# This file was downloaded from https://github.com/cake-build/resources -# Feel free to change this file to fit your needs. -########################################################################## +$ErrorActionPreference = 'Stop' -<# +Set-Location -LiteralPath $PSScriptRoot -.SYNOPSIS -This is a Powershell script to bootstrap a Cake build. +$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE = '1' +$env:DOTNET_CLI_TELEMETRY_OPTOUT = '1' +$env:DOTNET_NOLOGO = '1' -.DESCRIPTION -This Powershell script will download NuGet if missing, restore NuGet tools (including Cake) -and execute your Cake build script with the parameters you provide. +dotnet tool restore +if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } -.PARAMETER Script -The build script to execute. -.PARAMETER Target -The build script target to run. -.PARAMETER Configuration -The build configuration to use. -.PARAMETER Verbosity -Specifies the amount of information to be displayed. -.PARAMETER Experimental -Tells Cake to use the latest Roslyn release. -.PARAMETER WhatIf -Performs a dry run of the build script. -No tasks will be executed. -.PARAMETER Mono -Tells Cake to use the Mono scripting engine. -.PARAMETER SkipToolPackageRestore -Skips restoring of packages. -.PARAMETER ScriptArgs -Remaining arguments are added here. - -.LINK -http://cakebuild.net - -#> - -[CmdletBinding()] -Param( - [string]$Script = "setup.cake", - [string]$Target = "Default", - [ValidateSet("Release", "Debug")] - [string]$Configuration = "Release", - [ValidateSet("Quiet", "Minimal", "Normal", "Verbose", "Diagnostic")] - [string]$Verbosity = "Verbose", - [switch]$Experimental, - [Alias("DryRun","Noop")] - [switch]$WhatIf, - [switch]$Mono, - [switch]$SkipToolPackageRestore, - [Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)] - [string[]]$ScriptArgs -) - -[Reflection.Assembly]::LoadWithPartialName("System.Security") | Out-Null -function MD5HashFile([string] $filePath) -{ - if ([string]::IsNullOrEmpty($filePath) -or !(Test-Path $filePath -PathType Leaf)) - { - return $null - } - - [System.IO.Stream] $file = $null; - [System.Security.Cryptography.MD5] $md5 = $null; - try - { - $md5 = [System.Security.Cryptography.MD5]::Create() - $file = [System.IO.File]::OpenRead($filePath) - return [System.BitConverter]::ToString($md5.ComputeHash($file)) - } - finally - { - if ($file -ne $null) - { - $file.Dispose() - } - } -} - -Write-Host "Preparing to run build script..." - -if(!$PSScriptRoot){ - $PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent -} - -$TOOLS_DIR = Join-Path $PSScriptRoot "tools" -$NUGET_EXE = Join-Path $TOOLS_DIR "nuget.exe" -$CAKE_EXE = Join-Path $TOOLS_DIR "Cake/Cake.exe" -$NUGET_URL = "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe" -$PACKAGES_CONFIG = Join-Path $TOOLS_DIR "packages.config" -$PACKAGES_CONFIG_MD5 = Join-Path $TOOLS_DIR "packages.config.md5sum" - -# Should we use mono? -$UseMono = ""; -if($Mono.IsPresent) { - Write-Verbose -Message "Using the Mono based scripting engine." - $UseMono = "-mono" -} - -# Should we use the new Roslyn? -$UseExperimental = ""; -if($Experimental.IsPresent -and !($Mono.IsPresent)) { - Write-Verbose -Message "Using experimental version of Roslyn." - $UseExperimental = "-experimental" -} - -# Is this a dry run? -$UseDryRun = ""; -if($WhatIf.IsPresent) { - $UseDryRun = "-dryrun" -} - -# Make sure tools folder exists -if ((Test-Path $PSScriptRoot) -and !(Test-Path $TOOLS_DIR)) { - Write-Verbose -Message "Creating tools directory..." - New-Item -Path $TOOLS_DIR -Type directory | out-null -} - -# Make sure that packages.config exist. -if (!(Test-Path $PACKAGES_CONFIG)) { - Write-Verbose -Message "Downloading packages.config..." - try { (New-Object System.Net.WebClient).DownloadFile("http://cakebuild.net/download/bootstrapper/packages", $PACKAGES_CONFIG) } catch { - Throw "Could not download packages.config." - } -} - -# Try find NuGet.exe in path if not exists -if (!(Test-Path $NUGET_EXE)) { - Write-Verbose -Message "Trying to find nuget.exe in PATH..." - $existingPaths = $Env:Path -Split ';' | Where-Object { (![string]::IsNullOrEmpty($_)) -and (Test-Path $_ -PathType Container) } - $NUGET_EXE_IN_PATH = Get-ChildItem -Path $existingPaths -Filter "nuget.exe" | Select -First 1 - if ($NUGET_EXE_IN_PATH -ne $null -and (Test-Path $NUGET_EXE_IN_PATH.FullName)) { - Write-Verbose -Message "Found in PATH at $($NUGET_EXE_IN_PATH.FullName)." - $NUGET_EXE = $NUGET_EXE_IN_PATH.FullName - } -} - -# Try download NuGet.exe if not exists -if (!(Test-Path $NUGET_EXE)) { - Write-Verbose -Message "Downloading NuGet.exe..." - try { - (New-Object System.Net.WebClient).DownloadFile($NUGET_URL, $NUGET_EXE) - } catch { - Throw "Could not download NuGet.exe." - } -} - -# Save nuget.exe path to environment to be available to child processed -$ENV:NUGET_EXE = $NUGET_EXE - -# Restore tools from NuGet? -if(-Not $SkipToolPackageRestore.IsPresent) { - Push-Location - Set-Location $TOOLS_DIR - - # Check for changes in packages.config and remove installed tools if true. - [string] $md5Hash = MD5HashFile($PACKAGES_CONFIG) - if((!(Test-Path $PACKAGES_CONFIG_MD5)) -Or - ($md5Hash -ne (Get-Content $PACKAGES_CONFIG_MD5 ))) { - Write-Verbose -Message "Missing or changed package.config hash..." - Remove-Item * -Recurse -Exclude packages.config,nuget.exe - } - - Write-Verbose -Message "Restoring tools from NuGet..." - $NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install -ExcludeVersion -OutputDirectory `"$TOOLS_DIR`"" - - if ($LASTEXITCODE -ne 0) { - Throw "An error occured while restoring NuGet tools." - } - else - { - $md5Hash | Out-File $PACKAGES_CONFIG_MD5 -Encoding "ASCII" - } - Write-Verbose -Message ($NuGetOutput | out-string) - Pop-Location -} - -# Make sure that Cake has been installed. -if (!(Test-Path $CAKE_EXE)) { - Throw "Could not find Cake.exe at $CAKE_EXE" -} - -# Start Cake -Write-Host "Running build script..." -Invoke-Expression "& `"$CAKE_EXE`" `"$Script`" -target=`"$Target`" -configuration=`"$Configuration`" -verbosity=`"$Verbosity`" $UseMono $UseDryRun $UseExperimental $ScriptArgs" -exit $LASTEXITCODE \ No newline at end of file +dotnet cake @args +if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } diff --git a/nuspec/nuget/Cake.CsvHelper.nuspec b/nuspec/nuget/Cake.CsvHelper.nuspec index f9468cb..5749cd1 100644 --- a/nuspec/nuget/Cake.CsvHelper.nuspec +++ b/nuspec/nuget/Cake.CsvHelper.nuspec @@ -12,13 +12,19 @@ https://cdn.jsdelivr.net/gh/cake-contrib/graphics/png/addin/cake-contrib-addin-medium.png false Copyright (c) Radio Systems Corporation 2017 - Present - cake csv-helper csvhelper csv cake-addin cake-build cake-contrib addin script build + cake script build cake-build addin cake-addin csv-helper csvhelper csv - - - - - + + + + + + + + + + + \ No newline at end of file diff --git a/src/Cake.CsvHelper.Tests/Cake.CsvHelper.Tests.csproj b/src/Cake.CsvHelper.Tests/Cake.CsvHelper.Tests.csproj index 3188e97..8ca974b 100644 --- a/src/Cake.CsvHelper.Tests/Cake.CsvHelper.Tests.csproj +++ b/src/Cake.CsvHelper.Tests/Cake.CsvHelper.Tests.csproj @@ -1,157 +1,24 @@ - - - - + + - Debug - AnyCPU - {1691864A-29DA-4ED9-A2C1-3EE39D006F51} - Library - Properties - Cake.CsvHelper.Tests - Cake.CsvHelper.Tests - v4.6.1 - 512 - - - + netcoreapp3.1;net5.0;net6.0 + true - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - ..\packages\Cake.Core.0.23.0\lib\net46\Cake.Core.dll - - - ..\packages\Cake.Testing.0.23.0\lib\net46\Cake.Testing.dll - - - ..\packages\Castle.Core.4.2.1\lib\net45\Castle.Core.dll - - - ..\packages\CsvHelper.6.0.0\lib\net45\CsvHelper.dll - - - ..\packages\NSubstitute.3.1.0\lib\net46\NSubstitute.dll - - - ..\packages\Should.1.1.20\lib\Should.dll - True - - - - - - - ..\packages\System.IO.Compression.4.3.0\lib\net46\System.IO.Compression.dll - True - - - ..\packages\System.Net.Http.4.3.3\lib\net46\System.Net.Http.dll - - - - ..\packages\System.Runtime.InteropServices.RuntimeInformation.4.3.0\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll - True - - - ..\packages\System.Security.Cryptography.Algorithms.4.3.1\lib\net461\System.Security.Cryptography.Algorithms.dll - - - ..\packages\System.Security.Cryptography.Encoding.4.3.0\lib\net46\System.Security.Cryptography.Encoding.dll - - - ..\packages\System.Security.Cryptography.Primitives.4.3.0\lib\net46\System.Security.Cryptography.Primitives.dll - - - ..\packages\System.Security.Cryptography.X509Certificates.4.3.2\lib\net461\System.Security.Cryptography.X509Certificates.dll - - - ..\packages\System.Threading.Tasks.Extensions.4.4.0\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll - - - - - - - - ..\packages\System.Xml.ReaderWriter.4.3.0\lib\net46\System.Xml.ReaderWriter.dll - - - ..\packages\xunit.abstractions.2.0.1\lib\net35\xunit.abstractions.dll - True - - - ..\packages\xunit.assert.2.3.1\lib\netstandard1.1\xunit.assert.dll - - - ..\packages\xunit.extensibility.core.2.3.1\lib\netstandard1.1\xunit.core.dll - - - ..\packages\xunit.extensibility.execution.2.3.1\lib\net452\xunit.execution.desktop.dll - - - - - - - - - True - True - Resources.resx - - - - - {85c3e531-f53b-4344-9456-1b0176e547da} - Cake.CsvHelper - - - - - ResXFileCodeGenerator - Resources.Designer.cs - - + - - + + + + + + + + + + - + - - - - - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - - + \ No newline at end of file diff --git a/src/Cake.CsvHelper.Tests/CsvHelperAliasesTests.cs b/src/Cake.CsvHelper.Tests/CsvHelperAliasesTests.cs index 76bdd96..bcb314a 100644 --- a/src/Cake.CsvHelper.Tests/CsvHelperAliasesTests.cs +++ b/src/Cake.CsvHelper.Tests/CsvHelperAliasesTests.cs @@ -4,53 +4,58 @@ using Cake.Core.IO; using Cake.CsvHelper.Tests.Fixtures; using NSubstitute; -using Should; +using Shouldly; using Xunit; -namespace Cake.CsvHelper.Tests { - public sealed class CsvHelperAliasesTests { - public sealed class TheReadCsvMethod { +namespace Cake.CsvHelper.Tests +{ + public sealed class CsvHelperAliasesTests + { + public sealed class TheReadCsvMethod + { [Fact] - public void Should_Throw_If_Context_Is_Null() { + public void Should_Throw_If_Context_Is_Null() + { // Given var file = Substitute.For(); // When - var result = Record.Exception(() => CsvHelperAliases.ReadCsv(null, file.Path)); + var result = Record.Exception(() => CsvHelperAliases.ReadCsv(null!, file.Path)); // Then - result.ShouldBeType().ParamName.ShouldEqual("context"); + result.ShouldBeOfType().ParamName.ShouldBe("context"); } [Fact] - public void Should_Throw_If_CSV_File_Is_Null() { + public void Should_Throw_If_CSV_File_Is_Null() + { // Given var environment = Substitute.For(); var context = Substitute.For(); context.Environment.Returns(environment); // When - var result = Record.Exception(() => CsvHelperAliases.ReadCsv(context, null)); + var result = Record.Exception(() => CsvHelperAliases.ReadCsv(context, null!)); // Then - result.ShouldBeType().ParamName.ShouldEqual("csvFile"); + result.ShouldBeOfType().ParamName.ShouldBe("csvFile"); } } - public sealed class TheWriteCsvMethod { + public sealed class TheWriteCsvMethod + { [Fact] - public void Should_Throw_If_Context_Is_Null() { + public void Should_Throw_If_Context_Is_Null() + { // Given var file = Substitute.For(); // When - var result = Record.Exception(() => CsvHelperAliases.WriteCsv(null, file.Path, new List())); + var result = Record.Exception(() => CsvHelperAliases.WriteCsv(null!, file.Path, new List())); // Then - result.ShouldBeType().ParamName.ShouldEqual("context"); + result.ShouldBeOfType().ParamName.ShouldBe("context"); } } } - - } diff --git a/src/Cake.CsvHelper.Tests/CsvHelperTests.cs b/src/Cake.CsvHelper.Tests/CsvHelperTests.cs index a3dc40b..471f59d 100644 --- a/src/Cake.CsvHelper.Tests/CsvHelperTests.cs +++ b/src/Cake.CsvHelper.Tests/CsvHelperTests.cs @@ -4,176 +4,210 @@ using Cake.Core.IO; using Cake.CsvHelper.Tests.Fixtures; using Cake.CsvHelper.Tests.Properties; -using Should; +using Shouldly; using Xunit; using Xunit.Sdk; -namespace Cake.CsvHelper.Tests { - public sealed class CsvHelperTests { - public sealed class TheReadCsvMethod { +namespace Cake.CsvHelper.Tests +{ + public sealed class CsvHelperTests + { + public sealed class TheReadCsvMethod + { [Fact] - public void Should_Throw_If_CsvFile_Is_Null() { + public void Should_Throw_If_CsvFile_Is_Null() + { // Given var fixture = new CsvHelpersFixture(false); - - // When + + // When var result = Record.Exception(() => fixture.Read()); - + // Then - result.ShouldBeType().ParamName.ShouldEqual("csvFile"); + result.ShouldBeOfType().ParamName.ShouldBe("csvFile"); } [Fact] - public void Should_Throw_If_Settings_Are_Null() { + public void Should_Throw_If_Settings_Are_Null() + { // Given - var fixture = new CsvHelpersFixture(); - fixture.Settings = null; + var fixture = new CsvHelpersFixture { Settings = null! }; - // When + // When var result = Record.Exception(() => fixture.Read()); // Then - result.ShouldBeType().ParamName.ShouldEqual("settings"); + result.ShouldBeOfType().ParamName.ShouldBe("settings"); } [Fact] - public void Should_Throw_If_File_Does_Not_Exist() { + public void Should_Throw_If_File_Does_Not_Exist() + { // Given - var fixture = new CsvHelpersFixture(false); - fixture.CsvFilePath = "/Working/test.csv"; + var fixture = new CsvHelpersFixture(false) + { + CsvFilePath = "/Working/test.csv", + }; - // When + // When var result = Record.Exception(() => fixture.Read()); // Then - result.ShouldBeType(); + result.ShouldBeOfType(); } } - public sealed class TheWriteCsvNoMapMethod { + public sealed class TheWriteCsvNoMapMethod + { [Fact] - public void Should_Throw_If_CsvFile_Is_Null() { + public void Should_Throw_If_CsvFile_Is_Null() + { // Given - var fixture = new CsvHelpersFixture(); - fixture.ResultPath = null; + var fixture = new CsvHelpersFixture + { + ResultPath = null!, + }; - // When + // When var result = Record.Exception(() => fixture.WriteNoMapping()); // Then - result.ShouldBeType().ParamName.ShouldEqual("csvFile"); + result.ShouldBeOfType().ParamName.ShouldBe("csvFile"); } [Fact] - public void Should_Throw_If_Records_Are_Null() { + public void Should_Throw_If_Records_Are_Null() + { // Given var fixture = new CsvHelpersFixture(peopleExists: false); - // When + // When var result = Record.Exception(() => fixture.WriteNoMapping()); // Then - result.ShouldBeType().ParamName.ShouldEqual("records"); + result.ShouldBeOfType().ParamName.ShouldBe("records"); } - + [Fact] - public void Should_Throw_If_Settings_Are_Null() { + public void Should_Throw_If_Settings_Are_Null() + { // Given - var fixture = new CsvHelpersFixture(); - fixture.Settings = null; + var fixture = new CsvHelpersFixture + { + Settings = null!, + }; - // When + // When var result = Record.Exception(() => fixture.WriteNoMapping()); // Then - result.ShouldBeType().ParamName.ShouldEqual("settings"); + result.ShouldBeOfType().ParamName.ShouldBe("settings"); } - + [Fact(Skip = "Experimental")] - public void Should_Write_Records_To_CsvFile_With_No_Map() { + public void Should_Write_Records_To_CsvFile_With_No_Map() + { // Given var fixture = new CsvHelpersFixture(false); - + // When fixture.WriteNoMapping(); // Then var resultFile = fixture.FileSystem.GetFile(fixture.ResultPath); - resultFile.Exists.ShouldEqual(true); + resultFile.Exists.ShouldBeTrue(); string resultString; - using(var resultStream = resultFile.OpenRead()) - using (var streamReader = new StreamReader(resultStream, Encoding.UTF8)) { + using (var resultStream = resultFile.OpenRead()) + using (var streamReader = new StreamReader(resultStream, Encoding.UTF8)) + { resultString = streamReader.ReadToEnd(); - resultString.Trim().ShouldEqual(Resources.CsvHelper_CsvFile.Trim()); + resultString.Trim().ShouldBe(Resources.CsvHelper_CsvFile.Trim()); } } } - public sealed class TheWriteCsvWithMapMethod { + public sealed class TheWriteCsvWithMapMethod + { [Fact] - public void Should_Throw_If_CsvFile_Is_Null() { + public void Should_Throw_If_CsvFile_Is_Null() + { // Given - var fixture = new CsvHelpersFixture(false); - fixture.ResultPath = null; + var fixture = new CsvHelpersFixture(false) + { + ResultPath = null!, + }; - // When + // When var result = Record.Exception(() => fixture.WriteWithMapping()); // Then - result.ShouldBeType().ParamName.ShouldEqual("csvFile"); + result.ShouldBeOfType().ParamName.ShouldBe("csvFile"); } [Fact] - public void Should_Throw_If_Records_Are_Null() { + public void Should_Throw_If_Records_Are_Null() + { // Given var fixture = new CsvHelpersFixture(peopleExists: false); - // When + // When var result = Record.Exception(() => fixture.WriteWithMapping()); // Then - result.ShouldBeType().ParamName.ShouldEqual("records"); + result.ShouldBeOfType().ParamName.ShouldBe("records"); } [Fact] - public void Should_Throw_If_ClassMap_Is_Null() { + public void Should_Throw_If_ClassMap_Is_Null() + { // Given - var fixture = new CsvHelpersFixture(); - fixture.ClassMap = null; - // When + var fixture = new CsvHelpersFixture + { + ClassMap = null!, + }; + + // When var result = Record.Exception(() => fixture.WriteWithMapping()); // Then - result.ShouldBeType().ParamName.ShouldEqual("classMap"); + result.ShouldBeOfType().ParamName.ShouldBe("classMap"); } [Fact] - public void Should_Throw_If_Mapping_Is_Null() { + public void Should_Throw_If_Mapping_Is_Null() + { // Given - var fixture = new CsvHelpersFixture(); - fixture.DictionaryMap = null; - // When + var fixture = new CsvHelpersFixture + { + DictionaryMap = null!, + }; + + // When var result = Record.Exception(() => fixture.WriteWithMapping(true)); // Then - result.ShouldBeType().ParamName.ShouldEqual("mapping"); + result.ShouldBeOfType().ParamName.ShouldBe("mapping"); } [Fact] - public void Should_Throw_If_Settings_Are_Null() { + public void Should_Throw_If_Settings_Are_Null() + { // Given - var fixture = new CsvHelpersFixture(); - fixture.Settings = null; + var fixture = new CsvHelpersFixture + { + Settings = null!, + }; - // When + // When var result = Record.Exception(() => fixture.WriteWithMapping()); // Then - result.ShouldBeType().ParamName.ShouldEqual("settings"); + result.ShouldBeOfType().ParamName.ShouldBe("settings"); } [Fact(Skip = "Experimental")] - public void Should_Write_Records_To_CsvFile_With_Class_Map() { + public void Should_Write_Records_To_CsvFile_With_Class_Map() + { // Given var fixture = new CsvHelpersFixture(false); @@ -182,32 +216,15 @@ public void Should_Write_Records_To_CsvFile_With_Class_Map() { // Then var resultFile = fixture.FileSystem.GetFile(fixture.ResultPath); - resultFile.Exists.ShouldEqual(true); + resultFile.Exists.ShouldBeTrue(); string resultString; using (var resultStream = resultFile.OpenRead()) - using (var streamReader = new StreamReader(resultStream, Encoding.UTF8)) { + using (var streamReader = new StreamReader(resultStream, Encoding.UTF8)) + { resultString = streamReader.ReadToEnd(); } - resultString.Trim().ShouldEqual(Resources.CsvHelper_MappedFile.Trim()); - } - [Fact(Skip = "Experimental")] - public void Should_Write_Records_To_CsvFile_With_Dictionary_Map() { - // Given - var fixture = new CsvHelpersFixture(false); - - // When - fixture.WriteWithMapping(); - - // Then - var resultFile = fixture.FileSystem.GetFile(fixture.ResultPath); - resultFile.Exists.ShouldEqual(true); - string resultString; - using (var resultStream = resultFile.OpenRead()) - using (var streamReader = new StreamReader(resultStream, Encoding.UTF8)) { - resultString = streamReader.ReadToEnd(); - } - resultString.Trim().ShouldEqual(Resources.CsvHelper_MappedFile.Trim()); + resultString.Trim().ShouldBe(Resources.CsvHelper_MappedFile.Trim()); } } } diff --git a/src/Cake.CsvHelper.Tests/Fixtures/CsvHelpersFixture.cs b/src/Cake.CsvHelper.Tests/Fixtures/CsvHelpersFixture.cs index 1d99a20..8c81693 100644 --- a/src/Cake.CsvHelper.Tests/Fixtures/CsvHelpersFixture.cs +++ b/src/Cake.CsvHelper.Tests/Fixtures/CsvHelpersFixture.cs @@ -1,36 +1,34 @@ using System.Collections.Generic; + using Cake.Core; using Cake.Core.IO; using Cake.CsvHelper.Tests.Properties; using Cake.Testing; + using CsvHelper.Configuration; -using NSubstitute; -namespace Cake.CsvHelper.Tests.Fixtures { - internal sealed class CsvHelpersFixture { - public IFileSystem FileSystem { get; set; } - public ICakeContext Context { get; set; } - public FilePath CsvFilePath { get; set; } - public FilePath ResultPath { get; set; } - public CsvHelperSettings Settings { get; set; } - public List People { get; set; } - public Dictionary DictionaryMap { get; set; } - public ClassMap ClassMap { get; set; } +using NSubstitute; - public CsvHelpersFixture(bool csvFileExists = true, bool peopleExists = true) { +namespace Cake.CsvHelper.Tests.Fixtures +{ + internal sealed class CsvHelpersFixture + { + public CsvHelpersFixture(bool csvFileExists = true, bool peopleExists = true) + { Settings = new CsvHelperSettings(); - - ClassMap = new PersonMap(); - DictionaryMap = new Dictionary() { - {"Id", "EmployeeId" }, {"Name", "GivenName" } + DictionaryMap = new Dictionary(System.StringComparer.OrdinalIgnoreCase) + { + { "Id", "EmployeeId" }, + { "Name", "GivenName" }, }; var environment = FakeEnvironment.CreateUnixEnvironment(); var fileSystem = new FakeFileSystem(environment); fileSystem.CreateDirectory("/Working"); - if (csvFileExists) { + if (csvFileExists) + { var content = Resources.CsvHelper_CsvFile; var csvFile = fileSystem.CreateFile("/Working/people.csv").SetContent(content); CsvFilePath = csvFile.Path; @@ -38,10 +36,12 @@ public CsvHelpersFixture(bool csvFileExists = true, bool peopleExists = true) { ResultPath = "/Working/people.csv"; - if (peopleExists) { - People = new List { + if (peopleExists) + { + People = new List + { new Person { Id = 1, Name = "Jane" }, - new Person {Id = 2, Name="Mal" } + new Person { Id = 2, Name = "Mal" }, }; } @@ -52,36 +52,45 @@ public CsvHelpersFixture(bool csvFileExists = true, bool peopleExists = true) { Context.Environment.Returns(environment); } - public void Read() { + public IFileSystem FileSystem { get; set; } + + public ICakeContext Context { get; set; } + + public FilePath? CsvFilePath { get; set; } + + public FilePath ResultPath { get; set; } + + public CsvHelperSettings Settings { get; set; } + + public List? People { get; set; } + + public Dictionary DictionaryMap { get; set; } + + public ClassMap ClassMap { get; set; } + + public void Read() + { var csvHelper = new CsvHelpers(Context.FileSystem, Context.Environment); - csvHelper.ReadRecords(CsvFilePath, null, Settings); + csvHelper.ReadRecords(CsvFilePath!, null, Settings); } - public void WriteNoMapping() { + public void WriteNoMapping() + { var csvHelper = new CsvHelpers(Context.FileSystem, Context.Environment); - csvHelper.WriteRecords(ResultPath, People, Settings); + csvHelper.WriteRecords(ResultPath, People!, Settings); } - public void WriteWithMapping(bool useDictionaryMapping = false) { + public void WriteWithMapping(bool useDictionaryMapping = false) + { var csvHelper = new CsvHelpers(Context.FileSystem, Context.Environment); - if (useDictionaryMapping) { - csvHelper.WriteRecords(ResultPath, People, DictionaryMap, Settings); + if (useDictionaryMapping) + { + csvHelper.WriteRecords(ResultPath, People!, DictionaryMap, Settings); } - else { - csvHelper.WriteRecords(ResultPath, People, ClassMap, Settings); + else + { + csvHelper.WriteRecords(ResultPath, People!, ClassMap, Settings); } } } - - public sealed class Person { - public int Id { get; set; } - public string Name { get; set; } - } - - public class PersonMap : ClassMap { - public PersonMap() { - Map(m => m.Id).Name("EmployeeId"); - Map(m => m.Name).Name("GivenName"); - } - } } diff --git a/src/Cake.CsvHelper.Tests/Fixtures/Person.cs b/src/Cake.CsvHelper.Tests/Fixtures/Person.cs new file mode 100644 index 0000000..c8a60ce --- /dev/null +++ b/src/Cake.CsvHelper.Tests/Fixtures/Person.cs @@ -0,0 +1,8 @@ +namespace Cake.CsvHelper.Tests.Fixtures; + +public sealed class Person +{ + public int Id { get; set; } + + public string? Name { get; set; } +} diff --git a/src/Cake.CsvHelper.Tests/Fixtures/PersonMap.cs b/src/Cake.CsvHelper.Tests/Fixtures/PersonMap.cs new file mode 100644 index 0000000..116996b --- /dev/null +++ b/src/Cake.CsvHelper.Tests/Fixtures/PersonMap.cs @@ -0,0 +1,15 @@ +using CsvHelper.Configuration; + +namespace Cake.CsvHelper.Tests.Fixtures +{ + public sealed class PersonMap : ClassMap + { + public PersonMap() + { +#pragma warning disable MA0056 // Do not call overridable members in constructor + Map(m => m.Id).Name("EmployeeId"); + Map(m => m.Name).Name("GivenName"); +#pragma warning restore MA0056 // Do not call overridable members in constructor + } + } +} diff --git a/src/Cake.CsvHelper.Tests/Properties/AssemblyInfo.cs b/src/Cake.CsvHelper.Tests/Properties/AssemblyInfo.cs deleted file mode 100644 index cf8c6fd..0000000 --- a/src/Cake.CsvHelper.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.CsvHelper.Tests")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Cake.CsvHelper.Tests")] -[assembly: AssemblyCopyright("Copyright © 2017")] -[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("1691864a-29da-4ed9-a2c1-3ee39d006f51")] - -// 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.CsvHelper.Tests/app.config b/src/Cake.CsvHelper.Tests/app.config deleted file mode 100644 index 7d8c922..0000000 --- a/src/Cake.CsvHelper.Tests/app.config +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/src/Cake.CsvHelper.Tests/packages.config b/src/Cake.CsvHelper.Tests/packages.config deleted file mode 100644 index ccf02bd..0000000 --- a/src/Cake.CsvHelper.Tests/packages.config +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/Cake.CsvHelper.sln b/src/Cake.CsvHelper.sln index c89d61d..c328c68 100644 --- a/src/Cake.CsvHelper.sln +++ b/src/Cake.CsvHelper.sln @@ -1,12 +1,19 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.25420.1 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.31919.166 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cake.CsvHelper", "Cake.CsvHelper\Cake.CsvHelper.csproj", "{85C3E531-F53B-4344-9456-1B0176E547DA}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cake.CsvHelper.Tests", "Cake.CsvHelper.Tests\Cake.CsvHelper.Tests.csproj", "{1691864A-29DA-4ED9-A2C1-3EE39D006F51}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution", "Solution", "{2FC30AF7-19E0-4647-8024-BEB10146805C}" + ProjectSection(SolutionItems) = preProject + ..\.editorconfig = ..\.editorconfig + Directory.Build.props = Directory.Build.props + stylecop.json = stylecop.json + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -25,4 +32,7 @@ Global GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {805AF374-B5FF-4CD6-8440-8BC85042D1F2} + EndGlobalSection EndGlobal diff --git a/src/Cake.CsvHelper/Cake.CsvHelper.csproj b/src/Cake.CsvHelper/Cake.CsvHelper.csproj index 1152c16..313ba94 100644 --- a/src/Cake.CsvHelper/Cake.CsvHelper.csproj +++ b/src/Cake.CsvHelper/Cake.CsvHelper.csproj @@ -1,68 +1,22 @@ - - - + + - Debug - AnyCPU - {85C3E531-F53B-4344-9456-1B0176E547DA} - Library - Properties - Cake.CsvHelper - Cake.CsvHelper - v4.6.1 - 512 - + netcoreapp3.1;net5.0;net6.0 + true + cake script build cake-build addin cake-addin csv-helper csvhelper csv - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - bin\Debug\Cake.CsvHelper.XML - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - bin\Release\Cake.CsvHelper.XML - - - - ..\packages\Cake.Core.0.23.0\lib\net46\Cake.Core.dll - - - ..\packages\CsvHelper.6.0.0\lib\net45\CsvHelper.dll - - - - - - - - - - - - - - - - + - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + - - + \ No newline at end of file diff --git a/src/Cake.CsvHelper/CsvHelperAliases.cs b/src/Cake.CsvHelper/CsvHelperAliases.cs index abcc2c2..4d1f48a 100644 --- a/src/Cake.CsvHelper/CsvHelperAliases.cs +++ b/src/Cake.CsvHelper/CsvHelperAliases.cs @@ -10,7 +10,7 @@ namespace Cake.CsvHelper /// /// Contians functionality related to reading and writing CSV files. /// - [CakeAliasCategory("CsvHelper")] + [CakeAliasCategory(nameof(CsvHelper))] public static class CsvHelperAliases { /// @@ -26,8 +26,9 @@ public static class CsvHelperAliases /// /// [CakeMethodAlias] - [CakeAliasCategory("ReadCsv")] - public static IEnumerable ReadCsv(this ICakeContext context, FilePath csvFile) { + [CakeAliasCategory(nameof(ReadCsv))] + public static IEnumerable ReadCsv(this ICakeContext context, FilePath csvFile) + { var settings = new CsvHelperSettings(); return ReadCsv(context, csvFile, null, settings); } @@ -46,8 +47,9 @@ public static IEnumerable ReadCsv(this ICakeContext context, FilePath csvF /// /// [CakeMethodAlias] - [CakeAliasCategory("ReadCsv")] - public static IEnumerable ReadCsv(this ICakeContext context, FilePath csvFile, CsvHelperSettings settings) { + [CakeAliasCategory(nameof(ReadCsv))] + public static IEnumerable ReadCsv(this ICakeContext context, FilePath csvFile, CsvHelperSettings settings) + { return ReadCsv(context, csvFile, null, settings); } @@ -56,16 +58,16 @@ public static IEnumerable ReadCsv(this ICakeContext context, FilePath csvF /// /// The type. /// The context. - /// The CSV class map. /// The CSV to read. + /// The CSV class map. /// List objects as defined by type. /// - /// + /// /// ("./people.csv", new ClassMap());]]> /// /// [CakeMethodAlias] - [CakeAliasCategory("ReadCsv")] + [CakeAliasCategory(nameof(ReadCsv))] [CakeNamespaceImport("CsvHelper.Configuration.CsvClassMap")] public static IEnumerable ReadCsv(this ICakeContext context, FilePath csvFile, ClassMap classMap) { @@ -88,14 +90,15 @@ public static IEnumerable ReadCsv(this ICakeContext context, FilePath csvF /// /// [CakeMethodAlias] - [CakeAliasCategory("ReadCsv")] + [CakeAliasCategory(nameof(ReadCsv))] [CakeNamespaceImport("CsvHelper.Configuration.CsvClassMap")] - public static IEnumerable ReadCsv(this ICakeContext context, FilePath csvFile, ClassMap classMap, CsvHelperSettings settings) + public static IEnumerable ReadCsv(this ICakeContext context, FilePath csvFile, ClassMap? classMap, CsvHelperSettings settings) { if (context == null) { throw new ArgumentNullException(nameof(context)); } + var csvHelpers = new CsvHelpers(context.FileSystem, context.Environment); return csvHelpers.ReadRecords(csvFile, classMap, settings); } @@ -107,15 +110,14 @@ public static IEnumerable ReadCsv(this ICakeContext context, FilePath csvF /// The context. /// The CSV to file to write. /// The list objects you want to write to a csv. - /// List objects as defined by type. /// /// /// ("./people.csv", new List());]]> /// /// [CakeMethodAlias] - [CakeAliasCategory("WriteCsv")] - public static void WriteCsv(this ICakeContext context, FilePath csvFile, List records) + [CakeAliasCategory(nameof(WriteCsv))] + public static void WriteCsv(this ICakeContext context, FilePath csvFile, IList records) { var settings = new CsvHelperSettings(); WriteCsv(context, csvFile, records, settings); @@ -129,20 +131,20 @@ public static void WriteCsv(this ICakeContext context, FilePath csvFile, List /// The CSV to file to write. /// The list objects you want to write to a csv. /// The settings. - /// List objects as defined by type. /// /// /// ("./people.csv", new List(), new CsvHelperSettings { HasHeaderRecord = true });]]> /// /// [CakeMethodAlias] - [CakeAliasCategory("WriteCsv")] - public static void WriteCsv(this ICakeContext context, FilePath csvFile, List records, CsvHelperSettings settings) + [CakeAliasCategory(nameof(WriteCsv))] + public static void WriteCsv(this ICakeContext context, FilePath csvFile, IList records, CsvHelperSettings settings) { if (context == null) { throw new ArgumentNullException(nameof(context)); } + var csvHelpers = new CsvHelpers(context.FileSystem, context.Environment); csvHelpers.WriteRecords(csvFile, records, settings); } @@ -156,10 +158,9 @@ public static void WriteCsv(this ICakeContext context, FilePath csvFile, List /// The list objects you want to write to a csv. /// The property column mapping. /// The settings. - /// List objects as defined by type. /// /// - /// { + /// { /// {"Id", "EmployeeId"}, /// {"Name", "FirstName"} /// };]]> @@ -167,13 +168,14 @@ public static void WriteCsv(this ICakeContext context, FilePath csvFile, List /// /// [CakeMethodAlias] - [CakeAliasCategory("WriteCsv")] - public static void WriteCsv(this ICakeContext context, FilePath csvFile, List records, Dictionary mapping, CsvHelperSettings settings) + [CakeAliasCategory(nameof(WriteCsv))] + public static void WriteCsv(this ICakeContext context, FilePath csvFile, IList records, IDictionary mapping, CsvHelperSettings settings) { if (context == null) { throw new ArgumentNullException(nameof(context)); } + var csvHelpers = new CsvHelpers(context.FileSystem, context.Environment); csvHelpers.WriteRecords(csvFile, records, mapping, settings); } @@ -187,9 +189,8 @@ public static void WriteCsv(this ICakeContext context, FilePath csvFile, List /// The list objects you want to write to a csv. /// The CSV Helper Class Map. /// The settings. - /// List objects as defined by type. /// - /// + /// /// public sealed class PersonMap : CsvClassMap<Person> /// { /// public PersonMap() @@ -202,16 +203,17 @@ public static void WriteCsv(this ICakeContext context, FilePath csvFile, List /// /// [CakeMethodAlias] - [CakeAliasCategory("WriteCsv")] + [CakeAliasCategory(nameof(WriteCsv))] [CakeNamespaceImport("CsvHelper.Configuration.CsvClassMap")] - public static void WriteCsv(this ICakeContext context, FilePath csvFile, List records, ClassMap classMap, CsvHelperSettings settings) + public static void WriteCsv(this ICakeContext context, FilePath csvFile, IList records, ClassMap classMap, CsvHelperSettings settings) { if (context == null) { throw new ArgumentNullException(nameof(context)); } + var csvHelpers = new CsvHelpers(context.FileSystem, context.Environment); - csvHelpers.WriteRecords(csvFile,records, classMap, settings); + csvHelpers.WriteRecords(csvFile, records, classMap, settings); } } } diff --git a/src/Cake.CsvHelper/CsvHelperSettings.cs b/src/Cake.CsvHelper/CsvHelperSettings.cs index 574a280..5d1bb6d 100644 --- a/src/Cake.CsvHelper/CsvHelperSettings.cs +++ b/src/Cake.CsvHelper/CsvHelperSettings.cs @@ -3,103 +3,117 @@ using System.Text; using CsvHelper; -namespace Cake.CsvHelper { - +namespace Cake.CsvHelper +{ /// /// Contains settings used by . /// - public class CsvHelperSettings { + public class CsvHelperSettings + { + /// + /// Initializes a new instance of the class. + /// + public CsvHelperSettings() + { + Encoding = Encoding.UTF8; + BufferSize = 2048; + Comment = "#"; + CultureInfo = CultureInfo.InvariantCulture; + Delimiter = ","; + Quote = "\""; + } + /// - /// Gets or sets a value indicating if comments are allowed. - /// - /// - /// true to allow commented out lines; otherwise, false. - /// + /// Gets or sets a value indicating whether if comments are allowed. + /// + /// + /// true to allow commented out lines; otherwise, false. + /// public bool AllowComments { get; set; } /// - /// Gets or sets the size of the buffer used for reading and writing CSV files. - /// - /// - /// Default is 2048. - /// + /// Gets or sets the size of the buffer used for reading and writing CSV files. + /// + /// + /// Default is 2048. + /// public int BufferSize { get; set; } /// - /// Gets or sets the character used to denote a line that is commented out. - /// - /// - /// Default is '#'. - /// + /// Gets or sets the character used to denote a line that is commented out. + /// + /// + /// Default is '#'. + /// public string Comment { get; set; } /// - /// Gets or sets a value indicating whether the number of bytes should be counted while parsing. Default is false. This will slow down parsing - /// because it needs to get the byte count of every char for the given encoding. - /// The needs to be set correctly for this to be accurate. - /// + /// Gets or sets a value indicating whether the number of bytes should be counted while parsing. Default is false. This will slow down parsing + /// because it needs to get the byte count of every char for the given encoding. + /// The needs to be set correctly for this to be accurate. + /// public bool CountBytes { get; set; } /// - /// Gets or sets the culture info used to read an write CSV files. - /// + /// Gets or sets the culture info used to read an write CSV files. + /// public CultureInfo CultureInfo { get; set; } /// - /// Gets or sets the value used to separate the fields in a CSV row. - /// - /// - /// Defaults to Encoding.UTF8. - /// + /// Gets or sets the value used to separate the fields in a CSV row. + /// + /// + /// Defaults to ,. + /// public string Delimiter { get; set; } /// - /// Gets or sets a value indicating whether changes in the column count should be detected. If true, a will be thrown if a different column count is detected. - /// - /// - /// true if [detect column count changes]; otherwise, false. - /// + /// Gets or sets a value indicating whether changes in the column count should be detected. If true, a will be thrown if a different column count is detected. + /// + /// + /// true if [detect column count changes]; otherwise, false. + /// public bool DetectColumnCountChanges { get; set; } /// - /// Gets or sets the encoding used when counting bytes. - /// - /// - /// Defaults to Encoding.UTF8. - /// + /// Gets or sets the encoding used when counting bytes. + /// + /// + /// Defaults to Encoding.UTF8. + /// public Encoding Encoding { get; set; } /// - /// Gets or sets a value indicating if the CSV file has a header record. + /// Gets or sets a value indicating whether if the CSV file has a header record. /// public bool HasHeaderRecord { get; set; } /// - /// Gets or sets a value indicating to ignore white space in the headers when matching the columns to the properties by name. + /// Gets or sets a value indicating whether to ignore white space in the headers when matching the columns to the properties by name. /// public bool IgnoreHeaderWhiteSpace { get; set; } /// - /// Gets or sets a value indicating to ignore private accessors when reading and writing. By default you can't read from a private getter or + /// Gets or sets a value indicating whether to ignore private accessors when reading and writing. By default you can't read from a private getter or /// write to a private setter. Turn this on will allow that. Properties that can't be read from or written to are silently ignored. /// public bool IgnorePrivateAccessor { get; set; } /// - /// Gets or sets a value indicating whether exceptions that occur duruing reading should be ignored. - /// - /// + /// Gets or sets a value indicating whether exceptions that occur duruing reading should be ignored. + /// + /// /// true if to ignore exceptions; otherwise, false. /// public bool IgnoreReadingExceptions { get; set; } /// - /// Gets or sets a value indicating if quotes should be ingored when parsing and treated like any other character. - /// - /// - /// true if to ignore qoutes; otherwise, false. + /// Gets or sets a value indicating whether if quotes should be ignored when parsing and treated like any other character. + /// + /// + /// true if to ignore quotes; otherwise, false. /// - public bool IgnoreQoutes { get; set; } + public bool IgnoreQuotes { get; set; } /// /// Gets or sets a value indicating whether matching CSV header names will be case sensitive. @@ -117,25 +131,25 @@ public class CsvHelperSettings { /// /// Gets or sets a value used to escape fields that contain a delimiter, quote, or line ending. /// - public string Qoute { get; set; } + public string Quote { get; set; } /// - /// Gets or sets a value indicating whether all fields are quoted when writing, or just ones that have to be. and - /// cannot be true at the same time. Turning one on will turn the other off. - /// - /// - /// true if all fields should be quoted; otherwise, false. - /// - public bool QouteAllFields { get; set; } + /// Gets or sets a value indicating whether all fields are quoted when writing, or just ones that have to be. and + /// cannot be true at the same time. Turning one on will turn the other off. + /// + /// + /// true if all fields should be quoted; otherwise, false. + /// + public bool QuoteAllFields { get; set; } /// - /// Gets or sets a value indicating whether no fields are quoted when writing. and cannot be true - /// at the same time. Turning one on will turn the other off. - /// - /// - /// true if [quote no fields]; otherwise, false. - /// - public bool QouteNoFields { get; set; } + /// Gets or sets a value indicating whether no fields are quoted when writing. and cannot be true + /// at the same time. Turning one on will turn the other off. + /// + /// + /// true if [quote no fields]; otherwise, false. + /// + public bool QuoteNoFields { get; set; } /// /// Gets or sets a value indicating whether empty rows should be skipped when reading. A record is considered empty if all fields are empty. @@ -146,29 +160,22 @@ public class CsvHelperSettings { public bool SkipEmptyRecords { get; set; } /// - /// Gets or sets a value indicating if the reader to trim whitespace from the beginning and ending of the field value when reading. + /// Gets or sets a value indicating whether if the reader to trim whitespace from the beginning and ending of the field value when reading. /// public bool TrimFields { get; set; } /// - /// Gets or sets a value indicating ifthe reader to ignore white space from the beginning and ending of the headers + /// Gets or sets a value indicating whether if the reader to ignore white space from the beginning and ending of the headers /// when matching the columns to the properties by name. /// public bool TrimHeaders { get; set; } /// - /// Gets or sets a value indicating if an exception will be thrown if a field defined in a mapping is missing. True to throw an exception, otherwise false. Default is true. - /// - /// + /// Gets or sets a value indicating whether if an exception will be thrown if a field defined in a mapping is missing. True to throw an exception, otherwise false. Default is true. + /// + /// /// true if an exception is to be thrown; otherwise, false. Defaults to true. /// public bool WillThrowOnMissingField { get; set; } - - /// - /// Initializes the class. - /// - public CsvHelperSettings() { - Encoding = Encoding.UTF8; - } } } diff --git a/src/Cake.CsvHelper/CsvHelpers.cs b/src/Cake.CsvHelper/CsvHelpers.cs index cc066d1..261d7be 100644 --- a/src/Cake.CsvHelper/CsvHelpers.cs +++ b/src/Cake.CsvHelper/CsvHelpers.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Globalization; using System.IO; using System.Linq; using Cake.Core; @@ -7,20 +8,23 @@ using CsvHelper; using CsvHelper.Configuration; -namespace Cake.CsvHelper { +namespace Cake.CsvHelper +{ /// /// The CsvHelpers class for working with CSV Helper. /// - public sealed class CsvHelpers { + public sealed class CsvHelpers + { private readonly IFileSystem _fileSystem; private readonly ICakeEnvironment _environment; /// - /// Initializes new instance of the class. + /// Initializes a new instance of the class. /// /// The filesystem. /// The environment. - public CsvHelpers(IFileSystem fileSystem, ICakeEnvironment environment) { + public CsvHelpers(IFileSystem fileSystem, ICakeEnvironment environment) + { _fileSystem = fileSystem; _environment = environment; } @@ -33,19 +37,27 @@ public CsvHelpers(IFileSystem fileSystem, ICakeEnvironment environment) { /// The class map to use, null if not needed. /// The settings. /// List of defined type. - public IEnumerable ReadRecords(FilePath csvFile, ClassMap classMap, CsvHelperSettings settings) { - if (csvFile == null) { + public IEnumerable ReadRecords(FilePath csvFile, ClassMap? classMap, CsvHelperSettings settings) + { + if (csvFile == null) + { throw new ArgumentNullException(nameof(csvFile)); } - if (settings == null) { + + if (settings == null) + { throw new ArgumentNullException(nameof(settings)); } + var file = GetFile(csvFile); using (var textReader = new StreamReader(file.OpenRead())) - using (var csvReader = new CsvReader(textReader)) { - if (classMap != null) { - csvReader.Configuration.RegisterClassMap(classMap); + using (var csvReader = new CsvReader(textReader, CultureInfo.InvariantCulture)) + { + if (classMap != null) + { + csvReader.Context.RegisterClassMap(classMap); } + return csvReader.GetRecords().ToList(); } } @@ -58,29 +70,40 @@ public IEnumerable ReadRecords(FilePath csvFile, ClassMap classMap, CsvHel /// The records to write. /// The class map. /// The settings. - public void WriteRecords(FilePath csvFile, List records, ClassMap classMap, CsvHelperSettings settings) { - if (csvFile == null) { + public void WriteRecords(FilePath csvFile, IList records, ClassMap classMap, CsvHelperSettings settings) + { + if (csvFile == null) + { throw new ArgumentNullException(nameof(csvFile)); } - if (records == null) { + + if (records == null) + { throw new ArgumentNullException(nameof(records)); } - if (classMap == null) { + + if (classMap == null) + { throw new ArgumentNullException(nameof(classMap)); } - if (settings == null) { + + if (settings == null) + { throw new ArgumentNullException(nameof(settings)); } var file = GetFile(csvFile); using (var stream = file.OpenWrite()) using (var textWriter = new StreamWriter(stream, settings.Encoding)) - using (var csvWriter = new CsvWriter(textWriter)) { - csvWriter.Configuration.RegisterClassMap(classMap); + using (var csvWriter = new CsvWriter(textWriter, CultureInfo.InvariantCulture)) + { + csvWriter.Context.RegisterClassMap(classMap); csvWriter.WriteHeader(); - foreach (var record in records) { + foreach (var record in records) + { csvWriter.WriteRecord(record); } + textWriter.Close(); } } @@ -93,13 +116,19 @@ public void WriteRecords(FilePath csvFile, List records, ClassMap classMap /// The records to write. /// The property column mapping. /// The settings. - public void WriteRecords(FilePath csvFile, List records, Dictionary mapping, - CsvHelperSettings settings) { - if (mapping == null) { + public void WriteRecords( + FilePath csvFile, + IList records, + IDictionary mapping, + CsvHelperSettings settings) + { + if (mapping == null) + { throw new ArgumentNullException(nameof(mapping)); } + var customMap = new DefaultClassMap(); - customMap.AutoMap(); + customMap.AutoMap(CultureInfo.InvariantCulture); WriteRecords(csvFile, records, customMap, settings); } @@ -110,14 +139,20 @@ public void WriteRecords(FilePath csvFile, List records, DictionaryThe CSV file to write. /// The records to write. /// The settings. - public void WriteRecords(FilePath csvFile, List records, CsvHelperSettings settings) { - if (csvFile == null) { + public void WriteRecords(FilePath csvFile, IList records, CsvHelperSettings settings) + { + if (csvFile == null) + { throw new ArgumentNullException(nameof(csvFile)); } - if (records == null) { + + if (records == null) + { throw new ArgumentNullException(nameof(records)); } - if (settings == null) { + + if (settings == null) + { throw new ArgumentNullException(nameof(settings)); } @@ -125,16 +160,20 @@ public void WriteRecords(FilePath csvFile, List records, CsvHelperSettings var file = GetFile(csvFile); using (var stream = file.OpenWrite()) using (var textWriter = new StreamWriter(stream, settings.Encoding)) - using (var csvWriter = new CsvWriter(textWriter)) { + using (var csvWriter = new CsvWriter(textWriter, CultureInfo.InvariantCulture)) + { csvWriter.WriteHeader(); - foreach (var record in records) { + foreach (var record in records) + { csvWriter.WriteRecord(record); } + textWriter.Close(); } } - private IFile GetFile(FilePath path) { + private IFile GetFile(FilePath path) + { var file = path.IsRelative ? path.MakeAbsolute(_environment) : path; return _fileSystem.GetFile(file); } diff --git a/src/Cake.CsvHelper/Properties/AssemblyInfo.cs b/src/Cake.CsvHelper/Properties/AssemblyInfo.cs deleted file mode 100644 index 123232e..0000000 --- a/src/Cake.CsvHelper/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.CsvHelper")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Cake.CsvHelper")] -[assembly: AssemblyCopyright("Copyright © 2017")] -[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("85c3e531-f53b-4344-9456-1b0176e547da")] - -// 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.CsvHelper/packages.config b/src/Cake.CsvHelper/packages.config deleted file mode 100644 index 4772a52..0000000 --- a/src/Cake.CsvHelper/packages.config +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/Directory.Build.props b/src/Directory.Build.props new file mode 100644 index 0000000..64a7a94 --- /dev/null +++ b/src/Directory.Build.props @@ -0,0 +1,82 @@ + + + + + + 10.0 + enable + true + + $(NoWarn);1701;1702;1591 + true + + + + + + all + + + all + + + all + + + all + + + all + + + all + + + all + + + all + + + all + + + all + + + all + + + all + + + all + + + all + + + all + + + all + + + all + + + all + + + all + + + all + + + + + + + + diff --git a/src/stylecop.json b/src/stylecop.json new file mode 100644 index 0000000..b892eb0 --- /dev/null +++ b/src/stylecop.json @@ -0,0 +1,18 @@ +{ + "$schema": "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json", + "settings": { + "indentation": { + "indentationSize": 4, + "tabSize": 4, + "useTabs": false + }, + "orderingRules": { + "usingDirectivesPlacement": "outsideNamespace", + "blankLinesBetweenUsingGroups": "allow", + "systemUsingDirectivesFirst": true + }, + "documentationRules": { + "xmlHeader": false + } + } +} \ No newline at end of file diff --git a/tools/packages.config b/tools/packages.config deleted file mode 100644 index e0dd39b..0000000 --- a/tools/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - From 49f164e0c769cce884cd835e8354fe84972b8979 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Pluci=C5=84ski?= Date: Thu, 18 Jan 2024 20:10:40 +0100 Subject: [PATCH 8/8] upgrade to Cake 4.0 --- nuspec/nuget/Cake.CsvHelper.nuspec | 12 +-- .../Cake.CsvHelper.Tests.csproj | 26 +++--- src/Cake.CsvHelper.sln | 5 +- src/Cake.CsvHelper/Cake.CsvHelper.csproj | 8 +- src/Directory.Build.props | 84 +++++-------------- src/SecurityCodeScan.config.yml | 3 + 6 files changed, 55 insertions(+), 83 deletions(-) create mode 100644 src/SecurityCodeScan.config.yml diff --git a/nuspec/nuget/Cake.CsvHelper.nuspec b/nuspec/nuget/Cake.CsvHelper.nuspec index 5749cd1..d43a160 100644 --- a/nuspec/nuget/Cake.CsvHelper.nuspec +++ b/nuspec/nuget/Cake.CsvHelper.nuspec @@ -15,13 +15,13 @@ cake script build cake-build addin cake-addin csv-helper csvhelper csv - - - + + + - - - + + + diff --git a/src/Cake.CsvHelper.Tests/Cake.CsvHelper.Tests.csproj b/src/Cake.CsvHelper.Tests/Cake.CsvHelper.Tests.csproj index 8ca974b..47f5398 100644 --- a/src/Cake.CsvHelper.Tests/Cake.CsvHelper.Tests.csproj +++ b/src/Cake.CsvHelper.Tests/Cake.CsvHelper.Tests.csproj @@ -1,20 +1,26 @@  - netcoreapp3.1;net5.0;net6.0 + net8.0;net7.0;net6.0 true - - - - - - - - - + + + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/src/Cake.CsvHelper.sln b/src/Cake.CsvHelper.sln index c328c68..143d083 100644 --- a/src/Cake.CsvHelper.sln +++ b/src/Cake.CsvHelper.sln @@ -3,14 +3,15 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.0.31919.166 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cake.CsvHelper", "Cake.CsvHelper\Cake.CsvHelper.csproj", "{85C3E531-F53B-4344-9456-1B0176E547DA}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cake.CsvHelper", "Cake.CsvHelper\Cake.CsvHelper.csproj", "{85C3E531-F53B-4344-9456-1B0176E547DA}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cake.CsvHelper.Tests", "Cake.CsvHelper.Tests\Cake.CsvHelper.Tests.csproj", "{1691864A-29DA-4ED9-A2C1-3EE39D006F51}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cake.CsvHelper.Tests", "Cake.CsvHelper.Tests\Cake.CsvHelper.Tests.csproj", "{1691864A-29DA-4ED9-A2C1-3EE39D006F51}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution", "Solution", "{2FC30AF7-19E0-4647-8024-BEB10146805C}" ProjectSection(SolutionItems) = preProject ..\.editorconfig = ..\.editorconfig Directory.Build.props = Directory.Build.props + SecurityCodeScan.config.yml = SecurityCodeScan.config.yml stylecop.json = stylecop.json EndProjectSection EndProject diff --git a/src/Cake.CsvHelper/Cake.CsvHelper.csproj b/src/Cake.CsvHelper/Cake.CsvHelper.csproj index 313ba94..3022d71 100644 --- a/src/Cake.CsvHelper/Cake.CsvHelper.csproj +++ b/src/Cake.CsvHelper/Cake.CsvHelper.csproj @@ -1,7 +1,7 @@  - netcoreapp3.1;net5.0;net6.0 + net8.0;net7.0;net6.0 true cake script build cake-build addin cake-addin csv-helper csvhelper csv @@ -11,12 +11,12 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + \ No newline at end of file diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 64a7a94..e59da47 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -13,70 +13,32 @@ - - all - - - all - - - all - - - all - - - all - - - all - - - all - - - all - - - all - - - all - - - all - - - all - - - all - - - all - - - all - - - all - - - all - - - all - - - all - - - all - + + + + + + + + + + + + + + + + + + + + + + - + diff --git a/src/SecurityCodeScan.config.yml b/src/SecurityCodeScan.config.yml new file mode 100644 index 0000000..c6f85b2 --- /dev/null +++ b/src/SecurityCodeScan.config.yml @@ -0,0 +1,3 @@ +Version: 3.1 + +AuditMode: true \ No newline at end of file