Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Logging to Releasify #1432

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

Horb
Copy link
Contributor

@Horb Horb commented Jan 2, 2019

Add Logging to Releasify

The following refactor was brought about because we (Age Partnership) were running into difficulty using Squirrel in the Azure DevOps Build Pipelines and existing logging wasn't sufficient for our needs.

I don't expect any functionality to have changed.

The Releasify method in Update.exe has been broken up into;

  • ensureConsole
  • ValidateBaseUrl
  • ValidatePaths
  • PrepareFiles
  • ProcessFiles
  • CleanupFiles
  • WriteReleaseFile
  • CreateSetupExe
  • GenerateMsi

Breaking Releasify up into smaller methods allows stack traces to be more useful when identifying issues.

The refactoring was done using ReSharper. Only significant change is the use of out var declarations and passing variables using ref. I expect a more significant refactor could make this cleaner. Debug logs have been added to the start of each method and the whole Releasify method is now in a "try / catch / log / throw" block.

The following refactor was brought about because we (Age Partnership)
were running into difficulty using Squirrel in the Azure DevOps Build
Pipelines and existing logging wasn't sufficient for our needs.

I don't expect any functionality to have changed.

The Releasify method in Update.exe has been broken up into;

* ensureConsole
* ReleasifyValidateBaseUrl
* ReleasifyValidatePaths
* ReleasifyPrepareFiles
* ReleasifyProcessFiles
* ReleasifyCleanupFiles
* ReleasifyWriteReleaseFile
* ReleasifyCreateSetupExe
* ReleasifyGenerateMsi

Breaking Releasify up into smaller methods allows stack traces to be
more useful when identifying issues.

The refactoring was done using ReSharper. Only significant change is the
use of `out var` declarations and passing variables using `ref`. I
expect a more significant refactor could make this cleaner.  Debug logs have
been added to the start of each method and the whole Releasify method is now
in a "try / catch / log / throw" block.
src/Update/Program.cs Outdated Show resolved Hide resolved
src/Update/Program.cs Outdated Show resolved Hide resolved
src/Update/Program.cs Outdated Show resolved Hide resolved
@anaisbetts
Copy link
Contributor

I appreciate the concept but I'm not sure we've made the code Better here. So many variables are shared between all of these that R#'s result makes changing the code frustrating. An alternate approach would be to move many of these inner variables to instance fields, then try the R# Extract Method trick again

@Horb
Copy link
Contributor Author

Horb commented Jan 2, 2019

Thanks. I wanted the most minimal diff possible so the meaning wasn't lost in the changes.

Now that the meaning has gotten across I'll make a new changeset that is more considerate of code quality, number of arguments etc.

@anaisbetts
Copy link
Contributor

anaisbetts commented Jan 2, 2019

@Horb You don't have to close this PR and resubmit a new one, just keep committing to this branch. git checkout -p origin/master might help here too to trim away the csproj changes

@Horb
Copy link
Contributor Author

Horb commented Jan 2, 2019

Refactor to introduce instance variables is complete. I need to test to make sure I haven't broken anything. Once I've tested I'll report back here.

@Horb
Copy link
Contributor Author

Horb commented Jan 3, 2019

@paulcbetts I think this is good to go now. Some variable names are no longer used and the name from command line parsing is used instead such as; signingOpts/signingParameters, package/target.

@shiftkey shiftkey added the unmergeable Pull requests that do not merge currently into the default branch label Apr 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
unmergeable Pull requests that do not merge currently into the default branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants