Compare commits
30 commits
Author | SHA1 | Date | |
---|---|---|---|
e2b4239209 | |||
cc0c6b8859 | |||
8f33ddb76c | |||
b0947dd539 | |||
aa1eae40e0 | |||
9fc55bbbeb | |||
1910a01788 | |||
152428b235 | |||
962e1f0d11 | |||
a623ffe318 | |||
0603603be0 | |||
5ea22dce9a | |||
294d9c0a38 | |||
34fb0108ef | |||
4093d9c0cb | |||
e6a8ce42c7 | |||
b1928f5228 | |||
f3b18dc54a | |||
e71f389fcd | |||
739d0674fa | |||
cf06d4cd3d | |||
c3c3d60e5f | |||
|
c8c2c80cd2 | ||
|
4fdefa8d44 | ||
|
c9d2de2b3c | ||
|
37f5e3f4cb | ||
|
2d8829b8e9 | ||
|
e69971df7f | ||
|
2800cd039a | ||
|
233656abb9 |
40 changed files with 645 additions and 13488 deletions
18
.config/dotnet-tools.json
Normal file
18
.config/dotnet-tools.json
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
{
|
||||||
|
"version": 1,
|
||||||
|
"isRoot": true,
|
||||||
|
"tools": {
|
||||||
|
"gitversion.tool": {
|
||||||
|
"version": "5.9.0",
|
||||||
|
"commands": [
|
||||||
|
"dotnet-gitversion"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"dotnet-reportgenerator-globaltool": {
|
||||||
|
"version": "5.1.3",
|
||||||
|
"commands": [
|
||||||
|
"reportgenerator"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
198
.editorconfig
198
.editorconfig
|
@ -3,120 +3,120 @@
|
||||||
root = true
|
root = true
|
||||||
|
|
||||||
[*]
|
[*]
|
||||||
charset=utf-8
|
charset = utf-8
|
||||||
end_of_line = lf
|
end_of_line = lf
|
||||||
insert_final_newline=true
|
insert_final_newline = true
|
||||||
indent_style=space
|
indent_style = space
|
||||||
indent_size=4
|
indent_size = 4
|
||||||
|
|
||||||
# Microsoft .NET properties
|
# Microsoft .NET properties
|
||||||
csharp_new_line_before_members_in_object_initializers=false
|
csharp_new_line_before_members_in_object_initializers = false
|
||||||
csharp_preferred_modifier_order=public, private, protected, internal, new, abstract, virtual, sealed, override, static, readonly, extern, unsafe, volatile, async:suggestion
|
csharp_preferred_modifier_order = public, private, protected, internal, new, abstract, virtual, sealed, override, static, readonly, extern, unsafe, volatile, async:suggestion
|
||||||
csharp_space_after_cast=false
|
csharp_space_after_cast = false
|
||||||
csharp_style_var_elsewhere=false:hint
|
csharp_style_var_elsewhere = false:hint
|
||||||
csharp_style_var_for_built_in_types=false:hint
|
csharp_style_var_for_built_in_types = false:hint
|
||||||
csharp_style_var_when_type_is_apparent=true:hint
|
csharp_style_var_when_type_is_apparent = true:hint
|
||||||
csharp_preserve_single_line_statements=false
|
csharp_preserve_single_line_statements = false
|
||||||
csharp_preserve_single_line_blocks=true
|
csharp_preserve_single_line_blocks = true
|
||||||
dotnet_style_predefined_type_for_locals_parameters_members=true:hint
|
dotnet_style_predefined_type_for_locals_parameters_members = true:hint
|
||||||
dotnet_style_predefined_type_for_member_access=true:hint
|
dotnet_style_predefined_type_for_member_access = true:hint
|
||||||
dotnet_style_qualification_for_event=true:hint
|
dotnet_style_qualification_for_event = true:hint
|
||||||
dotnet_style_qualification_for_field=true:hint
|
dotnet_style_qualification_for_field = true:hint
|
||||||
dotnet_style_qualification_for_method=true:hint
|
dotnet_style_qualification_for_method = true:hint
|
||||||
dotnet_style_qualification_for_property=true:hint
|
dotnet_style_qualification_for_property = true:hint
|
||||||
dotnet_style_require_accessibility_modifiers=for_non_interface_members:hint
|
dotnet_style_require_accessibility_modifiers = for_non_interface_members:hint
|
||||||
|
|
||||||
# ReSharper properties
|
# ReSharper properties
|
||||||
resharper_alignment_tab_fill_style=optimal_fill
|
resharper_alignment_tab_fill_style = optimal_fill
|
||||||
resharper_apply_on_completion=true
|
resharper_apply_on_completion = true
|
||||||
resharper_blank_lines_after_control_transfer_statements=1
|
resharper_blank_lines_after_control_transfer_statements = 1
|
||||||
resharper_blank_lines_around_single_line_auto_property=1
|
resharper_blank_lines_around_single_line_auto_property = 1
|
||||||
resharper_blank_lines_around_single_line_property=1
|
resharper_blank_lines_around_single_line_property = 1
|
||||||
resharper_blank_lines_before_single_line_comment=1
|
resharper_blank_lines_before_single_line_comment = 1
|
||||||
resharper_blank_lines_between_using_groups=1
|
resharper_blank_lines_between_using_groups = 1
|
||||||
resharper_braces_for_for=required
|
resharper_braces_for_for = required
|
||||||
resharper_braces_for_foreach=required
|
resharper_braces_for_foreach = required
|
||||||
resharper_braces_for_ifelse=required
|
resharper_braces_for_ifelse = required
|
||||||
resharper_braces_for_while=required
|
resharper_braces_for_while = required
|
||||||
resharper_can_use_global_alias=false
|
resharper_can_use_global_alias = false
|
||||||
resharper_csharp_blank_lines_around_single_line_field=1
|
resharper_csharp_blank_lines_around_single_line_field = 1
|
||||||
resharper_csharp_blank_lines_around_single_line_invocable=1
|
resharper_csharp_blank_lines_around_single_line_invocable = 1
|
||||||
resharper_csharp_indent_style=tab
|
resharper_csharp_indent_style = tab
|
||||||
resharper_csharp_insert_final_newline=true
|
resharper_csharp_insert_final_newline = true
|
||||||
resharper_csharp_keep_blank_lines_in_code=1
|
resharper_csharp_keep_blank_lines_in_code = 1
|
||||||
resharper_csharp_keep_blank_lines_in_declarations=1
|
resharper_csharp_keep_blank_lines_in_declarations = 1
|
||||||
resharper_csharp_new_line_before_while=true
|
resharper_csharp_new_line_before_while = true
|
||||||
resharper_csharp_use_indent_from_vs=false
|
resharper_csharp_use_indent_from_vs = false
|
||||||
resharper_csharp_wrap_arguments_style=chop_if_long
|
resharper_csharp_wrap_arguments_style = chop_if_long
|
||||||
resharper_csharp_wrap_extends_list_style=chop_if_long
|
resharper_csharp_wrap_extends_list_style = chop_if_long
|
||||||
resharper_csharp_wrap_parameters_style=chop_if_long
|
resharper_csharp_wrap_parameters_style = chop_if_long
|
||||||
resharper_css_insert_final_newline=false
|
resharper_css_insert_final_newline = false
|
||||||
resharper_enforce_line_ending_style=true
|
resharper_enforce_line_ending_style = true
|
||||||
resharper_html_insert_final_newline=false
|
resharper_html_insert_final_newline = false
|
||||||
resharper_indent_nested_fixed_stmt=true
|
resharper_indent_nested_fixed_stmt = true
|
||||||
resharper_js_indent_style=tab
|
resharper_js_indent_style = tab
|
||||||
resharper_js_insert_final_newline=true
|
resharper_js_insert_final_newline = true
|
||||||
resharper_js_keep_blank_lines_in_code=1
|
resharper_js_keep_blank_lines_in_code = 1
|
||||||
resharper_js_stick_comment=false
|
resharper_js_stick_comment = false
|
||||||
resharper_js_use_indent_from_vs=false
|
resharper_js_use_indent_from_vs = false
|
||||||
resharper_js_wrap_before_binary_opsign=true
|
resharper_js_wrap_before_binary_opsign = true
|
||||||
resharper_js_wrap_chained_method_calls=chop_if_long
|
resharper_js_wrap_chained_method_calls = chop_if_long
|
||||||
resharper_keep_blank_lines_between_declarations=1
|
resharper_keep_blank_lines_between_declarations = 1
|
||||||
resharper_min_blank_lines_after_imports=1
|
resharper_min_blank_lines_after_imports = 1
|
||||||
resharper_place_attribute_on_same_line=False
|
resharper_place_attribute_on_same_line = False
|
||||||
resharper_place_constructor_initializer_on_same_line=false
|
resharper_place_constructor_initializer_on_same_line = false
|
||||||
resharper_place_type_constraints_on_same_line=false
|
resharper_place_type_constraints_on_same_line = false
|
||||||
resharper_protobuf_insert_final_newline=false
|
resharper_protobuf_insert_final_newline = false
|
||||||
resharper_qualified_using_at_nested_scope=true
|
resharper_qualified_using_at_nested_scope = true
|
||||||
resharper_resx_insert_final_newline=false
|
resharper_resx_insert_final_newline = false
|
||||||
resharper_space_within_single_line_array_initializer_braces=true
|
resharper_space_within_single_line_array_initializer_braces = true
|
||||||
resharper_use_indents_from_main_language_in_file=false
|
resharper_use_indents_from_main_language_in_file = false
|
||||||
resharper_vb_insert_final_newline=false
|
resharper_vb_insert_final_newline = false
|
||||||
resharper_wrap_after_declaration_lpar=true
|
resharper_wrap_after_declaration_lpar = true
|
||||||
resharper_wrap_after_invocation_lpar=true
|
resharper_wrap_after_invocation_lpar = true
|
||||||
resharper_wrap_before_extends_colon=true
|
resharper_wrap_before_extends_colon = true
|
||||||
resharper_wrap_before_first_type_parameter_constraint=true
|
resharper_wrap_before_first_type_parameter_constraint = true
|
||||||
resharper_wrap_before_type_parameter_langle=true
|
resharper_wrap_before_type_parameter_langle = true
|
||||||
resharper_xmldoc_indent_child_elements=ZeroIndent
|
resharper_xmldoc_indent_child_elements = ZeroIndent
|
||||||
resharper_xmldoc_indent_text=ZeroIndent
|
resharper_xmldoc_indent_text = ZeroIndent
|
||||||
resharper_xmldoc_insert_final_newline=false
|
resharper_xmldoc_insert_final_newline = false
|
||||||
resharper_xml_insert_final_newline=false
|
resharper_xml_insert_final_newline = false
|
||||||
|
|
||||||
# ReSharper inspection severities
|
# ReSharper inspection severities
|
||||||
resharper_check_namespace_highlighting=none
|
resharper_check_namespace_highlighting = none
|
||||||
resharper_convert_to_auto_property_highlighting=none
|
resharper_convert_to_auto_property_highlighting = none
|
||||||
resharper_localizable_element_highlighting=none
|
resharper_localizable_element_highlighting = none
|
||||||
resharper_redundant_comma_in_attribute_list_highlighting=none
|
resharper_redundant_comma_in_attribute_list_highlighting = none
|
||||||
resharper_redundant_comma_in_enum_declaration_highlighting=none
|
resharper_redundant_comma_in_enum_declaration_highlighting = none
|
||||||
resharper_redundant_comma_in_initializer_highlighting=none
|
resharper_redundant_comma_in_initializer_highlighting = none
|
||||||
resharper_string_compare_to_is_culture_specific_highlighting=none
|
resharper_string_compare_to_is_culture_specific_highlighting = none
|
||||||
resharper_string_index_of_is_culture_specific_1_highlighting=none
|
resharper_string_index_of_is_culture_specific_1_highlighting = none
|
||||||
resharper_use_null_propagation_highlighting=none
|
resharper_use_null_propagation_highlighting = none
|
||||||
resharper_use_object_or_collection_initializer_highlighting=hint
|
resharper_use_object_or_collection_initializer_highlighting = hint
|
||||||
resharper_use_string_interpolation_highlighting=hint
|
resharper_use_string_interpolation_highlighting = hint
|
||||||
|
|
||||||
# Matches the exact files either package.json or .travis.yml
|
# Matches the exact files either package.json or .travis.yml
|
||||||
[{package.json,.travis.yml}]
|
[{package.json,.travis.yml}]
|
||||||
indent_style=space
|
indent_style = space
|
||||||
indent_size=2
|
indent_size = 2
|
||||||
tab_width=2
|
tab_width = 2
|
||||||
|
|
||||||
[*.{cs,js,json,jsx,proto,resjson,ts,tsx}]
|
[*.{cs,js,json,jsx,proto,resjson,ts,tsx}]
|
||||||
indent_style=space
|
indent_style = space
|
||||||
indent_size=space
|
indent_size = 4
|
||||||
tab_width=4
|
tab_width = 4
|
||||||
|
|
||||||
[*.{asax,ascx,aspx,cshtml,css,htm,html,master,razor,skin,vb,xaml,xamlx,xoml}]
|
[*.{asax,ascx,aspx,cshtml,css,htm,html,master,razor,skin,vb,xaml,xamlx,xoml}]
|
||||||
indent_style=space
|
indent_style = space
|
||||||
indent_size=4
|
indent_size = 4
|
||||||
tab_width=4
|
tab_width = 4
|
||||||
|
|
||||||
[*.{appxmanifest,build,config,csproj,dbml,discomap,dtd,jsproj,lsproj,njsproj,nuspec,proj,props,resw,resx,StyleCop,targets,tasks,vbproj,xml,xsd}]
|
[*.{appxmanifest,build,config,csproj,dbml,discomap,dtd,jsproj,lsproj,njsproj,nuspec,proj,props,resw,resx,StyleCop,targets,tasks,vbproj,xml,xsd}]
|
||||||
indent_style=space
|
indent_style = space
|
||||||
indent_size=2
|
indent_size = 2
|
||||||
tab_width=2
|
tab_width = 2
|
||||||
|
|
||||||
[*.proto]
|
[*.proto]
|
||||||
indent_style=space
|
indent_style = space
|
||||||
indent_size=2
|
indent_size = 2
|
||||||
tab_width=2
|
tab_width = 2
|
||||||
|
|
3
.envrc
3
.envrc
|
@ -1 +1,2 @@
|
||||||
use flake
|
export PATH=$PWD/scripts:$PATH
|
||||||
|
use flake || use nix
|
||||||
|
|
11
.gitignore
vendored
11
.gitignore
vendored
|
@ -11,4 +11,15 @@ obj/
|
||||||
.idea/
|
.idea/
|
||||||
_ReSharper.Caches/
|
_ReSharper.Caches/
|
||||||
node_modules/
|
node_modules/
|
||||||
|
|
||||||
|
# NixOS
|
||||||
.direnv/
|
.direnv/
|
||||||
|
|
||||||
|
# Tests and Coverage
|
||||||
|
coverage
|
||||||
|
TestResults/
|
||||||
|
tests/artifacts/
|
||||||
|
|
||||||
|
# Lefthook
|
||||||
|
.lefthook-local/
|
||||||
|
lefthook-local.yml
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
npm install --ci
|
|
||||||
npx commitlint-gitlab-ci -x @commitlint/config-conventional
|
|
||||||
npm run build
|
|
|
@ -1,41 +0,0 @@
|
||||||
include:
|
|
||||||
- template: Security/SAST.gitlab-ci.yml
|
|
||||||
|
|
||||||
stages:
|
|
||||||
- build
|
|
||||||
- test
|
|
||||||
- release
|
|
||||||
|
|
||||||
default:
|
|
||||||
image: registry.gitlab.com/dmoonfire/nix-flake-docker:latest
|
|
||||||
|
|
||||||
build:
|
|
||||||
stage: build
|
|
||||||
script:
|
|
||||||
- nix develop --command .gitlab/build.sh
|
|
||||||
rules:
|
|
||||||
- if: $CI_COMMIT_BRANCH
|
|
||||||
|
|
||||||
test:
|
|
||||||
stage: test
|
|
||||||
script:
|
|
||||||
- nix develop --command .gitlab/test.sh
|
|
||||||
artifacts:
|
|
||||||
when: always
|
|
||||||
paths:
|
|
||||||
- ./**/*test-result.xml
|
|
||||||
- ./coverage/Cobertura.xml
|
|
||||||
- ./coverage/Summary.*
|
|
||||||
- ./**/*.nupkg
|
|
||||||
reports:
|
|
||||||
junit:
|
|
||||||
- ./**/*test-result.xml
|
|
||||||
cobertura:
|
|
||||||
- ./coverage/Cobertura.xml
|
|
||||||
|
|
||||||
publish:
|
|
||||||
stage: release
|
|
||||||
script:
|
|
||||||
- nix develop --command .gitlab/release.sh
|
|
||||||
rules:
|
|
||||||
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
|
|
@ -1,3 +0,0 @@
|
||||||
npm install --ci
|
|
||||||
npm run build
|
|
||||||
npx semantic-release
|
|
|
@ -1,7 +0,0 @@
|
||||||
#dotnet test --test-adapter-path:. --logger:"junit;LogFilePath=../artifacts/{assembly}-test-result.xml;MethodFormat=Default;FailureBodyFormat=Verbose" --collect:"XPlat Code Coverage"
|
|
||||||
#dotnet new tool-manifest
|
|
||||||
#dotnet tool install dotnet-reportgenerator-globaltool
|
|
||||||
#dotnet tool run reportgenerator -reports:tests/*/TestResults/*/coverage.cobertura.xml -targetdir:./coverage "-reporttypes:Cobertura;TextSummary"
|
|
||||||
#grep "Line coverage" coverage/Summary.txt
|
|
||||||
|
|
||||||
echo "Line coverage 0.00%"
|
|
|
@ -1,4 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
. "$(dirname "$0")/_/husky.sh"
|
|
||||||
|
|
||||||
npx --no-install commitlint --edit $1
|
|
8
.prettierignore
Normal file
8
.prettierignore
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
*~
|
||||||
|
flake.*
|
||||||
|
|
||||||
|
node_modules/
|
||||||
|
.direnv/
|
||||||
|
.config/
|
||||||
|
obj/
|
||||||
|
bin/
|
36
.woodpecker.yml
Normal file
36
.woodpecker.yml
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
clone:
|
||||||
|
git:
|
||||||
|
image: woodpeckerci/plugin-git
|
||||||
|
settings:
|
||||||
|
tags: true
|
||||||
|
|
||||||
|
pipeline:
|
||||||
|
build:
|
||||||
|
image: registry.gitlab.com/dmoonfire/nix-flake-docker:latest
|
||||||
|
commands:
|
||||||
|
- nix develop --command scripts/build.sh
|
||||||
|
when:
|
||||||
|
event: [push, pull_request, tag]
|
||||||
|
tag: v*
|
||||||
|
|
||||||
|
test:
|
||||||
|
image: registry.gitlab.com/dmoonfire/nix-flake-docker:latest
|
||||||
|
commands:
|
||||||
|
- nix develop --command scripts/test.sh
|
||||||
|
when:
|
||||||
|
event: [push, pull_request]
|
||||||
|
#paths:
|
||||||
|
# - ./**/*test-result.xml
|
||||||
|
# - ./coverage/Cobertura.xml
|
||||||
|
# - ./coverage/Summary.*
|
||||||
|
# - ./**/*.nupkg
|
||||||
|
|
||||||
|
release-main:
|
||||||
|
image: registry.gitlab.com/dmoonfire/nix-flake-docker:latest
|
||||||
|
commands:
|
||||||
|
- nix develop --command scripts/release.sh
|
||||||
|
secrets:
|
||||||
|
- gitea_token
|
||||||
|
when:
|
||||||
|
event: push
|
||||||
|
branch: main
|
62
CHANGELOG.md
62
CHANGELOG.md
|
@ -1,62 +0,0 @@
|
||||||
# [1.2.0](https://gitlab.com/mfgames-cil/mfgames-io-cil/compare/v1.1.0...v1.2.0) (2021-12-07)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* protect against non-existent directories while finding ([2b562e8](https://gitlab.com/mfgames-cil/mfgames-io-cil/commit/2b562e8c34a9de41cf6aceaf4d162ef978e6b6ef))
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* added assembly.GetDirectory() ([53aacbf](https://gitlab.com/mfgames-cil/mfgames-io-cil/commit/53aacbf862696f0057371883d936575928896323))
|
|
||||||
|
|
||||||
# [1.1.0](https://gitlab.com/mfgames-cil/mfgames-io-cil/compare/v1.0.5...v1.1.0) (2021-12-07)
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* added more extension methods, updated documentation ([cca890b](https://gitlab.com/mfgames-cil/mfgames-io-cil/commit/cca890b061743f1c9192b40aa81beaddbcdb2e6f))
|
|
||||||
|
|
||||||
## [1.0.5](https://gitlab.com/mfgames-cil/mfgames-io-cil/compare/v1.0.4...v1.0.5) (2021-09-11)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* **nuget:** fixing packaging and versioning ([29fd621](https://gitlab.com/mfgames-cil/mfgames-io-cil/commit/29fd621de05ec5390d70d7858396a99012c3748d))
|
|
||||||
* **nuget:** fixing packaging and versioning ([24faa43](https://gitlab.com/mfgames-cil/mfgames-io-cil/commit/24faa43abe18e4cd28ff4faf41110772648b61b6))
|
|
||||||
* **nuget:** fixing packaging and versioning ([4eca768](https://gitlab.com/mfgames-cil/mfgames-io-cil/commit/4eca7682a3c3165a4f25cffcae64761d04a7b67d))
|
|
||||||
|
|
||||||
## [1.0.4](https://gitlab.com/mfgames-cil/mfgames-io-cil/compare/v1.0.3...v1.0.4) (2021-09-11)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* moving directory props in the same place ([7d55de8](https://gitlab.com/mfgames-cil/mfgames-io-cil/commit/7d55de864cccd88d53451b1c6adb5252a0ca3b72))
|
|
||||||
|
|
||||||
## [1.0.3](https://gitlab.com/mfgames-cil/mfgames-io-cil/compare/v1.0.2...v1.0.3) (2021-09-11)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* **semantic-release-nuget:** correcting package version race condition ([f3966a7](https://gitlab.com/mfgames-cil/mfgames-io-cil/commit/f3966a73781ee1d92a179ca80760515dbbc4bc86))
|
|
||||||
|
|
||||||
## [1.0.2](https://gitlab.com/mfgames-cil/mfgames-io-cil/compare/v1.0.1...v1.0.2) (2021-09-11)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* updating readme to trigger build ([dade5a7](https://gitlab.com/mfgames-cil/mfgames-io-cil/commit/dade5a7f9030027af23b2935a8e17bbe6d99cdcb))
|
|
||||||
|
|
||||||
## [1.0.1](https://gitlab.com/mfgames-cil/mfgames-io-cil/compare/v1.0.0...v1.0.1) (2021-09-11)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* updating NuGet description ([2aa87a9](https://gitlab.com/mfgames-cil/mfgames-io-cil/commit/2aa87a9115a8baa916e3cc458fc0a8912967b988))
|
|
||||||
|
|
||||||
# 1.0.0 (2021-09-11)
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* initial commit ([5adb9cc](https://gitlab.com/mfgames-cil/mfgames-io-cil/commit/5adb9ccc52fd75fbd6a7859e1ce221d0d3b9bae7))
|
|
132
CODE-OF-CONDUCT.md
Normal file
132
CODE-OF-CONDUCT.md
Normal file
|
@ -0,0 +1,132 @@
|
||||||
|
# Contributor Covenant Code of Conduct
|
||||||
|
|
||||||
|
## Our Pledge
|
||||||
|
|
||||||
|
We as members, contributors, and leaders pledge to make participation in our
|
||||||
|
community a harassment-free experience for everyone, regardless of age, body
|
||||||
|
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
||||||
|
identity and expression, level of experience, education, socio-economic status,
|
||||||
|
nationality, personal appearance, race, caste, color, religion, or sexual
|
||||||
|
identity and orientation.
|
||||||
|
|
||||||
|
We pledge to act and interact in ways that contribute to an open, welcoming,
|
||||||
|
diverse, inclusive, and healthy community.
|
||||||
|
|
||||||
|
## Our Standards
|
||||||
|
|
||||||
|
Examples of behavior that contributes to a positive environment for our
|
||||||
|
community include:
|
||||||
|
|
||||||
|
- Demonstrating empathy and kindness toward other people
|
||||||
|
- Being respectful of differing opinions, viewpoints, and experiences
|
||||||
|
- Giving and gracefully accepting constructive feedback
|
||||||
|
- Accepting responsibility and apologizing to those affected by our mistakes,
|
||||||
|
and learning from the experience
|
||||||
|
- Focusing on what is best not just for us as individuals, but for the overall
|
||||||
|
community
|
||||||
|
|
||||||
|
Examples of unacceptable behavior include:
|
||||||
|
|
||||||
|
- The use of sexualized language or imagery, and sexual attention or advances of
|
||||||
|
any kind
|
||||||
|
- Trolling, insulting or derogatory comments, and personal or political attacks
|
||||||
|
- Public or private harassment
|
||||||
|
- Publishing others' private information, such as a physical or email address,
|
||||||
|
without their explicit permission
|
||||||
|
- Other conduct which could reasonably be considered inappropriate in a
|
||||||
|
professional setting
|
||||||
|
|
||||||
|
## Enforcement Responsibilities
|
||||||
|
|
||||||
|
Community leaders are responsible for clarifying and enforcing our standards of
|
||||||
|
acceptable behavior and will take appropriate and fair corrective action in
|
||||||
|
response to any behavior that they deem inappropriate, threatening, offensive,
|
||||||
|
or harmful.
|
||||||
|
|
||||||
|
Community leaders have the right and responsibility to remove, edit, or reject
|
||||||
|
comments, commits, code, wiki edits, issues, and other contributions that are
|
||||||
|
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
||||||
|
decisions when appropriate.
|
||||||
|
|
||||||
|
## Scope
|
||||||
|
|
||||||
|
This Code of Conduct applies within all community spaces, and also applies when
|
||||||
|
an individual is officially representing the community in public spaces.
|
||||||
|
Examples of representing our community include using an official e-mail address,
|
||||||
|
posting via an official social media account, or acting as an appointed
|
||||||
|
representative at an online or offline event.
|
||||||
|
|
||||||
|
## Enforcement
|
||||||
|
|
||||||
|
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||||
|
reported to the community leaders responsible for enforcement at
|
||||||
|
[INSERT CONTACT METHOD].
|
||||||
|
All complaints will be reviewed and investigated promptly and fairly.
|
||||||
|
|
||||||
|
All community leaders are obligated to respect the privacy and security of the
|
||||||
|
reporter of any incident.
|
||||||
|
|
||||||
|
## Enforcement Guidelines
|
||||||
|
|
||||||
|
Community leaders will follow these Community Impact Guidelines in determining
|
||||||
|
the consequences for any action they deem in violation of this Code of Conduct:
|
||||||
|
|
||||||
|
### 1. Correction
|
||||||
|
|
||||||
|
**Community Impact**: Use of inappropriate language or other behavior deemed
|
||||||
|
unprofessional or unwelcome in the community.
|
||||||
|
|
||||||
|
**Consequence**: A private, written warning from community leaders, providing
|
||||||
|
clarity around the nature of the violation and an explanation of why the
|
||||||
|
behavior was inappropriate. A public apology may be requested.
|
||||||
|
|
||||||
|
### 2. Warning
|
||||||
|
|
||||||
|
**Community Impact**: A violation through a single incident or series of
|
||||||
|
actions.
|
||||||
|
|
||||||
|
**Consequence**: A warning with consequences for continued behavior. No
|
||||||
|
interaction with the people involved, including unsolicited interaction with
|
||||||
|
those enforcing the Code of Conduct, for a specified period of time. This
|
||||||
|
includes avoiding interactions in community spaces as well as external channels
|
||||||
|
like social media. Violating these terms may lead to a temporary or permanent
|
||||||
|
ban.
|
||||||
|
|
||||||
|
### 3. Temporary Ban
|
||||||
|
|
||||||
|
**Community Impact**: A serious violation of community standards, including
|
||||||
|
sustained inappropriate behavior.
|
||||||
|
|
||||||
|
**Consequence**: A temporary ban from any sort of interaction or public
|
||||||
|
communication with the community for a specified period of time. No public or
|
||||||
|
private interaction with the people involved, including unsolicited interaction
|
||||||
|
with those enforcing the Code of Conduct, is allowed during this period.
|
||||||
|
Violating these terms may lead to a permanent ban.
|
||||||
|
|
||||||
|
### 4. Permanent Ban
|
||||||
|
|
||||||
|
**Community Impact**: Demonstrating a pattern of violation of community
|
||||||
|
standards, including sustained inappropriate behavior, harassment of an
|
||||||
|
individual, or aggression toward or disparagement of classes of individuals.
|
||||||
|
|
||||||
|
**Consequence**: A permanent ban from any sort of public interaction within the
|
||||||
|
community.
|
||||||
|
|
||||||
|
## Attribution
|
||||||
|
|
||||||
|
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
||||||
|
version 2.1, available at
|
||||||
|
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
|
||||||
|
|
||||||
|
Community Impact Guidelines were inspired by
|
||||||
|
[Mozilla's code of conduct enforcement ladder][mozilla coc].
|
||||||
|
|
||||||
|
For answers to common questions about this code of conduct, see the FAQ at
|
||||||
|
[https://www.contributor-covenant.org/faq][faq]. Translations are available at
|
||||||
|
[https://www.contributor-covenant.org/translations][translations].
|
||||||
|
|
||||||
|
[homepage]: https://www.contributor-covenant.org
|
||||||
|
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
|
||||||
|
[mozilla coc]: https://github.com/mozilla/diversity
|
||||||
|
[faq]: https://www.contributor-covenant.org/faq
|
||||||
|
[translations]: https://www.contributor-covenant.org/translations
|
|
@ -7,6 +7,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{1C957FCA-B9A
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MfGames.IO", "src\MfGames.IO\MfGames.IO.csproj", "{D4386FAC-E9E0-4FBF-9423-5F3699F19920}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MfGames.IO", "src\MfGames.IO\MfGames.IO.csproj", "{D4386FAC-E9E0-4FBF-9423-5F3699F19920}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{6F7CE793-DD94-4AD7-B3CB-94ECF2BA77A6}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MfGames.IO.Tests", "tests\MfGames.IO.Tests\MfGames.IO.Tests.csproj", "{4E3B0E55-A1A0-4007-8CF2-C02396FBBB22}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
@ -32,8 +36,21 @@ Global
|
||||||
{D4386FAC-E9E0-4FBF-9423-5F3699F19920}.Release|x64.Build.0 = Release|Any CPU
|
{D4386FAC-E9E0-4FBF-9423-5F3699F19920}.Release|x64.Build.0 = Release|Any CPU
|
||||||
{D4386FAC-E9E0-4FBF-9423-5F3699F19920}.Release|x86.ActiveCfg = Release|Any CPU
|
{D4386FAC-E9E0-4FBF-9423-5F3699F19920}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
{D4386FAC-E9E0-4FBF-9423-5F3699F19920}.Release|x86.Build.0 = Release|Any CPU
|
{D4386FAC-E9E0-4FBF-9423-5F3699F19920}.Release|x86.Build.0 = Release|Any CPU
|
||||||
|
{4E3B0E55-A1A0-4007-8CF2-C02396FBBB22}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{4E3B0E55-A1A0-4007-8CF2-C02396FBBB22}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{4E3B0E55-A1A0-4007-8CF2-C02396FBBB22}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||||
|
{4E3B0E55-A1A0-4007-8CF2-C02396FBBB22}.Debug|x64.Build.0 = Debug|Any CPU
|
||||||
|
{4E3B0E55-A1A0-4007-8CF2-C02396FBBB22}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||||
|
{4E3B0E55-A1A0-4007-8CF2-C02396FBBB22}.Debug|x86.Build.0 = Debug|Any CPU
|
||||||
|
{4E3B0E55-A1A0-4007-8CF2-C02396FBBB22}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{4E3B0E55-A1A0-4007-8CF2-C02396FBBB22}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{4E3B0E55-A1A0-4007-8CF2-C02396FBBB22}.Release|x64.ActiveCfg = Release|Any CPU
|
||||||
|
{4E3B0E55-A1A0-4007-8CF2-C02396FBBB22}.Release|x64.Build.0 = Release|Any CPU
|
||||||
|
{4E3B0E55-A1A0-4007-8CF2-C02396FBBB22}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
|
{4E3B0E55-A1A0-4007-8CF2-C02396FBBB22}.Release|x86.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(NestedProjects) = preSolution
|
GlobalSection(NestedProjects) = preSolution
|
||||||
{D4386FAC-E9E0-4FBF-9423-5F3699F19920} = {1C957FCA-B9AA-4A64-BF20-E215EAE5C4E4}
|
{D4386FAC-E9E0-4FBF-9423-5F3699F19920} = {1C957FCA-B9AA-4A64-BF20-E215EAE5C4E4}
|
||||||
|
{4E3B0E55-A1A0-4007-8CF2-C02396FBBB22} = {6F7CE793-DD94-4AD7-B3CB-94ECF2BA77A6}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
|
16
NuGet.Config
Normal file
16
NuGet.Config
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<configuration>
|
||||||
|
<packageSources>
|
||||||
|
<clear />
|
||||||
|
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
|
||||||
|
<add key="mfgames.com" value="https://src.mfgames.com/api/packages/mfgames-cil/nuget/index.json" protocolVersion="3" />
|
||||||
|
</packageSources>
|
||||||
|
<packageSourceMapping>
|
||||||
|
<packageSource key="nuget.org">
|
||||||
|
<package pattern="*" />
|
||||||
|
</packageSource>
|
||||||
|
<packageSource key="mfgames.com">
|
||||||
|
<package pattern="MfGames.*" />
|
||||||
|
</packageSource>
|
||||||
|
</packageSourceMapping>
|
||||||
|
</configuration>
|
19
README.md
19
README.md
|
@ -1,5 +1,4 @@
|
||||||
MfGames.IO CIL
|
# MfGames.IO CIL
|
||||||
==============
|
|
||||||
|
|
||||||
This a small collection of classes and extensions to make working with System.IO a little bit easier.
|
This a small collection of classes and extensions to make working with System.IO a little bit easier.
|
||||||
|
|
||||||
|
@ -30,7 +29,11 @@ The repository can also be added to a project by setting the `NuGet.Config` file
|
||||||
|
|
||||||
#### `DirectoryInfo? GetDirectory(this Assembly? assembly)`
|
#### `DirectoryInfo? GetDirectory(this Assembly? assembly)`
|
||||||
|
|
||||||
Gets a directory representing the assembly's `Location` property or null.
|
Gets a directory containing the assembly directory.
|
||||||
|
|
||||||
|
#### `FileInfo? GetFile(this Assembly? assembly)`
|
||||||
|
|
||||||
|
Gets a file representing the assembly's `Location` property or null.
|
||||||
|
|
||||||
### DirectoryInfo Extensions
|
### DirectoryInfo Extensions
|
||||||
|
|
||||||
|
@ -86,3 +89,13 @@ The same as `File.WriteAllText(file.GetFullPath, text)`.
|
||||||
#### `void WriteAllText(this FileInfo file, string text, Encoding encoding)`
|
#### `void WriteAllText(this FileInfo file, string text, Encoding encoding)`
|
||||||
|
|
||||||
The same as `File.WriteAllText(file.GetFullPath, text, encoding)`.
|
The same as `File.WriteAllText(file.GetFullPath, text, encoding)`.
|
||||||
|
|
||||||
|
### Type Extensions
|
||||||
|
|
||||||
|
#### `DirectoryInfo? GetDirectory(this Type? type)`
|
||||||
|
|
||||||
|
Gets a directory containing the type's assembly directory.
|
||||||
|
|
||||||
|
#### `FileInfo? GetFile(this Type? type)`
|
||||||
|
|
||||||
|
Gets a file representing the type's assembly's `Location` property or null.
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
module.exports = {
|
|
||||||
extends: ["@commitlint/config-conventional"],
|
|
||||||
rules: {
|
|
||||||
"body-max-line-length": [0],
|
|
||||||
},
|
|
||||||
};
|
|
12
flake.lock
12
flake.lock
|
@ -2,11 +2,11 @@
|
||||||
"nodes": {
|
"nodes": {
|
||||||
"flake-utils": {
|
"flake-utils": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1638122382,
|
"lastModified": 1659877975,
|
||||||
"narHash": "sha256-sQzZzAbvKEqN9s0bzWuYmRaA03v40gaJ4+iL1LXjaeI=",
|
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
|
||||||
"owner": "numtide",
|
"owner": "numtide",
|
||||||
"repo": "flake-utils",
|
"repo": "flake-utils",
|
||||||
"rev": "74f7e4319258e287b0f9cb95426c9853b282730b",
|
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -17,11 +17,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1638198142,
|
"lastModified": 1662019588,
|
||||||
"narHash": "sha256-plU9b8r4St6q4U7VHtG9V7oF8k9fIpfXl/KDaZLuY9k=",
|
"narHash": "sha256-oPEjHKGGVbBXqwwL+UjsveJzghWiWV0n9ogo1X6l4cw=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "8a308775674e178495767df90c419425474582a1",
|
"rev": "2da64a81275b68fdad38af669afeda43d401e94b",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
11
flake.nix
11
flake.nix
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
description = "A .NET core library for building tools";
|
description = "A .NET core library for easily building CLI tools";
|
||||||
|
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "nixpkgs/nixos-unstable";
|
nixpkgs.url = "nixpkgs/nixos-unstable";
|
||||||
|
@ -11,7 +11,14 @@
|
||||||
let pkgs = nixpkgs.legacyPackages.${system};
|
let pkgs = nixpkgs.legacyPackages.${system};
|
||||||
in {
|
in {
|
||||||
devShell = pkgs.mkShell {
|
devShell = pkgs.mkShell {
|
||||||
buildInputs = [ pkgs.dotnet-sdk_5 pkgs.nodejs-16_x pkgs.nixfmt ];
|
buildInputs = [
|
||||||
|
pkgs.dotnet-sdk
|
||||||
|
pkgs.lefthook
|
||||||
|
pkgs.convco
|
||||||
|
pkgs.nodePackages.prettier
|
||||||
|
pkgs.nixfmt
|
||||||
|
pkgs.jq
|
||||||
|
];
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
22
lefthook.yml
Normal file
22
lefthook.yml
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
pre-commit:
|
||||||
|
parallel: true
|
||||||
|
commands:
|
||||||
|
dotnet-format:
|
||||||
|
glob: "*.cs"
|
||||||
|
run: dotnet format
|
||||||
|
prettier:
|
||||||
|
run: prettier . --write --loglevel warn
|
||||||
|
nixfmt:
|
||||||
|
run: nixfmt flake.nix
|
||||||
|
|
||||||
|
commit-msg:
|
||||||
|
commands:
|
||||||
|
commit-check:
|
||||||
|
run: convco check -n 1
|
||||||
|
|
||||||
|
skip_output:
|
||||||
|
- meta # Skips lefthook version printing
|
||||||
|
- summary # Skips summary block (successful and failed steps) printing
|
||||||
|
- success # Skips successful steps printing
|
||||||
|
- failure # Skips failed steps printing
|
||||||
|
- execution # Skips printing successfully executed commands and their output (but still prints failed executions)
|
13194
package-lock.json
generated
13194
package-lock.json
generated
File diff suppressed because it is too large
Load diff
23
package.json
23
package.json
|
@ -1,23 +0,0 @@
|
||||||
{
|
|
||||||
"name": "mfgames-io-cil",
|
|
||||||
"version": "1.2.0",
|
|
||||||
"private": true,
|
|
||||||
"scripts": {
|
|
||||||
"prepare": "husky install",
|
|
||||||
"build": "dotnet build",
|
|
||||||
"test": "dotnet test"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"@commitlint/cli": "^15.0.0",
|
|
||||||
"@commitlint/config-conventional": "^15.0.0",
|
|
||||||
"@semantic-release/changelog": "^6.0.1",
|
|
||||||
"@semantic-release/git": "^10.0.1",
|
|
||||||
"@semantic-release/gitlab": "^7.0.4",
|
|
||||||
"@semantic-release/npm": "^8.0.3",
|
|
||||||
"commitlint-gitlab-ci": "^0.0.4",
|
|
||||||
"husky": "^7.0.2",
|
|
||||||
"semantic-release": "^18.0.1",
|
|
||||||
"semantic-release-dotnet": "^1.0.0",
|
|
||||||
"semantic-release-nuget": "^1.1.1"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,26 +0,0 @@
|
||||||
module.exports = {
|
|
||||||
extends: ["@commitlint/config-conventional"],
|
|
||||||
branches: ["main"],
|
|
||||||
message: "chore(release): v${nextRelease.version} [skip ci]\n\n${nextRelease.notes}",
|
|
||||||
plugins: [
|
|
||||||
"@semantic-release/commit-analyzer",
|
|
||||||
"@semantic-release/release-notes-generator",
|
|
||||||
"@semantic-release/npm",
|
|
||||||
[
|
|
||||||
"semantic-release-dotnet",
|
|
||||||
{
|
|
||||||
paths: ["src/Directory.Build.props"],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"semantic-release-nuget",
|
|
||||||
{
|
|
||||||
packArguments: ["--include-symbols", "--include-source"],
|
|
||||||
pushFiles: ["src/*/bin/Debug/*.nupkg"],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
"@semantic-release/changelog",
|
|
||||||
"@semantic-release/git",
|
|
||||||
"@semantic-release/gitlab",
|
|
||||||
],
|
|
||||||
};
|
|
23
scripts/README.md
Normal file
23
scripts/README.md
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
# Scripts Directory
|
||||||
|
|
||||||
|
This directory contains the basic scripts for working with the library.
|
||||||
|
|
||||||
|
## `setup.sh`
|
||||||
|
|
||||||
|
This verifies the environment is correct and makes sure everything is configured.
|
||||||
|
|
||||||
|
## `build.sh`
|
||||||
|
|
||||||
|
This builds the project and creates the binaries in debug mode.
|
||||||
|
|
||||||
|
## `test.sh`
|
||||||
|
|
||||||
|
This runs any required tests.
|
||||||
|
|
||||||
|
## `format.sh`
|
||||||
|
|
||||||
|
This is used to format the code base using our standards. It matches the commands in the `lefthook` pre-commit hook.
|
||||||
|
|
||||||
|
## `release.sh`
|
||||||
|
|
||||||
|
Intended to run in a CI environment, this creates a NuGet package and publishes it.
|
7
scripts/build.sh
Executable file
7
scripts/build.sh
Executable file
|
@ -0,0 +1,7 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
cd $(dirname $0)/..
|
||||||
|
./scripts/setup.sh || exit 1
|
||||||
|
|
||||||
|
echo "$(basename $0): building project"
|
||||||
|
dotnet build
|
4
scripts/format.sh
Executable file
4
scripts/format.sh
Executable file
|
@ -0,0 +1,4 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
cd $(dirname $0)/..
|
||||||
|
lefthook run pre-commit
|
51
scripts/release.sh
Executable file
51
scripts/release.sh
Executable file
|
@ -0,0 +1,51 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
cd $(dirname $0)/..
|
||||||
|
./scripts/setup.sh || exit 1
|
||||||
|
|
||||||
|
# Verify the input.
|
||||||
|
if [ "x$GITEA_TOKEN" = "x" ]
|
||||||
|
then
|
||||||
|
echo "the environment variable GITEA_TOKEN is not defined"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Clean up everything from the previous runs.
|
||||||
|
echo "$(basename $0): cleaning project"
|
||||||
|
dotnet clean
|
||||||
|
|
||||||
|
# Version the file based on the Git repository.
|
||||||
|
echo "$(basename $0): setting project version"
|
||||||
|
(cd src && dotnet dotnet-gitversion /updateprojectfiles)
|
||||||
|
SEMVER="v$(dotnet gitversion /output json | jq -r .SemVer)"
|
||||||
|
|
||||||
|
if [ "x$SEMVER" = "x" ]
|
||||||
|
then
|
||||||
|
echo "$(basename $0): cannot figure out the semantic version"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Build to pick up the new version.
|
||||||
|
echo "$(basename $0): building project $SEMVER"
|
||||||
|
dotnet build || exit 1
|
||||||
|
|
||||||
|
# Create and publish the NuGet packages.
|
||||||
|
echo "$(basename $0): creating NuGet packages"
|
||||||
|
dotnet pack -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg || exit 1
|
||||||
|
|
||||||
|
echo "$(basename $0): publishing NuGet package"
|
||||||
|
dotnet nuget remove source mfgames.com >& /dev/null
|
||||||
|
dotnet nuget add source --name mfgames.com --username dmoonfire --password $GITEA_TOKEN https://src.mfgames.com/api/packages/mfgames-cil/nuget/index.json --store-password-in-clear-text || exit 1
|
||||||
|
dotnet nuget push --skip-duplicate --source mfgames.com src/*/bin/Debug/*.nupkg || exit 1
|
||||||
|
|
||||||
|
# Tag and push, but only if we don't have a tag.
|
||||||
|
if ! git tag | grep $SEMVER >& /dev/null
|
||||||
|
then
|
||||||
|
echo "$(basename $0): tagging and pushing"
|
||||||
|
git remote add publish https://dmoonfire:$GITEA_TOKEN@src.mfgames.com/mfgames-cil/$(basename $(git config --get remote.origin.url))
|
||||||
|
git tag $SEMVER
|
||||||
|
git push publish $SEMVER || exit 1
|
||||||
|
git remote remove publish
|
||||||
|
else
|
||||||
|
echo "$(basename $0): not tagging, already exists"
|
||||||
|
fi
|
28
scripts/setup.sh
Executable file
28
scripts/setup.sh
Executable file
|
@ -0,0 +1,28 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
# Normalize our environment.
|
||||||
|
cd $(dirname $0)/..
|
||||||
|
|
||||||
|
# Make sure we have the needed executables installed.
|
||||||
|
for e in dotnet lefthook prettier nixfmt
|
||||||
|
do
|
||||||
|
if ! which $e >& /dev/null
|
||||||
|
then
|
||||||
|
echo "Cannot find '$e' in the path"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# Make sure we have lefthook is installed.
|
||||||
|
if [ ! -f .git/hooks/pre-commit ]
|
||||||
|
then
|
||||||
|
echo "$(basename $0): installing lefthook"
|
||||||
|
lefthook install
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Make sure our tools are installed.
|
||||||
|
echo "$(basename $0): install .NET tools"
|
||||||
|
dotnet tool restore
|
||||||
|
|
||||||
|
# Everything is good.
|
||||||
|
exit 0
|
8
scripts/test.sh
Executable file
8
scripts/test.sh
Executable file
|
@ -0,0 +1,8 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
cd $(dirname $0)/..
|
||||||
|
./scripts/setup.sh || exit 1
|
||||||
|
|
||||||
|
dotnet test --test-adapter-path:. --logger:"junit;LogFilePath=../artifacts/{assembly}-test-result.xml;MethodFormat=Default;FailureBodyFormat=Verbose" --collect:"XPlat Code Coverage"
|
||||||
|
dotnet tool run reportgenerator -reports:tests/*/TestResults/*/coverage.cobertura.xml -targetdir:./coverage "-reporttypes:Cobertura;TextSummary"
|
||||||
|
grep "Line coverage" coverage/Summary.txt
|
4
scripts/update-template.sh
Executable file
4
scripts/update-template.sh
Executable file
|
@ -0,0 +1,4 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
cd $(dirname $0)/..
|
||||||
|
git pull template main --no-rebase
|
|
@ -5,10 +5,10 @@
|
||||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||||
<Authors>Dylan Moonfire</Authors>
|
<Authors>Dylan Moonfire</Authors>
|
||||||
<Company>Moonfire Games</Company>
|
<Company>Moonfire Games</Company>
|
||||||
<RepositoryUrl>https://gitlab.com/mfgames-cil/mfgames-io-cil</RepositoryUrl>
|
<RepositoryUrl>https://src.mfgames.com/mfgames-cil/mfgames-io-cil.git</RepositoryUrl>
|
||||||
<RepositoryType>Git</RepositoryType>
|
<RepositoryType>Git</RepositoryType>
|
||||||
<PackageTags>io</PackageTags>
|
<PackageTags>io</PackageTags>
|
||||||
<PackageProjectUrl>https://gitlab.com/mfgames-cil/mfgames-io-cil</PackageProjectUrl>
|
<PackageProjectUrl>https://src.mfgames.com/mfgames-cil/mfgames-io-cil</PackageProjectUrl>
|
||||||
<PackageLicense>MIT</PackageLicense>
|
<PackageLicense>MIT</PackageLicense>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
|
|
@ -14,10 +14,20 @@ namespace MfGames.IO.Extensions
|
||||||
/// <param name="assembly">The assembly to get the directory.</param>
|
/// <param name="assembly">The assembly to get the directory.</param>
|
||||||
/// <returns>The directory or null if the assembly or location is null.</returns>
|
/// <returns>The directory or null if the assembly or location is null.</returns>
|
||||||
public static DirectoryInfo? GetDirectory(this Assembly? assembly)
|
public static DirectoryInfo? GetDirectory(this Assembly? assembly)
|
||||||
|
{
|
||||||
|
return assembly.GetFile()?.Directory;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the file for a given assembly.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="assembly">The assembly to get the directory.</param>
|
||||||
|
/// <returns>The directory or null if the assembly or location is null.</returns>
|
||||||
|
public static FileInfo? GetFile(this Assembly? assembly)
|
||||||
{
|
{
|
||||||
return assembly?.Location == null
|
return assembly?.Location == null
|
||||||
? null
|
? null
|
||||||
: new DirectoryInfo(assembly.Location);
|
: new FileInfo(assembly.Location);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ namespace MfGames.IO.Extensions
|
||||||
directory.Parent.CreateIfMissing();
|
directory.Parent.CreateIfMissing();
|
||||||
|
|
||||||
// If the directory doesn't exist, create it.
|
// If the directory doesn't exist, create it.
|
||||||
if (!directory.Exists)
|
if (!Directory.Exists(directory.FullName))
|
||||||
{
|
{
|
||||||
directory.Create();
|
directory.Create();
|
||||||
}
|
}
|
||||||
|
@ -84,8 +84,9 @@ namespace MfGames.IO.Extensions
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the directory is null, just return null. Same with
|
// If the directory is null, just return null. Same with
|
||||||
// non-existing directories.
|
// non-existing directories. We don't use directory.Exists here
|
||||||
if (directory is not { Exists: true })
|
// because it seems to be cached and we get incorrect data.
|
||||||
|
if (directory == null || !Directory.Exists(directory.FullName))
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
31
src/MfGames.IO/Extensions/TypeExtensions.cs
Normal file
31
src/MfGames.IO/Extensions/TypeExtensions.cs
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
|
namespace MfGames.IO.Extensions
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Additional methods for types.
|
||||||
|
/// </summary>
|
||||||
|
public static class TypeExtensions
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the directory for a given type.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="type">The type assembly to get the directory.</param>
|
||||||
|
/// <returns>The directory or null if the assembly or location is null.</returns>
|
||||||
|
public static DirectoryInfo? GetDirectory(this Type? type)
|
||||||
|
{
|
||||||
|
return type?.Assembly.GetDirectory();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the file for a given type's assembly.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="type">The type assembly to get the directory.</param>
|
||||||
|
/// <returns>The directory or null if the assembly or location is null.</returns>
|
||||||
|
public static FileInfo? GetFile(this Type? type)
|
||||||
|
{
|
||||||
|
return type?.Assembly.GetFile();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<Description>A set of utilities and extension methods to make System.IO easier.</Description>
|
<Description>A set of utilities and extension methods to make System.IO easier.</Description>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
1
src/README.md
Normal file
1
src/README.md
Normal file
|
@ -0,0 +1 @@
|
||||||
|
# Source Directories
|
29
tests/MfGames.IO.Tests/AssemblyExtensionsTests.cs
Normal file
29
tests/MfGames.IO.Tests/AssemblyExtensionsTests.cs
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
|
using MfGames.IO.Extensions;
|
||||||
|
|
||||||
|
using Xunit;
|
||||||
|
|
||||||
|
namespace MfGames.IO.Tests
|
||||||
|
{
|
||||||
|
public class AssemblyExtensionsTests
|
||||||
|
{
|
||||||
|
[Fact]
|
||||||
|
public void DirectoryExists()
|
||||||
|
{
|
||||||
|
DirectoryInfo? dir = this.GetType().Assembly.GetDirectory();
|
||||||
|
|
||||||
|
Assert.NotNull(dir);
|
||||||
|
Assert.True(dir!.Exists);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void FileExists()
|
||||||
|
{
|
||||||
|
FileInfo? file = this.GetType().Assembly.GetFile();
|
||||||
|
|
||||||
|
Assert.NotNull(file);
|
||||||
|
Assert.True(file!.Exists);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
21
tests/MfGames.IO.Tests/GitRootTests.cs
Normal file
21
tests/MfGames.IO.Tests/GitRootTests.cs
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
|
using MfGames.IO.Extensions;
|
||||||
|
|
||||||
|
using Xunit;
|
||||||
|
|
||||||
|
namespace MfGames.IO.Tests
|
||||||
|
{
|
||||||
|
public class GitRootTests
|
||||||
|
{
|
||||||
|
[Fact]
|
||||||
|
public void FindGitRoot()
|
||||||
|
{
|
||||||
|
DirectoryInfo? dir = this.GetType().GetDirectory();
|
||||||
|
DirectoryInfo? git = dir.FindGitRoot();
|
||||||
|
|
||||||
|
Assert.NotNull(git);
|
||||||
|
Assert.True(git!.GetDirectories(".git").Length > 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
26
tests/MfGames.IO.Tests/MfGames.IO.Tests.csproj
Normal file
26
tests/MfGames.IO.Tests/MfGames.IO.Tests.csproj
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="JunitXml.TestLogger" Version="3.0.114" />
|
||||||
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.1" />
|
||||||
|
<PackageReference Include="xunit" Version="2.4.2" />
|
||||||
|
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="coverlet.collector" Version="3.1.2">
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
</PackageReference>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\src\MfGames.IO\MfGames.IO.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
1
tests/README.md
Normal file
1
tests/README.md
Normal file
|
@ -0,0 +1 @@
|
||||||
|
# Test Projects
|
Reference in a new issue