Skip to content

Commit fbd08ac

Browse files
authored
Merge pull request #31 from mayuki/vNext
Rin v2.0
2 parents afc44df + 8cfb326 commit fbd08ac

File tree

199 files changed

+37627
-40810
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

199 files changed

+37627
-40810
lines changed

.editorconfig

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
# To learn more about .editorconfig see https://aka.ms/editorconfigdocs
2+
###############################
3+
# Core EditorConfig Options #
4+
###############################
5+
root = true
6+
7+
# All files
8+
[*]
9+
indent_style = space
10+
11+
# Code files
12+
[*.{cs,csx,vb,vbx}]
13+
indent_size = 4
14+
insert_final_newline = true
15+
charset = utf-8
16+
17+
18+
###############################
19+
# .NET Coding Conventions #
20+
###############################
21+
[*.{cs,vb}]
22+
# Organize usings
23+
dotnet_sort_system_directives_first = true
24+
# this. preferences
25+
dotnet_style_qualification_for_field = false:silent
26+
dotnet_style_qualification_for_property = false:silent
27+
dotnet_style_qualification_for_method = false:silent
28+
dotnet_style_qualification_for_event = false:silent
29+
# Language keywords vs BCL types preferences
30+
dotnet_style_predefined_type_for_locals_parameters_members = true:silent
31+
dotnet_style_predefined_type_for_member_access = true:silent
32+
# Parentheses preferences
33+
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent
34+
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent
35+
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent
36+
dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent
37+
# Modifier preferences
38+
dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent
39+
dotnet_style_readonly_field = true:suggestion
40+
# Expression-level preferences
41+
dotnet_style_object_initializer = true:suggestion
42+
dotnet_style_collection_initializer = true:suggestion
43+
dotnet_style_explicit_tuple_names = true:suggestion
44+
dotnet_style_null_propagation = true:suggestion
45+
dotnet_style_coalesce_expression = true:suggestion
46+
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:silent
47+
dotnet_style_prefer_inferred_tuple_names = true:suggestion
48+
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
49+
dotnet_style_prefer_auto_properties = true:silent
50+
dotnet_style_prefer_conditional_expression_over_assignment = true:silent
51+
dotnet_style_prefer_conditional_expression_over_return = true:silent
52+
###############################
53+
# Naming Conventions #
54+
###############################
55+
# Style Definitions
56+
dotnet_naming_style.pascal_case_style.capitalization = pascal_case
57+
# Use PascalCase for constant fields
58+
dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion
59+
dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
60+
dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
61+
dotnet_naming_symbols.constant_fields.applicable_kinds = field
62+
dotnet_naming_symbols.constant_fields.applicable_accessibilities = *
63+
dotnet_naming_symbols.constant_fields.required_modifiers = const
64+
###############################
65+
# C# Coding Conventions #
66+
###############################
67+
[*.cs]
68+
# var preferences
69+
csharp_style_var_for_built_in_types = true:silent
70+
csharp_style_var_when_type_is_apparent = true:silent
71+
csharp_style_var_elsewhere = true:silent
72+
# Expression-bodied members
73+
csharp_style_expression_bodied_methods = false:silent
74+
csharp_style_expression_bodied_constructors = false:silent
75+
csharp_style_expression_bodied_operators = false:silent
76+
csharp_style_expression_bodied_properties = true:silent
77+
csharp_style_expression_bodied_indexers = true:silent
78+
csharp_style_expression_bodied_accessors = true:silent
79+
# Pattern matching preferences
80+
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
81+
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
82+
# Null-checking preferences
83+
csharp_style_throw_expression = true:suggestion
84+
csharp_style_conditional_delegate_call = true:suggestion
85+
# Modifier preferences
86+
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:suggestion
87+
# Expression-level preferences
88+
csharp_prefer_braces = true:silent
89+
csharp_style_deconstructed_variable_declaration = true:suggestion
90+
csharp_prefer_simple_default_expression = true:suggestion
91+
csharp_style_pattern_local_over_anonymous_function = true:suggestion
92+
csharp_style_inlined_variable_declaration = true:suggestion
93+
###############################
94+
# C# Formatting Rules #
95+
###############################
96+
# New line preferences
97+
csharp_new_line_before_open_brace = all
98+
csharp_new_line_before_else = true
99+
csharp_new_line_before_catch = true
100+
csharp_new_line_before_finally = true
101+
csharp_new_line_before_members_in_object_initializers = true
102+
csharp_new_line_before_members_in_anonymous_types = true
103+
csharp_new_line_between_query_expression_clauses = true
104+
# Indentation preferences
105+
csharp_indent_case_contents = true
106+
csharp_indent_switch_labels = true
107+
csharp_indent_labels = flush_left
108+
# Space preferences
109+
csharp_space_after_cast = false
110+
csharp_space_after_keywords_in_control_flow_statements = true
111+
csharp_space_between_method_call_parameter_list_parentheses = false
112+
csharp_space_between_method_declaration_parameter_list_parentheses = false
113+
csharp_space_between_parentheses = false
114+
csharp_space_before_colon_in_inheritance_clause = true
115+
csharp_space_after_colon_in_inheritance_clause = true
116+
csharp_space_around_binary_operators = before_and_after
117+
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
118+
csharp_space_between_method_call_name_and_opening_parenthesis = false
119+
csharp_space_between_method_call_empty_parameter_list_parentheses = false
120+
# Wrapping preferences
121+
csharp_preserve_single_line_statements = true
122+
csharp_preserve_single_line_blocks = true

