Skip to content

Commit

Permalink
🔀 merge from master
Browse files Browse the repository at this point in the history
  • Loading branch information
nop77svk committed Jan 31, 2024
2 parents 9c41fcd + 5c226cf commit 9c0c5dc
Show file tree
Hide file tree
Showing 30 changed files with 632 additions and 459 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ jobs:
dotnet-version: 6.0.x
- name: Checkout
uses: actions/checkout@v3
- name: Verify commit exists in origin/main
run: |
git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/*
git branch --remote --contains | grep origin/main
- name: Set VERSION variable from tag
run: echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
- name: Update private NuGet source
Expand Down Expand Up @@ -62,6 +58,7 @@ jobs:
uses: softprops/action-gh-release@v1
with:
token: "${{ secrets.GITHUB_TOKEN }}"
body: "<changelog should come here>"
prerelease: false
files: |
./_publish.all/jira-worklogger.*
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -349,3 +349,4 @@ MigrationBackup/

# Ionide (cross platform F# VS Code tools) working folder
.ionide/
/jwl.console/Properties/launchSettings.json
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ Meet the scripted Jira worklogging! Give it your worklogs in a CSV file (and you
## Prerequisites

- .NET 6 run-time installed (for simple, cross-platform build) or no .NET runtime necessary (for self-contained, single-exe, Windows-only build); You choose!
- Jira server (with version 2 REST API) and the "Tempo Timesheets" plugin
- Jira server (with version 2 REST API)
- "vanilla" Jira server support: ✔️
- "Tempo Timesheets" plugin support: ✔️
- "ICTime" plugin support: ❎ (planned)

## Configuration

Expand All @@ -28,9 +31,9 @@ As for the CLI worklogger binary, there are command-line options available as we
### "ServerClass" setting

Available values are:
- VanillaJira
- TempoTimeSheetsPlugin
- ICTimePlugin (not implemented yet)
- Vanilla
- TempoTimeSheets
- ICTime (not implemented yet)

## The input CSV structure

Expand Down
1 change: 1 addition & 0 deletions _local_build.cmd
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
pushd jwl.console
call global_build.cmd jira-worklogger
@exit /b %ERRORLEVEL%
5 changes: 3 additions & 2 deletions jwl.console/CLI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class FillCLI
[Option("server-flavour", HelpText = "Jira server flavour (whether vanilla or with some timesheet plugins)"
+ $"\nJSON config: $.{nameof(core.AppConfig.JiraServer)}.{nameof(jira.ServerConfig.ServerFlavour)}"
+ $"\nAvailable values: {nameof(jira.JiraServerFlavour.Vanilla)}, {nameof(jira.JiraServerFlavour.TempoTimeSheets)}, {nameof(jira.JiraServerFlavour.ICTime)}")]
public string? ServerClass { get; set; }
public string? ServerFlavour { get; set; }

[Option("no-proxy", HelpText = "Turn off proxying the HTTP(S) connections to Jira server"
+ $"\nJSON config: $.{nameof(core.AppConfig.JiraServer)}.{nameof(jira.ServerConfig.UseProxy)} (negated!)")]
Expand Down Expand Up @@ -55,7 +55,8 @@ public core.AppConfig ToAppConfig()
UseVerboseFeedback = UseVerboseFeedback,
JiraServer = new jira.ServerConfig()
{
ServerFlavour = ServerClass,
ServerFlavour = ServerFlavour,
ActivityMap = null,
BaseUrl = jiraServerSpecification,
UseProxy = !NoProxy,
MaxConnectionsPerServer = MaxConnectionsPerServer,
Expand Down
8 changes: 4 additions & 4 deletions jwl.console/ScrollingConsoleProcessFeedback.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public void FillJiraWithWorklogsSetTarget(int numberOfWorklogsToInsert, int numb
Console.Error.Write($"\rFilling Jira with worklogs (+{_numberOfWorklogsToInsert}/-{_numberOfWorklogsToDelete})...");
}

public void FillJiraWithWorklogsProcess(MultiTaskProgress progress)
public void FillJiraWithWorklogsProcess(MultiTaskStats progress)
{
Console.Error.Write($"\rFilling Jira with worklogs (+{_numberOfWorklogsToInsert}/-{_numberOfWorklogsToDelete})... {ProgressPercentageAsString(progress)}");
}
Expand Down Expand Up @@ -104,7 +104,7 @@ public void ReadCsvInputSetTarget(int numberOfInputFiles)
Console.Error.Write($"\rReading {numberOfInputFiles} input files...");
}

public void ReadCsvInputProcess(MultiTaskProgress progress)
public void ReadCsvInputProcess(MultiTaskStats progress)
{
Console.Error.Write($"\rReading {progress.Total} input files... {ProgressPercentageAsString(progress)}");
}
Expand All @@ -124,7 +124,7 @@ public void RetrieveWorklogsForDeletionSetTarget(int count)
Console.Error.Write($"\rRetrieving list of worklogs ({count} Jira issues) to be deleted...");
}

public void RetrieveWorklogsForDeletionProcess(MultiTaskProgress progress)
public void RetrieveWorklogsForDeletionProcess(MultiTaskStats progress)
{
throw new NotImplementedException(@"--- checkpoint ---");
}
Expand All @@ -134,7 +134,7 @@ public void RetrieveWorklogsForDeletionEnd()
Console.Error.WriteLine(" OK");
}

protected static string ProgressPercentageAsString(MultiTaskProgress progress)
protected static string ProgressPercentageAsString(MultiTaskStats progress)
{
string result;

Expand Down
18 changes: 11 additions & 7 deletions jwl.core/AppConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public class AppConfig
public jwl.core.UserConfig? User { get; init; }
public jwl.inputs.CsvFormatConfig? CsvOptions { get; init; }

private static MapperConfiguration overridingMapperConfiguration = new MapperConfiguration(cfg =>
private static Lazy<MapperConfiguration> overridingMapperConfiguration = new (() => new MapperConfiguration(cfg =>
{
cfg.CreateMap<AppConfig, AppConfig>()
.ForAllMembers(m => m.Condition((src, dest, member) => member != null));
Expand All @@ -17,15 +17,19 @@ public class AppConfig
cfg.CreateMap<inputs.CsvFormatConfig, inputs.CsvFormatConfig>()
.ForAllMembers(m => m.Condition((src, dest, member) => member != null));
cfg.CreateMap<core.UserConfig, core.UserConfig>()
.ForAllMembers(m => m.Condition((src, dest, member) => member != null));
});
private static IMapper overridingMapper = overridingMapperConfiguration.CreateMapper();
.ForAllMembers(m => m.Condition((src, dest, member) => member != null));

cfg.AddGlobalIgnore(nameof(AppConfig.JiraServer.ActivityMap));
}));

private static Lazy<IMapper> overridingMapper = new (() => overridingMapperConfiguration.Value.CreateMapper());

public AppConfig OverrideWith(AppConfig? other)
{
if (other == null)
return this;

return overridingMapper.Map<AppConfig, AppConfig>(other, this);
return this;

AppConfig result = overridingMapper.Value.Map<AppConfig, AppConfig>(other, this);
return result;
}
}
2 changes: 2 additions & 0 deletions jwl.core/AppConfigFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ public static AppConfig CreateWithDefaults()
{
JiraServer = new ServerConfig()
{
ServerFlavour = nameof(JiraServerFlavour.Vanilla),
ActivityMap = null,
BaseUrl = @"http://jira.my-domain.xyz",
MaxConnectionsPerServer = DefaultMaxConnectionsPerServer,
SkipSslCertificateCheck = false,
Expand Down
6 changes: 3 additions & 3 deletions jwl.core/ICoreProcessFeedback.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ public interface ICoreProcessFeedback
{
void FillJiraWithWorklogsStart();
void FillJiraWithWorklogsSetTarget(int numberOfWorklogsToInsert, int numbeOfWorklogsToDelete);
void FillJiraWithWorklogsProcess(MultiTaskProgress progress);
void FillJiraWithWorklogsProcess(MultiTaskStats progress);
void FillJiraWithWorklogsEnd();
void NoExistingWorklogsToDelete();
void NoFilesOnInput();
Expand All @@ -19,10 +19,10 @@ public interface ICoreProcessFeedback
void PreloadUserInfoEnd();
void ReadCsvInputStart();
void ReadCsvInputSetTarget(int numberOfInputFiles);
void ReadCsvInputProcess(MultiTaskProgress progress);
void ReadCsvInputProcess(MultiTaskStats progress);
void ReadCsvInputEnd();
void RetrieveWorklogsForDeletionStart();
void RetrieveWorklogsForDeletionSetTarget(int count);
void RetrieveWorklogsForDeletionProcess(MultiTaskProgress progress);
void RetrieveWorklogsForDeletionProcess(MultiTaskStats progress);
void RetrieveWorklogsForDeletionEnd();
}
Loading

0 comments on commit 9c0c5dc

Please sign in to comment.