Skip to content

Commit 89d45fa

Browse files
committed
Merge branch 'devel'
2 parents 4b94544 + ff9c23a commit 89d45fa

11 files changed

+74
-17
lines changed

README.ja.md

+19-3
Original file line numberDiff line numberDiff line change
@@ -204,11 +204,10 @@ namespace global
204204
9. 以後、コードを変更してリリースの準備が出来たら、新たにタグをつければそれがAssemblyVersionに反映されるので、ビルドしてバイナリをリリースします。
205205
* dotnet cliを使用してNuGetのパッケージをビルドする場合にも、`PackageVersion``PackageReleaseNotes`は自動的に適用されます。完成してデプロイする場合は、`dotnet pack`コマンドを使えば、NuGetのバージョンを一元管理できます。
206206

207-
----
208207

209-
## ヒントや参考情報
208+
----
210209

211-
### プレーンテキストフォーマットの出力
210+
### コマンドラインインターフェイス (CLI)
212211

213212
RelaxVersionerは、dotnet CLI toolに対応しています。
214213
`rv`コマンドは、 `dotnet tool install -g rv-cli` でインストールすることが出来ます。
@@ -257,9 +256,24 @@ $ echo "@@@{commitId}@@@" | rv -r .
257256
$ rv -i input.txt -o output.txt .
258257
```
259258

259+
置き換えるキーワードの標準ブラケットは波括弧 '{ ... }' の形式ですが、異なるブラケット文字を使用することも出来ます。
260+
例えば、ドキュメントに適用する場合は、波括弧では誤検出を起こす可能性があるので、カスタムブラケットを指定して置き換えます:
261+
262+
```bash
263+
# カスタムブラケットで置き換える
264+
# 左括弧と右括弧の定義をカンマで区切る
265+
$ echo "ABC#{commitId}#XYZ" | rv -r --bracket "#{,}#" .
266+
ABC0123456789abc ... XYZ
267+
```
268+
260269
このCLIを使用すれば、.NETとは異なる対象に対してRelaxVersionerを組み合わせて使用できます。
261270
例えば、GitHub ActionsのようなCI/CD環境で、NPMパッケージ生成にバージョンを適用したり、テキストのドキュメントにバージョンを埋め込んだりすることが出来ます。
262271

272+
273+
----
274+
275+
## ヒントや参考情報
276+
263277
### ビルド後にバージョン番号を使用する方法
264278

265279
RelaxVersionerは、ビルド後に、以下の位置にファイルを保存します:
@@ -516,6 +530,8 @@ nuspecファイルを使ってパッケージを生成する場合は、デフ
516530

517531
## 履歴
518532

533+
* 3.7.0:
534+
* CLIでカスタムブラケット指定に対応しました。
519535
* 3.6.0:
520536
* プレーンテキスト出力のフォーマットを指定可能にしました
521537
* プレーンテキストを標準出力に出力できるようにしました。

README.md

+25-3
Original file line numberDiff line numberDiff line change
@@ -199,11 +199,10 @@ namespace global
199199
9. Development cycles: next codes change and ready to release, you are tagging new version and then build, output binary auto tagged in AssemblyVersion and store informations.
200200
* We can apply with automated version number when "dotnet cli" for generate NuGet package (`PackageVersion` and `PackageReleaseNotes` attributes). You can use only `dotnet pack` command.
201201

202-
----
203202

204-
## Hints and Tips
203+
----
205204

206-
### Output in plain text format
205+
## Command line interface (CLI)
207206

208207
RelaxVersioner supports the dotnet CLI tool.
209208
The `rv` command can be installed with `dotnet tool install -g rv-cli`.
@@ -252,9 +251,25 @@ $ echo "@@@{commitId}@@@" | rv -r .
252251
$ rv -i input.txt -o output.txt .
253252
```
254253

254+
The standard bracket for the replacement keyword is in the form of braces '{ ... }', but different bracket characters can be used.
255+
For example, when applied to a document, braces can cause false positives, so a custom bracket is used to replace them:
256+
257+
```bash
258+
# Replace with custom brackets
259+
# Separate left and right bracket definitions with commas
260+
$ echo "ABC#{commitId}#XYZ" | rv -r --bracket "#{,}#" .
261+
ABC0123456789abc ... XYZ
262+
```
263+
264+
Translated with DeepL.com (free version)
255265
With this CLI, you can use a combination of RelaxVersioner for different targets than .NET.
256266
For example, in a CI/CD environment like GitHub Actions, you can apply versions to NPM package generation or embed versions in your text documentation.
257267

268+
269+
----
270+
271+
## Hints and Tips
272+
258273
### How to use version numbers after building process
259274

260275
RelaxVersioner saves the files in the following location after build:
@@ -495,6 +510,13 @@ When you are using a nuspec file to generate a NuGet package, there are addition
495510

496511
## History
497512

513+
* 3.7.0:
514+
* CLI now supports custom bracket specification.
515+
* 3.6.0:
516+
* Plain text output format on CLI can now be specified
517+
* Plain text on CLI can now be output to standard output.
518+
* Added replace mode on CLI.
519+
* Simplified the CLI version options to work with fewer specifications.
498520
* 3.5.0:
499521
* Added for specify the format of plain text output.
500522
* Plain text can now be output to standard output.

RelaxVersioner.Core/Processor.cs

