Skip to content

Commit

Permalink
feat: add a 'None' IncrementType which does not perform any increment…
Browse files Browse the repository at this point in the history
… operation
  • Loading branch information
philasmar committed Mar 20, 2024
1 parent dae6b9e commit 66b0c02
Show file tree
Hide file tree
Showing 12 changed files with 38 additions and 9 deletions.
3 changes: 2 additions & 1 deletion .autover/autover.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
"IncrementType": "Patch"
}
],
"UseCommitsForChangelog": false
"UseCommitsForChangelog": false,
"DefaultIncrementType": "Patch"
}
10 changes: 10 additions & 0 deletions .autover/changes/91e799df-e484-4aa6-b145-c257a82b748b.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"Projects": [
{
"Name": "AutoVer",
"ChangelogMessages": [
"Add a \u0027None\u0027 IncrementType which does not perform any increment operation"
]
}
]
}
10 changes: 10 additions & 0 deletions .autover/changes/e0a1bb4c-3276-420d-bce0-5091551ed578.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"Projects": [
{
"Name": "AutoVer",
"ChangelogMessages": [
"Add icon to the AutoVer NuGet package"
]
}
]
}
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -396,4 +396,6 @@ FodyWeavers.xsd

# JetBrains Rider
*.sln.iml
.idea/
.idea/

.DS_Store
Binary file added icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 4 additions & 2 deletions src/AutoVer/AutoVer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,21 @@
<RepositoryType>git</RepositoryType>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageIcon>icon.png</PackageIcon>
<Version>0.0.14</Version>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="LibGit2Sharp" Version="0.29.0" />
<PackageReference Include="LibGit2Sharp" Version="0.30.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
<PackageReference Include="System.Text.Json" Version="8.0.0" />
<PackageReference Include="System.Text.Json" Version="8.0.3" />
</ItemGroup>

<ItemGroup>
<None Include="..\..\LICENSE" Pack="true" PackagePath="" />
<None Include="..\..\README.md" Pack="true" PackagePath="" />
<None Include="..\..\icon.png" Pack="true" PackagePath="" />
</ItemGroup>

</Project>
1 change: 1 addition & 0 deletions src/AutoVer/Models/IncrementType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ namespace AutoVer.Models;

public enum IncrementType
{
None,
Patch,
Minor,
Major
Expand Down
5 changes: 3 additions & 2 deletions src/AutoVer/Models/UserConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ public class UserConfiguration
internal string? GitRoot { get; set; }
internal bool PersistConfiguration { get; set; }
public List<Project> Projects { get; set; } = [];

public bool UseCommitsForChangelog { get; set; } = true;


[JsonConverter(typeof(JsonStringEnumConverter))]
public IncrementType DefaultIncrementType { get; set; } = IncrementType.Patch;
public Dictionary<string, string>? ChangelogCategories { get; set; }

public class Project
Expand Down
2 changes: 1 addition & 1 deletion src/AutoVer/Services/ConfigurationManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public async Task ResetUserConfiguration(UserConfiguration userConfiguration, Us
changeFileHandler.ResetChangeFiles(userConfiguration);

if (resetRequest.IncrementType)
project.IncrementType = IncrementType.Patch;
project.IncrementType = userConfiguration.DefaultIncrementType;
}

await using (var stream = new FileStream(configPath, FileMode.Create))
Expand Down
2 changes: 1 addition & 1 deletion src/AutoVer/Services/IProjectHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ namespace AutoVer.Services;
public interface IProjectHandler
{
Task<List<ProjectDefinition>> GetAvailableProjects(string? projectPath);
void UpdateVersion(ProjectDefinition projectDefinition, IncrementType incrementType = IncrementType.Patch, string? prereleaseLabel = null);
void UpdateVersion(ProjectDefinition projectDefinition, IncrementType incrementType, string? prereleaseLabel = null);
bool ProjectHasVersionTag(ProjectDefinition projectDefinition);
}
2 changes: 1 addition & 1 deletion src/AutoVer/Services/IVersionIncrementer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ namespace AutoVer.Services;
public interface IVersionIncrementer
{
ThreePartVersion GetCurrentVersion(string? versionText);
ThreePartVersion GetNextVersion(string? versionText, IncrementType incrementType = IncrementType.Patch, string? prereleaseLabel = null);
ThreePartVersion GetNextVersion(string? versionText, IncrementType incrementType, string? prereleaseLabel = null);
}
2 changes: 2 additions & 0 deletions src/AutoVer/Services/ThreePartVersionIncrementer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ public ThreePartVersion GetNextVersion(string? versionText, IncrementType increm
case IncrementType.Patch:
nextVersion.Patch += 1;
break;
case IncrementType.None:
break;
}

return nextVersion;
Expand Down

0 comments on commit 66b0c02

Please sign in to comment.