.github/workflows/build.yml

Lines changed: 36 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,60 @@
1-
name: CI
1+
name: Build-Development
22

3-
on: [push]
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
types:
9+
- opened
10+
- synchronize
411

512
jobs:
613
build:
714

815
runs-on: ubuntu-latest
16+
env:
17+
DOTNET_NOLOGO: true
918

1019
steps:
1120
- uses: actions/checkout@v1
21+
1222
- uses: actions/setup-dotnet@v1
1323
with:
14-
dotnet-version: 3.0.100
15-
- uses: actions/setup-dotnet@v1
16-
with:
17-
dotnet-version: 2.2.402
18-
- name: npm install & build & pack (Rin.Frontend)
24+
dotnet-version: '3.1.x'
25+
26+
- name: "Set VersionSuffix"
27+
run: |
28+
echo "::set-env name=VERSION_SUFFIX::preview.`date '+%Y%m%d-%H%M%S'`+${GITHUB_SHA:0:6}"
29+
30+
- name: "Get git tag"
31+
if: "contains(github.ref, 'refs/tags')"
32+
run: echo ::set-env name=GIT_TAG::${GITHUB_REF#refs/tags/}
33+
34+
- name: "Rin.Frontend: build & pack"
1935
working-directory: src/Rin.Frontend
2036
run: |
21-
npm install
22-
npm run build
23-
npm run pack
24-
- name: npm install & build & pack (Rin.Mvc.Frontend)
37+
yarn
38+
yarn run build
39+
yarn run pack
40+
41+
- name: "Rin.Mvc.Frontend: build"
2542
working-directory: src/Rin.Mvc.Frontend
2643
run: |
27-
npm install
28-
npm run build
44+
yarn
45+
yarn run build
46+
2947
- name: Copy Rin.Mvc.Frontend
3048
run: |
3149
mkdir -p src/Rin.Mvc/EmbeddedResources/
32-
cp -R src/Rin.Mvc.Frontend/build/static/* src/Rin.Mvc/EmbeddedResources/
33-
- name: dotnet
50+
cp -R src/Rin.Mvc.Frontend/dist/static/* src/Rin.Mvc/EmbeddedResources/
51+
52+
- name: "dotnet build & pack"
3453
run: |
3554
dotnet restore
3655
dotnet build -c Release
37-
dotnet pack -c Release -o $GITHUB_WORKSPACE/artifacts --version-suffix preview.`date +%Y%m%d%H%M%S`
56+
dotnet pack -c Release -o $GITHUB_WORKSPACE/artifacts --version-suffix "$VERSION_SUFFIX" -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg
57+
3858
- uses: actions/upload-artifact@master
3959
with:
4060
name: Packages

.github/workflows/release.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Build-Release
2+
3+
on:
4+
push:
5+
tags:
6+
- v*
7+
8+
jobs:
9+
release:
10+
if: "contains(github.ref, 'refs/tags')"
11+
12+
runs-on: ubuntu-latest
13+
env:
14+
DOTNET_NOLOGO: true
15+
16+
steps:
17+
- uses: actions/checkout@v1
18+
19+
- uses: actions/setup-dotnet@v1
20+
with:
21+
dotnet-version: '3.1.x'
22+
23+
- name: "Set VersionSuffix for Preview"
24+
if: "contains(github.ref, 'refs/tags') && contains(github.ref, 'preview')"
25+
run: |
26+
echo "::set-env name=VERSION_SUFFIX::preview.`date '+%Y%m%d-%H%M%S'`+${GITHUB_SHA:0:6}"
27+
28+
- name: "Get git tag"
29+
if: "contains(github.ref, 'refs/tags')"
30+
run: echo ::set-env name=GIT_TAG::${GITHUB_REF#refs/tags/}
31+
32+
- name: "Rin.Frontend: build & pack"
33+
working-directory: src/Rin.Frontend
34+
run: |
35+
yarn
36+
yarn run build
37+
yarn run pack
38+
39+
- name: "Rin.Mvc.Frontend: build"
40+
working-directory: src/Rin.Mvc.Frontend
41+
run: |
42+
yarn
43+
yarn run build
44+
45+
- name: Copy Rin.Mvc.Frontend
46+
run: |
47+
mkdir -p src/Rin.Mvc/EmbeddedResources/
48+
cp -R src/Rin.Mvc.Frontend/dist/static/* src/Rin.Mvc/EmbeddedResources/
49+
50+
- name: "dotnet build & pack"
51+
run: |
52+
dotnet restore
53+
dotnet build -c Release
54+
dotnet pack -c Release -o $GITHUB_WORKSPACE/artifacts --version-suffix "$VERSION_SUFFIX" -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg
55+
56+
- uses: actions/upload-artifact@master
57+
with:
58+
name: Packages
59+
path: artifacts
60+
61+
- name: "Push to NuGet.org"
62+
run: |
63+
dotnet nuget push "$GITHUB_WORKSPACE/artifacts/*.nupkg" --skip-duplicate -k ${{ secrets.NUGET_KEY }} -s https://api.nuget.org/v3/index.json

Directory.Build.props

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<VersionPrefix>2.0.0</VersionPrefix>
5+
<VersionSuffix>$(VersionSuffix)</VersionSuffix>
6+
<LangVersion>latest</LangVersion>
7+
8+
<!-- NuGet Package Information -->
9+
<Description>Request/response Inspector middleware for ASP.NET Core</Description>
10+
<Authors>Mayuki Sawatari</Authors>
11+
<Copyright>Copyright 2019-present Mayuki Sawatari</Copyright>
12+
<PackageProjectUrl>https://github.com/mayuki/Rin</PackageProjectUrl>
13+
<RepositoryUrl>https://github.com/mayuki/Rin</RepositoryUrl>
14+
<PackageIcon>logo.png</PackageIcon>
15+
<PackageTags>Rin ASP.NET Request Inspector</PackageTags>
16+
<PackageLicenseExpression>MIT</PackageLicenseExpression>
17+
</PropertyGroup>
18+
</Project>

README.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,8 @@ You can replay a request easily using cURL and LINQPad.
4747
![](docs/images/Screenshot-04.png)
4848

4949
# 📝 Requirements
50-
- .NET Core 2.0+
51-
- ASP.NET Core 2.1+
52-
- ASP.NET Core MVC 2.1+
50+
- .NET Core 3.1+
51+
- ASP.NET Core 3.1+
5352
- Modern browser (e.g. Microsoft Edge, Google Chrome, Firefox, Safari...)
5453
- WebSocket connectivity
5554

@@ -94,11 +93,9 @@ public class Startup
9493
public void ConfigureServices(IServiceCollection services)
9594
{
9695
...
97-
98-
services.AddMvc()
96+
services.AddControllersWithViews()
9997
// Add(option): Enable ASP.NET Core MVC support if the project built with ASP.NET Core MVC
100-
.AddRinMvcSupport()
101-
.SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
98+
.AddRinMvcSupport();
10299

103100
// Add: Register Rin services
104101
services.AddRin();

Rin.sln

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio 15
4-
VisualStudioVersion = 15.0.27703.2026
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.30128.74
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Rin", "src\Rin\Rin.csproj", "{B9CDC00F-4AED-49D5-B4DC-6520FAF371CB}"
77
EndProject
@@ -13,7 +13,19 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Rin.Mvc", "src\Rin.Mvc\Rin.
1313
EndProject
1414
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Rin.Log4NetAppender", "src\Rin.Log4NetAppender\Rin.Log4NetAppender.csproj", "{20890D4F-9D03-4663-ACCE-D4404E8A8AF6}"
1515
EndProject
16-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Rin.Storage.Redis", "src\Rin.Storage.Redis\Rin.Storage.Redis.csproj", "{306BC2D2-ACB8-4F60-9D03-6EAAAD6CF8F0}"
16+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Rin.Storage.Redis", "src\Rin.Storage.Redis\Rin.Storage.Redis.csproj", "{306BC2D2-ACB8-4F60-9D03-6EAAAD6CF8F0}"
17+
EndProject
18+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{FFF7EB81-6AC3-4509-ACB5-502DECFAE084}"
19+
ProjectSection(SolutionItems) = preProject
20+
src\.editorconfig = src\.editorconfig
21+
Directory.Build.props = Directory.Build.props
22+
EndProjectSection
23+
EndProject
24+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "GitHub Actions", "GitHub Actions", "{7BFF5E34-A85B-4B34-B0F8-676A081EC620}"
25+
ProjectSection(SolutionItems) = preProject
26+
.github\workflows\build.yml = .github\workflows\build.yml
27+
.github\workflows\release.yml = .github\workflows\release.yml
28+
EndProjectSection
1729
EndProject
1830
Global
1931
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -47,6 +59,7 @@ Global
4759
EndGlobalSection
4860
GlobalSection(NestedProjects) = preSolution
4961
{921C0263-C56A-4332-897C-2107D0E0DDF2} = {B82C9F89-AD8F-473B-AA41-3061CD0FE9DF}
62+
{7BFF5E34-A85B-4B34-B0F8-676A081EC620} = {FFF7EB81-6AC3-4509-ACB5-502DECFAE084}
5063
EndGlobalSection
5164
GlobalSection(ExtensibilityGlobals) = postSolution
5265
SolutionGuid = {739B12D9-4F90-4F23-B6FE-D0A94CFB1608}

samples/HelloRin/Controllers/HomeController.cs

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,21 @@
55
using System.Threading.Tasks;
66
using Microsoft.AspNetCore.Mvc;
77
using HelloRin.Models;
8+
using Microsoft.Extensions.Logging;
89

910
namespace HelloRin.Controllers
1011
{
1112
public class HomeController : Controller
1213
{
13-
public IActionResult Index()
14-
{
15-
return View();
16-
}
14+
private readonly ILogger<HomeController> _logger;
1715

18-
public IActionResult About()
16+
public HomeController(ILogger<HomeController> logger)
1917
{
20-
ViewData["Message"] = "Your application description page.";
21-
22-
return View();
18+
_logger = logger;
2319
}
2420

25-
public IActionResult Contact()
21+
public IActionResult Index()
2622
{
27-
ViewData["Message"] = "Your contact page.";
28-
2923
return View();
3024
}
3125

samples/HelloRin/Controllers/MyApiController.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ public IActionResult Index()
2828
return Content("Index");
2929
}
3030

31+
public async Task<IActionResult> InvokeGrpc([FromServices] Greeter.GreeterClient client)
32+
{
33+
return Content((await client.SayHelloAsync(new HelloRequest() { Name = "Alice" })).Message);
34+
}
35+
3136
public async Task<string> Delay(int ms)
3237
{
3338
await Task.Delay(ms);

0 commit comments

Comments
 (0)