diff --git a/.gitignore b/.gitignore index 9985523..0a5f925 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,4 @@ Thumbs.db *.ncrunchproject *.ncrunchsolution nCrunchTemp* +_ReSharper* diff --git a/.travis.yml b/.travis.yml index 9d08722..6c5c048 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,4 +5,4 @@ dist: trusty sudo: false script: -- ./build.sh --target=NuGetPackageTest +- ./build.sh --target=NuGetPackage diff --git a/FindReplaceCode.sln b/FindReplaceCode.sln index 1c49fab..18ca383 100644 --- a/FindReplaceCode.sln +++ b/FindReplaceCode.sln @@ -1,46 +1,41 @@ - Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 VisualStudioVersion = 15.0.28010.2003 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{C0F6A102-92D4-4054-84BF-00D9A313577D}" - ProjectSection(SolutionItems) = preProject - .editorconfig = .editorconfig - .gitattributes = .gitattributes - .gitignore = .gitignore - .travis.yml = .travis.yml - appveyor.yml = appveyor.yml - build.cake = build.cake - build.ps1 = build.ps1 - CONTRIBUTING.md = CONTRIBUTING.md - LICENSE = LICENSE - README.md = README.md - VersionHistory.md = VersionHistory.md - EndProjectSection +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FindReplaceCode", "src\FindReplaceCode\FindReplaceCode.csproj", "{4E2B87C2-B50A-4876-A1EC-118554B4B389}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FindReplaceCode", "src\FindReplaceCode\FindReplaceCode.csproj", "{4E2B87C2-B50A-4876-A1EC-118554B4B389}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FindReplaceCode.Tests", "tests\FindReplaceCode.Tests\FindReplaceCode.Tests.csproj", "{DF559AD1-5287-43B1-AB47-61B6F342B0FE}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{8C2B8692-C413-4D47-BBC5-046E63526F9D}" + ProjectSection(SolutionItems) = preProject + .editorconfig = .editorconfig + .gitattributes = .gitattributes + .gitignore = .gitignore + .travis.yml = .travis.yml + appveyor.yml = appveyor.yml + build.cake = build.cake + build.ps1 = build.ps1 + build.sh = build.sh + CONTRIBUTING.md = CONTRIBUTING.md + LICENSE = LICENSE + README.md = README.md + VersionHistory.md = VersionHistory.md + EndProjectSection EndProject Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {4E2B87C2-B50A-4876-A1EC-118554B4B389}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4E2B87C2-B50A-4876-A1EC-118554B4B389}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4E2B87C2-B50A-4876-A1EC-118554B4B389}.Release|Any CPU.ActiveCfg = Release|Any CPU - {4E2B87C2-B50A-4876-A1EC-118554B4B389}.Release|Any CPU.Build.0 = Release|Any CPU - {DF559AD1-5287-43B1-AB47-61B6F342B0FE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {DF559AD1-5287-43B1-AB47-61B6F342B0FE}.Debug|Any CPU.Build.0 = Debug|Any CPU - {DF559AD1-5287-43B1-AB47-61B6F342B0FE}.Release|Any CPU.ActiveCfg = Release|Any CPU - {DF559AD1-5287-43B1-AB47-61B6F342B0FE}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {61721187-4DC2-4A62-9B7A-93E34B4071E5} - EndGlobalSection + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {4E2B87C2-B50A-4876-A1EC-118554B4B389}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4E2B87C2-B50A-4876-A1EC-118554B4B389}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4E2B87C2-B50A-4876-A1EC-118554B4B389}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4E2B87C2-B50A-4876-A1EC-118554B4B389}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {61721187-4DC2-4A62-9B7A-93E34B4071E5} + SolutionGuid = {C2367BAD-9F87-4BED-8E58-C1D7E5C3FE51} + EndGlobalSection EndGlobal diff --git a/README.md b/README.md index b728833..11ff144 100644 --- a/README.md +++ b/README.md @@ -42,17 +42,16 @@ Any subfolder whose name starts with a period (e.g. `.git`) is automatically exc ## Issues -Only [certain file extensions](src/FindReplaceCode/App.config) are currently considered for content replacement. Please let us know if there are others that should be added. +Only [certain file extensions](src/FindReplaceCode/ProgramSettings.cs) are currently considered for content replacement. Please let us know if there are others that should be added. ## Build Status Ubuntu | Windows | NuGet --- | --- | --- -[![Travis CI](https://img.shields.io/travis/Faithlife/FindReplaceCode/master.svg)](https://travis-ci.org/Faithlife/FindReplaceCode) | [![AppVeyor](https://img.shields.io/appveyor/ci/Faithlife/findreplacecode/master.svg)](https://ci.appveyor.com/project/Faithlife/findreplacecode) | [![NuGet](https://img.shields.io/nuget/v/FindReplaceCode.svg)](https://www.nuget.org/packages/FindReplaceCode) +[![Travis CI](https://img.shields.io/travis/Faithlife/FindReplaceCode/master.svg)](https://travis-ci.org/Faithlife/FindReplaceCode) | [![AppVeyor](https://img.shields.io/appveyor/ci/Faithlife/findreplacecode/master.svg)](https://ci.appveyor.com/project/Faithlife/findreplacecode) | [![NuGet](https://img.shields.io/nuget/v/Faithlife.FindReplaceCode.Tool.svg)](https://www.nuget.org/packages/Faithlife.FindReplaceCode.Tool) ## Documentation -* https://faithlife.github.io/FindReplaceCode/ * License: [MIT](LICENSE) * [Version History](VersionHistory.md) * [Contributing Guidelines](CONTRIBUTING.md) diff --git a/VersionHistory.md b/VersionHistory.md index ce33c33..3207e93 100644 --- a/VersionHistory.md +++ b/VersionHistory.md @@ -9,6 +9,6 @@ Prefix the description of the change with `[major]`, `[minor]` or `[patch]` in a ## Released -### 0.1.0 +### 1.0.0 * Initial release. diff --git a/build.cake b/build.cake index d0c8162..ace8b3a 100644 --- a/build.cake +++ b/build.cake @@ -1,5 +1,5 @@ -#addin "Cake.Git" -#addin nuget:?package=Cake.XmlDocMarkdown&version=1.4.1 +#addin Cake.Git +#addin Cake.XmlDocMarkdown&version=1.4.1 using System.Text.RegularExpressions; @@ -10,9 +10,6 @@ var trigger = Argument("trigger", ""); var versionSuffix = Argument("versionSuffix", ""); var solutionFileName = "FindReplaceCode.sln"; -var docsProjects = new[] { "FindReplaceCode" }; -var docsRepoUri = "https://github.com/Faithlife/FindReplaceCode.git"; -var docsSourceUri = "https://github.com/Faithlife/FindReplaceCode/tree/master/src"; var nugetSource = "https://api.nuget.org/v3/index.json"; var buildBotUserName = "faithlifebuildbot"; @@ -23,8 +20,6 @@ Task("Clean") { CleanDirectories("src/**/bin"); CleanDirectories("src/**/obj"); - CleanDirectories("tests/**/bin"); - CleanDirectories("tests/**/obj"); CleanDirectories("release"); }); @@ -45,49 +40,8 @@ Task("Rebuild") .IsDependentOn("Clean") .IsDependentOn("Build"); -Task("UpdateDocs") - .WithCriteria(!string.IsNullOrEmpty(buildBotPassword)) - .WithCriteria(EnvironmentVariable("APPVEYOR_REPO_BRANCH") == "master") - .IsDependentOn("Build") - .Does(() => - { - var branchName = "gh-pages"; - var docsDirectory = new DirectoryPath(branchName); - GitClone(docsRepoUri, docsDirectory, new GitCloneSettings { BranchName = branchName }); - - Information($"Updating documentation at {docsDirectory}."); - foreach (var docsProject in docsProjects) - { - XmlDocMarkdownGenerate(File($"src/{docsProject}/bin/{configuration}/net461/{docsProject}.dll").ToString(), $"{docsDirectory}{System.IO.Path.DirectorySeparatorChar}", - new XmlDocMarkdownSettings { SourceCodePath = $"{docsSourceUri}/{docsProject}", NewLine = "\n", ShouldClean = true }); - } - - if (GitHasUncommitedChanges(docsDirectory)) - { - Information("Committing all documentation changes."); - GitAddAll(docsDirectory); - GitCommit(docsDirectory, "Faithlife Build Bot", "faithlifebuildbot@users.noreply.github.com", "Automatic documentation update."); - Information("Pushing updated documentation to GitHub."); - GitPush(docsDirectory, buildBotUserName, buildBotPassword, branchName); - } - else - { - Information("No documentation changes detected."); - } - }); - -Task("Test") - .IsDependentOn("Build") - .Does(() => - { - foreach (var projectPath in GetFiles("tests/**/*.csproj").Select(x => x.FullPath)) - DotNetCoreTest(projectPath, new DotNetCoreTestSettings { Configuration = configuration, NoBuild = true, NoRestore = true }); - }); - Task("NuGetPackage") .IsDependentOn("Rebuild") - .IsDependentOn("Test") - .IsDependentOn("UpdateDocs") .Does(() => { if (string.IsNullOrEmpty(versionSuffix) && !string.IsNullOrEmpty(trigger)) @@ -96,17 +50,8 @@ Task("NuGetPackage") DotNetCorePack(projectPath, new DotNetCorePackSettings { Configuration = configuration, NoBuild = true, NoRestore = true, OutputDirectory = "release", VersionSuffix = versionSuffix }); }); -Task("NuGetPackageTest") - .IsDependentOn("NuGetPackage") - .Does(() => - { - var firstProject = GetFiles("src/**/*.csproj").First().FullPath; - foreach (var nupkg in GetFiles("release/**/*.nupkg").Select(x => x.FullPath)) - DotNetCoreTool(firstProject, "sourcelink", $"test {nupkg}"); - }); - Task("NuGetPublish") - .IsDependentOn("NuGetPackageTest") + .IsDependentOn("NuGetPackage") .Does(() => { var nupkgPaths = GetFiles("release/*.nupkg").Select(x => x.FullPath).ToList(); @@ -137,7 +82,7 @@ Task("NuGetPublish") }); Task("Default") - .IsDependentOn("Test"); + .IsDependentOn("Build"); void ExecuteProcess(string exePath, string arguments) { diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 8f697f5..48aefe8 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -21,9 +21,4 @@ $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb - - - - - diff --git a/src/FindReplaceCode/App.config b/src/FindReplaceCode/App.config deleted file mode 100644 index 52d31c4..0000000 --- a/src/FindReplaceCode/App.config +++ /dev/null @@ -1,18 +0,0 @@ - - - - -
- - - - - - - - - asax,cake,config,cs,csproj,fsd,html,json,md,nuspec,props,proto,ps1,settings,sln,xaml,yml - - - - diff --git a/src/FindReplaceCode/FindReplaceCode.csproj b/src/FindReplaceCode/FindReplaceCode.csproj index cf478f0..7f8186a 100644 --- a/src/FindReplaceCode/FindReplaceCode.csproj +++ b/src/FindReplaceCode/FindReplaceCode.csproj @@ -7,20 +7,4 @@ findreplacecode Faithlife.FindReplaceCode.Tool - - - True - True - Settings.settings - - - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - - - \ No newline at end of file diff --git a/src/FindReplaceCode/Program.cs b/src/FindReplaceCode/Program.cs index b923d1b..65e5ea3 100644 --- a/src/FindReplaceCode/Program.cs +++ b/src/FindReplaceCode/Program.cs @@ -6,7 +6,6 @@ using System.Linq; using System.Text; using System.Text.RegularExpressions; -using FindReplaceCode.Properties; namespace FindReplaceCode { @@ -256,7 +255,7 @@ private static bool ShouldFindReplaceFileContent(FileSystemInfo info) return false; string extension = Path.GetExtension(info.Name).ToLowerInvariant(); - return s_findReplaceFileContentExtensions.Contains(extension); + return ProgramSettings.FindReplaceFileContentExtensions.Contains(extension); } private string ReplaceStrings(string oldText) @@ -287,23 +286,20 @@ private static string RenderMatchingGuid(Match match, Guid value) return oldText != oldText.ToUpperInvariant() ? newText : newText.ToUpperInvariant(); } - const string c_guidPattern = @"\{[0-9a-zA-Z]{8}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{12}\}"; + private const string c_guidPattern = @"\{[0-9a-zA-Z]{8}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{12}\}"; - static readonly string s_fullUsageMessage = string.Join(Environment.NewLine, new[] + private static readonly string s_fullUsageMessage = string.Join(Environment.NewLine, new[] { "Usage: FindReplaceCode.exe [ ...]" }); - static readonly HashSet s_findReplaceFileContentExtensions = - new HashSet(Settings.Default.FindReplaceFileContentExtensions.Split(',').Select(x => "." + x.Trim())); + private static readonly Regex s_hiddenDirectoryRegex = new Regex(@"[\\/]\..*[\\/]", RegexOptions.CultureInvariant); - static readonly Regex s_hiddenDirectoryRegex = new Regex(@"[\\/]\..*[\\/]", RegexOptions.CultureInvariant); - - readonly string m_folderPath; - readonly ReadOnlyCollection> m_searchReplaceArgs; - List> m_searchReplacePairs; - List> m_searchReplaceGuids; - int m_editCount; - int m_renameCount; + private readonly string m_folderPath; + private readonly ReadOnlyCollection> m_searchReplaceArgs; + private List> m_searchReplacePairs; + private List> m_searchReplaceGuids; + private int m_editCount; + private int m_renameCount; } } diff --git a/src/FindReplaceCode/ProgramSettings.cs b/src/FindReplaceCode/ProgramSettings.cs new file mode 100644 index 0000000..91b2309 --- /dev/null +++ b/src/FindReplaceCode/ProgramSettings.cs @@ -0,0 +1,28 @@ +using System.Collections.Generic; + +namespace FindReplaceCode +{ + public static class ProgramSettings + { + public static readonly IReadOnlyCollection FindReplaceFileContentExtensions = new HashSet + { + ".asax", + ".cake", + ".config", + ".cs", + ".csproj", + ".fsd", + ".html", + ".json", + ".md", + ".nuspec", + ".props", + ".proto", + ".ps1", + ".settings", + ".sln", + ".xaml", + ".yml", + }; + } +} diff --git a/src/FindReplaceCode/Properties/Settings.Designer.cs b/src/FindReplaceCode/Properties/Settings.Designer.cs deleted file mode 100644 index 1eebe4c..0000000 --- a/src/FindReplaceCode/Properties/Settings.Designer.cs +++ /dev/null @@ -1,36 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace FindReplaceCode.Properties { - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.3.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default { - get { - return defaultInstance; - } - } - - [global::System.Configuration.ApplicationScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("asax,cake,config,cs,csproj,fsd,html,json,md,nuspec,proto,ps1,settings,sln,xaml,ym" + - "l")] - public string FindReplaceFileContentExtensions { - get { - return ((string)(this["FindReplaceFileContentExtensions"])); - } - } - } -} diff --git a/src/FindReplaceCode/Properties/Settings.settings b/src/FindReplaceCode/Properties/Settings.settings deleted file mode 100644 index 8a34584..0000000 --- a/src/FindReplaceCode/Properties/Settings.settings +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - asax,cake,config,cs,csproj,fsd,html,json,md,nuspec,proto,ps1,settings,sln,xaml,yml - - - diff --git a/tests/FindReplaceCode.Tests/FindReplaceCode.Tests.csproj b/tests/FindReplaceCode.Tests/FindReplaceCode.Tests.csproj deleted file mode 100644 index 8618d53..0000000 --- a/tests/FindReplaceCode.Tests/FindReplaceCode.Tests.csproj +++ /dev/null @@ -1,18 +0,0 @@ - - - - netcoreapp2.1 - latest - - - - - - - - - - - - - \ No newline at end of file