Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
coenm committed Sep 18, 2024
1 parent afe6fd8 commit 13a5fd2
Show file tree
Hide file tree
Showing 18 changed files with 305 additions and 262 deletions.
12 changes: 12 additions & 0 deletions docs/mdsource/repom.generated.source.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,13 @@ Properties:
- `skip`: Predicate to skip the current item. ([Predicate](repository_action_types.md#predicate))
- `actions`: List of repeated actions. (List)

### Example

snippet: foreach@1-scenario01

snippet: foreach@1-scenario02


## git-checkout@1

This action will create a menu and sub menus with all local and remote branches for an easy checkout.
Expand Down Expand Up @@ -164,3 +171,8 @@ Properties:
- `url`: The URL to browse to. ([Text](repository_action_types.md#text))
- `active`: Whether the menu item is enabled. ([Predicate](repository_action_types.md#predicate))
- `context`: The context in which the action is available. ([Context](repository_action_types.md#context))

### Example

snippet: url@1-scenario01

245 changes: 0 additions & 245 deletions docs_old/ActionList.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,46 +127,6 @@ repository-actions:
<sup><a href='/tests/RepoM.Api.Tests/IO/ModuleBasedRepositoryActionProvider/DocumentationFiles/Folder01.testfile.yaml#L3-L25' title='Snippet source file'>snippet source</a> | <a href='#snippet-repositoryactionsfolder01' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

## foreach@1

Action to create repeated actions based on a variable.<!-- include: DocsRepositoryActionsTests.DocsRepositoryActionsSettings_RepositoryActionForeachV1.verified.md -->

Action specific properties:

- `enumerable`: The list of items to enumerate on. (required, evaluated, string)
- `variable`: The name of the variable to access to current enumeration of the items. For each iteration, the variable `{var.name}` has the value of the current iteration. (required, evaluated, string)
- `skip`: Predicate to skip the current item. (optional, evaluated, string)
- `actions`: List of repeated actions. (required, evaluated, ienumerable`1)<!-- endInclude -->

Example:

<!-- snippet: RepositoryActionsForeach01 -->
<a id='snippet-repositoryactionsforeach01'></a>
```yaml
repository-actions:
variables:
- name: DTAP
value:
- key: D
url: https://develop.local
- key: T
url: https://test.local
- key: A
url: https://acceptance.local
- key: p
url: https://production.local
actions:
- type: foreach@1
enumerable: '{var.DTAP}'
variable: environment
skip: ''
actions:
- type: just-text@1
name: '{var.environment.key} - {var.environment.url}'
```
<sup><a href='/tests/RepoM.Api.Tests/IO/ModuleBasedRepositoryActionProvider/DocumentationFiles/Foreach01.testfile.yaml#L3-L26' title='Snippet source file'>snippet source</a> | <a href='#snippet-repositoryactionsforeach01' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

## git-checkout@1

This action will create a menu and sub menus with all local and remote branches for an easy checkout.<!-- include: DocsRepositoryActionsTests.DocsRepositoryActionsSettings_RepositoryActionGitCheckoutV1.verified.md -->
Expand Down Expand Up @@ -313,211 +273,6 @@ repository-actions:
<sup><a href='/tests/RepoM.Api.Tests/IO/ModuleBasedRepositoryActionProvider/DocumentationFiles/PinRepository01.testfile.yaml#L3-L22' title='Snippet source file'>snippet source</a> | <a href='#snippet-repositoryactionspinrepository01' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

# Plugin actions

These actions are available though the use of plugins.

## clipboard-copy@1<!-- include: _plugins.clipboard.action. path: /docs/mdsource/_plugins.clipboard.action.include.md -->

This action makes it possible to copy text to the clipboard.<!-- include: DocsRepositoryActionsTests.DocsRepositoryActionsSettings_RepositoryActionClipboardCopyV1.verified.md -->

Action specific properties:

- `text`: The text to copy to the clipboard. (required, evaluated, string)<!-- endInclude -->

Example:

<!-- snippet: RepositoryActionsClipboardCopy01 -->
<a id='snippet-repositoryactionsclipboardcopy01'></a>
```yaml
repository-actions:
actions:
- type: clipboard-copy@1
active: true
variables: []
name: Copy to clipboard
text: ''
- type: clipboard-copy@1
name: Copy to clipboard
text: ''
```
<sup><a href='/tests/RepoM.Plugin.Clipboard.Tests/DocumentationFiles/Clipboard01.testfile.yaml#L3-L17' title='Snippet source file'>snippet source</a> | <a href='#snippet-repositoryactionsclipboardcopy01' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->
<!-- endInclude -->

See the [Clipboard](RepoM.Plugin.Clipboard.md) plugin for more information.

## sonarcloud-set-favorite@1<!-- include: _plugins.sonarcloud.action. path: /docs/mdsource/_plugins.sonarcloud.action.include.md -->

Action to mark a repository as favorite within SonarCloud.<!-- include: DocsRepositoryActionsTests.DocsRepositoryActionsSettings_RepositoryActionSonarCloudSetFavoriteV1.verified.md -->

Action specific properties:

- `project`: The SonarCloud project key. (required, evaluated, string)<!-- endInclude -->

Example:

<!-- snippet: RepositoryActionsSonarCloudSetFavorite01 -->
<a id='snippet-repositoryactionssonarcloudsetfavorite01'></a>
```yaml
repository-actions:
actions:
- type: sonarcloud-set-favorite@1
active: true
variables: []
name: Star repository on SonarCloud
project: ''
- type: sonarcloud-set-favorite@1
name: Star repository on SonarCloud
project: ''
```
<sup><a href='/tests/RepoM.Plugin.SonarCloud.Tests/DocumentationFiles/SonarCloudSetFavorite01.testfile.yaml#L3-L16' title='Snippet source file'>snippet source</a> | <a href='#snippet-repositoryactionssonarcloudsetfavorite01' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->
<!-- endInclude -->

See the [SonarCloud](RepoM.Plugin.SonarCloud.md) plugin for more information.

## azure-devops-create-prs@1<!-- include: _plugins.azuredevops.action. path: /docs/mdsource/_plugins.azuredevops.action.include.md -->

Action menu item to create a pull request in Azure Devops.<!-- include: DocsRepositoryActionsTests.DocsRepositoryActionsSettings_RepositoryActionAzureDevOpsCreatePullRequestsV1.verified.md -->

Action specific properties:

- `project-id`: The azure devops project id. (required, evaluated, string)
- `title`: Menu item title. When not provided, a title will be generated.
This property will be used instead of the Name property. (optional, string)
- `pr-title`: Pull Request title. When not provided, the title will be defined based on the branch name.
Title will be the last part of the branchname split on `/`, so `feature/123-testBranch` will result in title `123-testBranch` (optional, string)
- `to-branch`: Name of the branch the pull request should be merged into. For instance `develop`, or `main`. (required, string)
- `reviewer-ids`: List of reviewer ids. The id should be a valid Azure DevOps user id (ie. GUID). (optional, list`1)
- `draft-pr`: Boolean specifying if th PR should be marked as draft. (required, boolean, default: `false`)
- `include-work-items`: Boolean specifying if workitems should be included in the PR. The workitems will be found by using the commit messages. (required, boolean, default: `true`)
- `open-in-browser`: Boolean specifying if the Pull request should be opened in the browser after creation. (required, boolean, default: `false`)
- `auto-complete`: Auto complete options. Please take a look at the same for more information (required, repositoryactionazuredevopscreatepullrequestsautocompleteoptionsv1)<!-- endInclude -->

Example:

<!-- snippet: RepositoryActionsAzureDevopsCreatePrs01 -->
<a id='snippet-repositoryactionsazuredevopscreateprs01'></a>
```yaml
repository-actions:
actions:
# Create PR
- type: azure-devops-create-prs@1
project-id: ''
to-branch: develop
reviewer-ids:
- "GUID"
# Create PR with auto-complete enabled
- type: azure-devops-create-prs@1
project-id: ''
to-branch: develop
reviewer-ids:
- "GUID"
auto-complete:
enabled: true
merge-strategy: "Squash"
# Create PR with all settings
- type: azure-devops-create-prs@1
project-id: ''
title: 'Create PR'
# When no pr-title provided it will be generated based on convention.
# Title will be the last part of the branchname split on '/'.
# For example: feature/testBranch will result in a PR title of 'testBranch'.
pr-title: 'PR title'
to-branch: develop
reviewer-ids:
- "GUID"
draft-pr: true
include-work-items: true
open-in-browser: false
auto-complete:
enabled: true
merge-strategy: "NoFastForward" # You can choose from: "NoFastForward", "Squash", "Rebase" and "RebaseMerge"
deleteSource-branch: true
transition-work-items: true
```
<sup><a href='/tests/RepoM.Plugin.AzureDevOps.Tests/DocumentationFiles/AzureDevopsCreatePrs.testfile.yaml#L3-L44' title='Snippet source file'>snippet source</a> | <a href='#snippet-repositoryactionsazuredevopscreateprs01' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

## azure-devops-get-prs@1

This action results in zero or more items in the contextmenu. For each open pullrequest for the given repository, it will show an action to go to the specific PullRequest in your favorite webbrowser.<!-- include: DocsRepositoryActionsTests.DocsRepositoryActionsSettings_RepositoryActionAzureDevOpsGetPullRequestsV1.verified.md -->

Action specific properties:

- `project-id`: The azure devops project id. (required, evaluated, string)
- `repository-id`: The repository Id. If not provided, the repository id is located using the remote url. (optional, evaluated, string)
- `show-when-empty`: When no pull requests are available, this property is used to determine if no or a message item is showed. (optional, evaluated, string, default: `true`)<!-- endInclude -->

Example:

<!-- snippet: RepositoryActionsAzureDevopsGetPrs01 -->
<a id='snippet-repositoryactionsazuredevopsgetprs01'></a>
```yaml
repository-actions:
actions:
- type: azure-devops-get-prs@1
active: true
variables: []
show-when-empty: true
repository-id: ''
project-id: ''
- type: azure-devops-get-prs@1
repository-id: ''
```
<sup><a href='/tests/RepoM.Plugin.AzureDevOps.Tests/DocumentationFiles/AzureDevopsGetPrs.testfile.yaml#L3-L17' title='Snippet source file'>snippet source</a> | <a href='#snippet-repositoryactionsazuredevopsgetprs01' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->
<!-- endInclude -->

See the [AzureDevOps](RepoM.Plugin.AzureDevOps.md) plugin for more information.

## heidi-databases@1<!-- include: _plugins.heidi.action. path: /docs/mdsource/_plugins.heidi.action.include.md -->

<!-- todo, improve docs -->
Action to list heidi databases and show action menus for them.<!-- include: DocsRepositoryActionsTests.DocsRepositoryActionsSettings_RepositoryActionHeidiDatabasesV1.verified.md -->

Action specific properties:

- `key`: Repository key.
If not provided, the repository `Remote.Origin.Name` is used as selector. (optional, string)
- `executable`: The absolute path of the Heidi executable. If not provided, the default value from the plugin settings is used. (optional, evaluated, string)<!-- endInclude -->

Example:

<!-- snippet: RepositoryActionsHeidiDatabases01 -->
<a id='snippet-repositoryactionsheididatabases01'></a>
```yaml
repository-actions:
actions:
- type: heidi-databases@1
active: true
variables: []
name: Databases
executable: ''
- type: heidi-databases@1
name: Databases
executable: ''
- type: heidi-databases@1
name: Databases
```
<sup><a href='/tests/RepoM.Plugin.Heidi.Tests/DocumentationFiles/HeidiDatabases.testfile.yaml#L3-L20' title='Snippet source file'>snippet source</a> | <a href='#snippet-repositoryactionsheididatabases01' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->
<!-- endInclude -->

See the [Heidi](RepoM.Plugin.Heidi.md) plugin for more information.

include _plugins.webbrowser.action

See the [WebBrowser](RepoM.Plugin.WebBrowser.md) plugin for more information.

# Repository Actions

These actions are part of the Repository Actions config file described in [Repository Actions](RepositoryActions.md).
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,16 @@ namespace RepoM.ActionMenu.Core.ActionMenu.Model.ActionMenus.ForEach;
/// <summary>
/// Action to create repeated actions based on a variable.
/// </summary>
/// <example>
/// <snippet name='foreach@1-scenario01' mode='snippet' />
/// <snippet name='foreach@1-scenario02' mode='snippet' />
/// </example>
[RepositoryAction(TYPE_VALUE)]
internal sealed class RepositoryActionForEachV1 : IMenuAction, IContext
{
public const string TYPE_VALUE = "foreach@1";
internal const string EXAMPLE_1 = TYPE_VALUE + "-scenario01";
internal const string EXAMPLE_2 = TYPE_VALUE + "-scenario02";

public string Type
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ namespace RepoM.ActionMenu.Core.ActionMenu.Model.ActionMenus.Url;
/// <summary>
/// Action to open the url in the default browser.
/// </summary>
/// <example>
/// <snippet name='url@1-scenario01' mode='snippet' />
/// </example>
[RepositoryAction(TYPE_VALUE)]
internal sealed class RepositoryActionUrlV1 : IMenuAction, IName, IContext
{
Expand Down
16 changes: 11 additions & 5 deletions tests/RepoM.ActionMenu.Core.TestLib/IntegrationActionTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,18 @@ public abstract class IntegrationActionTestBase

protected IntegrationActionTestBase()
{
Repository = new Repository(@"C:\Repositories\work\RepoX")
Repository = new Repository(@"C:\Repositories\work\RepoM")
{
CurrentBranch = "feature/123-my-new-ui-with-multiple-new-screens-so-this-has-a-long-branch-name",
Branches = ["develop",],
Remotes =
{
CurrentBranch = "feature/123-my-new-ui-with-multiple-new-screens-so-this-has-a-long-branch-name",
Branches = new string[1] { "develop", },
};
new Remote("origin", "https://www.github.com/coenm/RepoM/"),
new Remote("fork1", "https://www.github.com/coenm/RepoM-Fork1/"),
new Remote("fork2", "https://www.github.com/coenm/RepoM-Fork2/"),
new Remote("ssh-fork", "ssh://user@github.com/coenm/RepoM-Fork3/"),
},
};

PackageConfiguration = A.Fake<IPackageConfiguration>();
AppSettingsService = A.Fake<IAppSettingsService>();
Expand Down Expand Up @@ -84,7 +91,6 @@ protected async Task<IEnumerable<UserInterfaceRepositoryActionBase>> CreateMenuA
}
}


public abstract class IntegrationActionTestBase<T> : IntegrationActionTestBase where T : IPackage, new()
{
protected IntegrationActionTestBase()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
RepositoryCommand: {
Executable: wt,
Arguments: [
-d "C:/Repositories/work/RepoX"
-d "C:/Repositories/work/RepoM"
]
},
Repository: {Scrubbed},
Expand All @@ -16,7 +16,7 @@
RepositoryCommand: {
Executable: cmd,
Arguments: [
/k cd "C:\Repositories\work\RepoX" & git add . & git commit -m "my fix" & git push & exit
/k cd "C:\Repositories\work\RepoM" & git add . & git commit -m "my fix" & git push & exit
]
},
Repository: {Scrubbed},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
RepositoryCommand: {
Executable: {UserProfile}\AppData\Local/Programs/Microsoft VS Code/code.exe,
Arguments: [
"C:/Repositories/work/RepoX/.editorconfig"
"C:/Repositories/work/RepoM/.editorconfig"
]
},
Repository: {Scrubbed},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
{
Name: my-solution.sln,
RepositoryCommand: {
Executable: C:\Repositories\work\RepoX\my-solution.sln,
Executable: C:\Repositories\work\RepoM\my-solution.sln,
Arguments: [

]
Expand All @@ -21,7 +21,7 @@
{
Name: test solution.sln,
RepositoryCommand: {
Executable: C:\Repositories\work\RepoX\src\test solution.sln,
Executable: C:\Repositories\work\RepoM\src\test solution.sln,
Arguments: [

]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class FilesContextTests : IntegrationActionTestBase

public FilesContextTests()
{
var rootPath = Path.Combine("C:", "Repositories", "work", "RepoX");
var rootPath = Path.Combine("C:", "Repositories", "work", "RepoM");

FileSystem.AddDirectory(Path.Combine(rootPath, "src"));
FileSystem.AddFile(Path.Combine(rootPath, "my-solution.sln"), new MockFileData("dummy"));
Expand Down
Loading

0 comments on commit 13a5fd2

Please sign in to comment.