{"id":13629435,"url":"https://github.com/ignatandrei/RSCG_AMS","last_synced_at":"2025-04-17T09:33:54.471Z","repository":{"id":39801841,"uuid":"379692051","full_name":"ignatandrei/RSCG_AMS","owner":"ignatandrei","description":"a Roslyn Source Code Generator for About My Software","archived":false,"fork":false,"pushed_at":"2023-05-21T12:52:31.000Z","size":1561,"stargazers_count":4,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-04-27T07:40:53.778Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":" https://ignatandrei.github.io/RSCG_AMS/","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ignatandrei.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["ignatandrei"]}},"created_at":"2021-06-23T18:12:19.000Z","updated_at":"2024-06-14T01:32:27.709Z","dependencies_parsed_at":"2024-06-14T01:32:26.197Z","dependency_job_id":"eb8c2d48-aa63-4127-abce-58e4fe46874d","html_url":"https://github.com/ignatandrei/RSCG_AMS","commit_stats":{"total_commits":168,"total_committers":3,"mean_commits":56.0,"dds":"0.023809523809523836","last_synced_commit":"1ab3d6336455cb2e777d4600bc31d4067bd6507f"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ignatandrei%2FRSCG_AMS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ignatandrei%2FRSCG_AMS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ignatandrei%2FRSCG_AMS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ignatandrei%2FRSCG_AMS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ignatandrei","download_url":"https://codeload.github.com/ignatandrei/RSCG_AMS/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223751127,"owners_count":17196575,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T22:01:10.638Z","updated_at":"2024-11-08T20:30:57.349Z","avatar_url":"https://github.com/ignatandrei.png","language":"C#","funding_links":["https://github.com/sponsors/ignatandrei"],"categories":["Content"],"sub_categories":["10. [RSCG_AMS](https://ignatandrei.github.io/RSCG_Examples/v2/docs/RSCG_AMS) , in the [EnhancementProject](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#enhancementproject) category"],"readme":"# RSCG_AMS\na Roslyn Source Code Generator for About My Software\n\nYou will obtain\n\n![RSCG_AMS](https://ignatandrei.github.io/RSCG_AMS/result.png \"RSCG_AMS Generated\")\n\n( See online at https://netcoreblockly.herokuapp.com/ams )\n\n[![AMS_BASE](https://img.shields.io/nuget/v/AMS_Base?label=AMS_Base)](https://www.nuget.org/packages/AMS_Base/)\n[![RSCG_AMS](https://img.shields.io/nuget/v/RSCG_AMS?label=RSCG_AMS)](https://www.nuget.org/packages/RSCG_AMS/)\n[![AMSWebAPI](https://img.shields.io/nuget/v/AMSWebAPI?label=AMSWebAPI)](https://www.nuget.org/packages/AMSWebAPI/)\n \n\n[![BuildAndTest](https://github.com/ignatandrei/RSCG_AMS/actions/workflows/dotnet.yml/badge.svg)](https://github.com/ignatandrei/RSCG_AMS/actions/workflows/dotnet.yml)\n## How to use\n### For Console or DLL \n\nAdd to the csproj 2023.5.21.1551\n```xml \n\u003cItemGroup\u003e\n    \u003cPackageReference Include=\"AMS_Base\" Version=\"2023.5.21.1551\" /\u003e\n    \u003cPackageReference Include=\"RSCG_AMS\" Version=\"2023.5.21.1551\" ReferenceOutputAssembly=\"false\" OutputItemType=\"Analyzer\" /\u003e\n  \u003c/ItemGroup\u003e\n```\n\nAnd access like this:\n```csharp\n var amsAll = AboutMySoftware.AllDefinitions;\nforeach (var amsKV in amsAll)\n{\n    var ams = amsKV.Value;\n\n    Console.WriteLine($\"{amsKV.Key}.{nameof(ams.AssemblyName)} : {ams.AssemblyName}\");\n    Console.WriteLine($\"{amsKV.Key}.{nameof(ams.DateGenerated)} : {ams.DateGenerated}\");\n    Console.WriteLine($\"{amsKV.Key}.{nameof(ams.CommitId)} : {ams.CommitId}\");\n    Console.WriteLine($\"{amsKV.Key}.{nameof(ams.RepoUrl)} : {ams.RepoUrl}\");\n}\n```\n\n### For  Web applications\n\nAdd to the csproj\n```xml \n    \u003cPackageReference Include=\"AMSWebAPI\" Version=\"2023.5.21.1551\" /\u003e\n    \u003cPackageReference Include=\"AMS_Base\" Version=\"2023.5.21.1551\" /\u003e\n    \u003cPackageReference Include=\"RSCG_AMS\" Version=\"2023.5.21.1551\" ReferenceOutputAssembly=\"false\" OutputItemType=\"Analyzer\" /\u003e\n\n```\n\nAnd in the Startup.cs put \n\n```csharp\n//above the namespace : using AMSWebAPI;\napp.UseEndpoints(endpoints =\u003e\n{\n    endpoints.MapControllers();\n    endpoints.UseAMS();\n});\n```\n\nThe access /ams/all ( for json)  or /ams/index ( for html)\n\n## Adding releases on date\n\nFor adding releases between dates  use the following codes:\n\n```csharp\nusing AMS_Base;\n[assembly:VersionReleased(Name=\"PreviousReleases\",ISODateTime =\"2022-03-31\",recordData = RecordData.Merges)]\n[assembly: VersionReleased(Name = \"WithVersioning\", ISODateTime = \"2022-04-02\", recordData = RecordData.Merges)]\n[assembly: AMS_Base.VersionReleased(Name = \"FutureRelease\", ISODateTime = \"9999-04-16\", recordData = AMS_Base.RecordData.Merges)]\n\n```\n## Detecting that you are in a CI build\n\nPut into the .csproj\n```xml\n\t\u003cPropertyGroup\u003e\n\t\t\u003cEmitCompilerGeneratedFiles\u003etrue\u003c/EmitCompilerGeneratedFiles\u003e\n\t\t\u003cCompilerGeneratedFilesOutputPath\u003e$(BaseIntermediateOutputPath)GeneratedX\u003c/CompilerGeneratedFilesOutputPath\u003e\n\t\u003c/PropertyGroup\u003e\n```\n\nIn the obj folder see the GeneratedX folder, then AMS folder, than AMS.AMSVersion folder, then edit the .cs file with notepad\n\nyou will see something like\n```csharp\npublic class XAboutMySoftware_digits\n```\nPlease see what are the digits\n\nIn your code put someething like this\n```csharp\nbool IsInCI = new XAboutMySoftware_digits().IsInCI;\n\nbuilder.Services.AddDbContextFactory\u003cApplicationDBContext\u003e(\n    options =\u003e\n    {\n        if (IsInCI)\n        {\n            var cn = builder.Configuration.GetConnectionString(\"DefaultConnection\");\n            options.UseSqlServer(cn);\n        }\n\n        else\n        {\n            var cn = \"Data Source=Tilt.db\";\n            options.UseSqlite(cn);\n        }\n    }\n     )\n   ;\n\n```\n## Modifying the subject\nAdd to the csproj the following\n```xml\n\u003cItemGroup\u003e\n    \u003cCompilerVisibleProperty Include=\"AMSMerge\" /\u003e\n  \u003c/ItemGroup\u003e\n  \u003cPropertyGroup\u003e\n\t\t\u003cEmitCompilerGeneratedFiles\u003etrue\u003c/EmitCompilerGeneratedFiles\u003e\n\t\t\u003cCompilerGeneratedFilesOutputPath\u003e$(BaseIntermediateOutputPath)GeneratedX\u003c/CompilerGeneratedFilesOutputPath\u003e\n\t\t\u003cAMSMerge\u003eAMSInterpreter.MergeAnalyzer\u003c/AMSMerge\u003e\n\t\u003c/PropertyGroup\u003e\n  \n```\n\nand add the following code to a class\n```csharp\npublic static string MergeAnalyzer(string RepoUrl,string CommitId, string Author,    DateTime ReleaseDate, string Subject)\n        {\n            try\n            {\n                /*{\n                    //modify the subject \n                    string regex = @\"^Merge\\ pull\\ request\\ \\#(?\u003cissueID\u003e\\d+)\\ from\\ (?\u003cbranch\u003e.+?)$\";\n\n                    RegexOptions options = RegexOptions.Multiline;\n                    string input = Subject;\n\n                    MatchCollection matches = Regex.Matches(input, regex, options);\n                    foreach (Match match in matches)\n                    {\n                        return $\"Issue ID: {RepoUrl}/issues/{match.Groups[\"issueID\"].Value} branch: {match.Groups[\"branch\"].Value}\"; ; \n                    }\n                    return Subject;\n                }*/\n            }\n            catch (Exception ex)\n            {\n                return $\"{CommitId} {ex.Message}\";\n            }\n            \n        }\n```\n## Diagnostics\n\n//TODO: Add more explanations here\n\n```xml\n  \u003cItemGroup\u003e\n    \u003cProjectReference Include=\"..\\AMS\\AMS.csproj\" ReferenceOutputAssembly=\"false\" OutputItemType=\"Analyzer\" /\u003e\n    \u003cProjectReference Include=\"..\\AMS_Base\\AMS_Base.csproj\" /\u003e\n\t\u003cCompilerVisibleProperty Include=\"AMSMerge\" /\u003e\n\t  \u003cCompilerVisibleProperty Include=\"FakeWarningForDiagnostics\" /\u003e\n\t  \n\n  \u003c/ItemGroup\u003e\n\t\u003cPropertyGroup\u003e\n\t\t\u003cFakeWarningForDiagnostics\u003etrue\u003c/FakeWarningForDiagnostics\u003e\n\t\t\u003cEmitCompilerGeneratedFiles\u003etrue\u003c/EmitCompilerGeneratedFiles\u003e\n\t\t\u003cCompilerGeneratedFilesOutputPath\u003e$(BaseIntermediateOutputPath)GeneratedX\u003c/CompilerGeneratedFilesOutputPath\u003e\n\t\t\u003cAMSMerge\u003eAMSInterpreter.MergeAnalyzer\u003c/AMSMerge\u003e\n\t\u003c/PropertyGroup\u003e\n\n```\t\n## CI settings\nFor GitLab:\n\u003cimg width=\"901\" alt=\"image\" src=\"https://user-images.githubusercontent.com/153982/164086502-40222b40-676a-4e98-b7ad-ba96dba8e16e.png\"\u003e\n\nFor GitHub actions:\n```yaml\n steps:\n    - uses: actions/checkout@v3\n      with:\n        fetch-depth: 0\n```\n## How it is built\n\nThe AMS_Base project / nuget is containing the definition\n\nThe RSCG_AMS project / nuget generates the code for having , in CI , the C# class with the commit / Repo / date / other details.\n\nThe AMSWebAPI project / nuget generates the code for endpoints  :  /ams/index.html and /ams/all ( for json )\n\nSee more at http://msprogrammer.serviciipeweb.ro/category/ams/\n\n## TBD:\n\nMore about https://github.com/ignatandrei/RSCG_AMS/issues/27 \n```xml\n\u003cAMSGitArgs\u003elog --merges --pretty='%an|%ai|%H|%s\u003c/AMSGitArgs\u003e\n```\n\nMore about Angular - to display ams - see src/Angular\n\n\n\n\n# More Roslyn Source Code Generators\n\nYou can find more RSCG with examples at [Roslyn Source Code Generators](https://ignatandrei.github.io/RSCG_Examples/v2/)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fignatandrei%2FRSCG_AMS","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fignatandrei%2FRSCG_AMS","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fignatandrei%2FRSCG_AMS/lists"}