+2
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ public sealed class ProcessorContext
3838
public string PropertiesPath;
3939
public string TextFormat;
4040
public string ReplaceInputPath;
41+
public string BracketStart;
42+
public string BracketEnd;
4143
public bool IsDryRun;
4244
}
4345

RelaxVersioner.Core/RelaxVersioner.Core.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313

1414
<ItemGroup>
1515
<PackageReference Include="GitReader" Version="1.8.0" />
16-
<PackageReference Include="NamingFormatter" Version="2.3.0" />
16+
<PackageReference Include="NamingFormatter" Version="2.4.0" />
1717
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3" PrivateAssets="All" />
1818
<PackageReference Condition="'$(RV_BOOTSTRAP)' != 'True'"
19-
Include="RelaxVersioner" Version="3.5.0" PrivateAssets="all" />
19+
Include="RelaxVersioner" Version="3.6.0" PrivateAssets="all" />
2020
</ItemGroup>
2121

2222
<ItemGroup>

RelaxVersioner.Core/Writers/SourceCodeWriteProviderBase.cs

+4-2
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ private void Write(
5656
CultureInfo.InvariantCulture,
5757
rule.Format,
5858
keyValues,
59-
key => string.Empty);
59+
key => string.Empty,
60+
new(context.BracketStart, context.BracketEnd));
6061
if (!string.IsNullOrWhiteSpace(rule.Key))
6162
{
6263
this.WriteAttributeWithArguments(tw, rule.Name, rule.Key, formattedValue);
@@ -87,7 +88,8 @@ private void Write(
8788
CultureInfo.InvariantCulture,
8889
rule.Format,
8990
keyValues,
90-
key => string.Empty);
91+
key => string.Empty,
92+
new(context.BracketStart, context.BracketEnd));
9193
if (!string.IsNullOrWhiteSpace(rule.Key))
9294
{
9395
this.WriteLiteralWithArgument(tw, rule.Key, formattedValue);

RelaxVersioner.Core/Writers/TextReplaceProvider.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ void Replace(TextReader tr, TextWriter tw)
4242
CultureInfo.InvariantCulture,
4343
line,
4444
keyValues,
45-
key => string.Empty);
45+
key => string.Empty,
46+
new(context.BracketStart, context.BracketEnd));
4647

4748
tw.WriteLine(formattedLine);
4849
}

RelaxVersioner.Core/Writers/TextWriteProvider.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ void Write(TextWriter tw, bool emitEol)
3636
CultureInfo.InvariantCulture,
3737
context.TextFormat,
3838
keyValues,
39-
key => string.Empty);
39+
key => string.Empty,
40+
new(context.BracketStart, context.BracketEnd));
4041

4142
if (emitEol)
4243
{

RelaxVersioner.Tasks/RelaxVersioner.Tasks.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
<ItemGroup>
3030
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3" PrivateAssets="All" />
3131
<PackageReference Condition="'$(RV_BOOTSTRAP)' != 'True'"
32-
Include="RelaxVersioner" Version="3.5.0" PrivateAssets="all" />
32+
Include="RelaxVersioner" Version="3.6.0" PrivateAssets="all" />
3333
</ItemGroup>
3434

3535
</Project>

RelaxVersioner/Program.cs

+10-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,16 @@ public static async Task<int> Main(string[] args)
6969
context.ReplaceInputPath = v;
7070
context.Language = "Replace";
7171
}
72-
},
72+
},
73+
{ "bracket=", "enable custom bracket", v =>
74+
{
75+
if (v.Split(',') is { Length: 2 } splitted)
76+
{
77+
context.BracketStart = splitted[0];
78+
context.BracketEnd = splitted[1];
79+
}
80+
}
81+
},
7382
{ "dryrun", "dryrun mode", _ => context.IsDryRun = true },
7483
{ "launchDebugger", "Launch debugger", _ => launchDebugger = true },
7584
{ "help", "help", v => help = v != null },

RelaxVersioner/RelaxVersioner.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3" PrivateAssets="All" />
3838
<PackageReference Include="Mono.Options" Version="6.12.0.148" />
3939
<PackageReference Condition="'$(RV_BOOTSTRAP)' != 'True'"
40-
Include="RelaxVersioner" Version="3.5.0" PrivateAssets="all" />
40+
Include="RelaxVersioner" Version="3.6.0" PrivateAssets="all" />
4141
</ItemGroup>
4242

4343
<ItemGroup>

rv-cli/rv-cli.csproj

+6-2
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,17 @@
2727
<ItemGroup>
2828
<PackageReference Include="Mono.Options" Version="6.12.0.148" />
2929
<PackageReference Condition="'$(RV_BOOTSTRAP)' != 'True'"
30-
Include="RelaxVersioner" Version="3.5.0" PrivateAssets="all" />
30+
Include="RelaxVersioner" Version="3.6.0" PrivateAssets="all" />
3131
</ItemGroup>
3232

3333
<ItemGroup>
3434
<ProjectReference Include="..\RelaxVersioner.Core\RelaxVersioner.Core.csproj" />
3535
</ItemGroup>
36-
36+
37+
<ItemGroup>
38+
<None Include="..\Images\RelaxVersioner.100.png" Link="Images\RelaxVersioner.100.png" Pack="true" PackagePath="\" />
39+
</ItemGroup>
40+
3741
<ItemGroup>
3842
<Compile Include="..\RelaxVersioner\*.cs" />
3943
<Compile Include="..\RelaxVersioner\Properties\*.cs" LinkBase="Properties\" />

0 commit comments

Comments
 (0)