Skip to content

Commit

Permalink
Implement
Browse files Browse the repository at this point in the history
  • Loading branch information
coenm committed Jun 3, 2024
1 parent 3f0a1ec commit f6bd595
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 28 deletions.
6 changes: 0 additions & 6 deletions docs_new/Tags.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,6 @@ The following `TagsV2.yaml` file defines three different tags (work, private, gi
context:
- type: evaluate-script@1
content: |-
# at this moment, you must leave this function intact
# todo, make sure this is not required anymore.
func translate(input)
ret input
end
func remotes_contain_inner(remotes, url_part)
urls = remotes | array.map "url"
filtered = array.filter(urls, do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ namespace RepoM.ActionMenu.Core.Model;
using RepoM.ActionMenu.Interface.YamlModel;
using RepoM.ActionMenu.Interface.YamlModel.ActionMenus;
using Scriban;
using Scriban.Runtime;
using FileFunctions = RepoM.ActionMenu.Core.ActionMenu.Context.FileFunctions;
using IRepository = RepoM.Core.Plugin.Repository.IRepository;
using RepositoryFunctions = RepoM.ActionMenu.Core.ActionMenu.Context.RepositoryFunctions;
Expand Down Expand Up @@ -131,6 +132,8 @@ private static RepoMScriptObject CreateAndInitRepoMScriptObject(IRepository repo
{
var scriptObj = new RepoMScriptObject();

scriptObj.Import(typeof(InitialFunctions));

scriptObj.SetValue("file", new FileFunctions(), true);
scriptObj.SetValue("repository", new RepositoryFunctions(repository), true);

Expand Down
9 changes: 9 additions & 0 deletions src/RepoM.ActionMenu.Core/Model/InitialialFunctions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace RepoM.ActionMenu.Core.Model;

internal static class InitialFunctions
{
public static string? Translate(string? input)
{
return input;
}
}
5 changes: 0 additions & 5 deletions src/RepoM.Api/Resources/RepositoryActionsV2.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
context:
- type: evaluate-script@1
content: |-
# at this moment, you must leave this function intact
func translate(input)
ret input
end
func is_null(input)
ret input == null
end
Expand Down
5 changes: 0 additions & 5 deletions src/RepoM.Api/Resources/TagsV2.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
context:
- type: evaluate-script@1
content: |-
# at this moment, you must leave this function intact
func translate(input)
ret input
end
func remotes_contain_inner(remotes, url_part)
urls = remotes | array.map "url"
filtered = array.filter(urls, do
Expand Down
12 changes: 0 additions & 12 deletions tests/RepoM.ActionMenu.Core.Tests/ScribanActionMenuTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,6 @@ public class ScribanActionMenuTests
private const string TAGS =
"""
context:
- type: evaluate-script@1
content: |-
func translate(input)
ret 'translate says:' + input;
end
- name: coenm
- name1: coenm1
Expand Down Expand Up @@ -123,12 +117,6 @@ func sonar_url(project_id)
private const string ACTION_MENU =
"""
context:
- type: evaluate-script@1
content: |-
func translate(input)
ret 'translate says:' + input;
end
- name: coenm
- name1: coenm1
Expand Down

0 comments on commit f6bd595

Please sign in to comment.