Skip to content

Commit

Permalink
Merge pull request #4 from messerli-informatik-ag/funcky3
Browse files Browse the repository at this point in the history
Update change-case to Funcky 3
  • Loading branch information
FreeApophis authored Sep 14, 2022
2 parents 6dfc7d4 + 590822b commit 606d6fa
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 28 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,19 @@ jobs:
run: dotnet build --configuration Release --no-restore /p:FodyGenerateXsd=false /p:TreatWarningsAsErrors=true
- name: Run Tests
run: dotnet test --configuration Release --no-build

nupkg:
name: Generate NuGet Packages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-dotnet@v1
name: Install Current .NET SDK
- name: Generate NuGet Packages
run: dotnet pack --configuration Release --output nupkg
- uses: actions/upload-artifact@v2
if: success() && github.ref == 'refs/heads/main'
with:
name: nupkg
path: nupkg/*
retention-days: 1
15 changes: 15 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<PropertyGroup Label="Common Settings">
<LangVersion>10.0</LangVersion>
<Nullable>enable</Nullable>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<ImplicitUsings>enable</ImplicitUsings>
<IsPackable>false</IsPackable>
</PropertyGroup>
<PropertyGroup Label="Shared NuGet Metadata">
<Authors>Messerli Informatik AG</Authors>
<PackageLicenseExpression>MIT OR Apache-2.0</PackageLicenseExpression>
Expand All @@ -9,4 +16,12 @@
<ItemGroup>
<PackageReference Include="Messerli.CodeStyle" PrivateAssets="all" />
</ItemGroup>
<PropertyGroup Label="Deterministic Builds and Source Link">
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<ContinuousIntegrationBuild Condition="'$(GITHUB_ACTIONS)' == 'true'">true</ContinuousIntegrationBuild>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
</PropertyGroup>
<ItemGroup Label="Deterministic Builds and Source Link">
<PackageReference Include="Microsoft.SourceLink.GitHub" PrivateAssets="all" VersionOverride="1.1.1" />
</ItemGroup>
</Project>
4 changes: 1 addition & 3 deletions Messerli.ChangeCase.Test/Messerli.ChangeCase.Test.csproj
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk; Microsoft.Build.CentralPackageVersions">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" />
Expand Down
4 changes: 2 additions & 2 deletions Messerli.ChangeCase.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30907.101
# Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{50491EE5-F685-4F7B-ABC3-FAF5D7E46F99}"
ProjectSection(SolutionItems) = preProject
Expand Down
7 changes: 3 additions & 4 deletions Messerli.ChangeCase/Messerli.ChangeCase.csproj
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk; Microsoft.Build.CentralPackageVersions">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net5.0</TargetFrameworks>
<LangVersion>9.0</LangVersion>
<Nullable>enable</Nullable>
<TargetFrameworks>netstandard2.0;net6.0</TargetFrameworks>
<Product>Messerli.ChangeCase</Product>
<IsPackable>true</IsPackable>
<Description>Transform a string between different casings.</Description>
<PackageTags>Utility Casing</PackageTags>
<Version>1.1.0</Version>
<Version>1.2.0</Version>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
</PropertyGroup>
Expand Down
11 changes: 4 additions & 7 deletions Messerli.ChangeCase/StringCaseExtensions.Private.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Funcky;
using Funcky;
using Funcky.Extensions;
using Funcky.Monads;

Expand Down Expand Up @@ -30,7 +27,7 @@ private static ExtractElement SelectSplitStrategy(string identifier)

private static Option<SplitResult> SplitOnCasing(string identifier, int startIndex)
=> startIndex >= identifier.Length
? Option<SplitResult>.None()
? Option<SplitResult>.None
: ExtractByCasing(identifier, startIndex);

private static Option<SplitResult> ExtractByCasing(string identifier, int startIndex)
Expand Down Expand Up @@ -78,7 +75,7 @@ private static bool NextIsAbbreviation(string identifier, int startIndex)

private static Option<SplitResult> SplitOnSeparators(string identifier, int startIndex)
=> startIndex > identifier.Length
? Option<SplitResult>.None()
? Option<SplitResult>.None
: ExtractBySeparator(identifier, startIndex);

private static SplitResult ExtractBySeparator(string identifier, int startIndex)
Expand All @@ -105,7 +102,7 @@ private static string JoinStrings(this IEnumerable<string> strings, string separ

private static IEnumerable<string> SplitBy(this string text, ExtractElement extractNext)
=> Sequence
.Generate(new SplitResult(0, string.Empty), previous => extractNext(text, previous.NextStartIndex))
.Successors(extractNext(text, 0), previous => extractNext(text, previous.NextStartIndex))
.Select(r => r.Result);

private static int GetIndex(ValueWithIndex<char> value)
Expand Down
4 changes: 1 addition & 3 deletions Messerli.ChangeCase/StringCaseExtensions.SplitResult.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using Funcky.Monads;

namespace Messerli.ChangeCase
namespace Messerli.ChangeCase
{
public static partial class StringCaseExtensions
{
Expand Down
14 changes: 7 additions & 7 deletions Packages.props
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<ItemGroup Label="Runtime Dependencies">
<PackageReference Update="Funcky" Version="[2.4.0, 3)" />
<PackageReference Update="Funcky" Version="[3.0.0, 4)" />
</ItemGroup>
<ItemGroup Label="Build Dependencies">
<PackageReference Update="Messerli.CodeStyle" Version="2.0.1" />
<PackageReference Update="Messerli.CodeStyle" Version="2.1.3" />
</ItemGroup>
<ItemGroup Label="Test Dependencies">
<PackageReference Update="Microsoft.NET.Test.Sdk" Version="15.9.0" />
<PackageReference Update="xunit" Version="2.4.0" />
<PackageReference Update="xunit.runner.visualstudio" Version="2.4.0" />
<PackageReference Update="Funcky.Xunit" Version="0.1.3" />
<PackageReference Update="coverlet.collector" Version="3.0.2" />
<PackageReference Update="Microsoft.NET.Test.Sdk" Version="17.3.1" />
<PackageReference Update="xunit" Version="2.4.2" />
<PackageReference Update="xunit.runner.visualstudio" Version="2.4.5" />
<PackageReference Update="Funcky.Xunit" Version="2.0.0" />
<PackageReference Update="coverlet.collector" Version="3.1.2" />
</ItemGroup>
</Project>
4 changes: 2 additions & 2 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"sdk": {
"version": "5.0.100",
"version": "6.0.400",
"rollForward": "feature"
},
"msbuild-sdks": {
"Microsoft.Build.CentralPackageVersions" : "2.0.79"
"Microsoft.Build.CentralPackageVersions" : "2.1.3"
}
}

0 comments on commit 606d6fa

Please sign in to comment.