Skip to content
This repository was archived by the owner on Dec 11, 2024. It is now read-only.

Do not publish directories with no specs #21

Merged
merged 4 commits into from
Jul 13, 2021

Conversation

johnboyes
Copy link
Contributor

This commit ensures that any directories without any specs in them are
not published to Confluence. Prior to this commit these directories
were being published, appearing in Confluence as pages without any
content or subpages. This was distracting when trying to browse the
published specs in Confluence.

One example of this manifesting itself prior to this commit was if the
Gauge concept files were put into their own concepts directory.
As we only publish specs and not concepts to Confluence, having concepts
in their own directory was leading to empty directory pages being
published prior to this commit.

The functional tests implementation code in this commit was lifted and
shifted with only minor alterations from the functional tests repo for
core Gauge
(just like the existing functional test implementation
code) - no point in reinventing the wheel.

One other noteworthy thing is that the code to delete a page uses the
low level Go net http client, rather than the higher level
confluence-go-api client. This is because there was a subtle bug
with the confluence-go-api client (it was returning an error even after
a successful delete, despite returning the correct 204 status
code
). It may be worth removing the confluence-go-api client
altogether in a future pull request, as minimising dependencies is
generally a good thing
.

This commit ensures that any directories without any specs in them are
not published to Confluence.  Prior to this commit these directories
were being published, appearing in Confluence as pages without any
content or subpages. This was distracting when trying to browse the
published specs in Confluence.

One example of this manifesting itself prior to this commit was if the
Gauge [concept files][1] were put into their own concepts directory.
As we only publish specs and not concepts to Confluence, having concepts
in their own directory was leading to empty directory pages being
published prior to this commit.

The functional tests implementation code in this commit was lifted and
shifted with only minor alterations from [the functional tests repo for
core Gauge][2] (just like the existing functional test implementation
code) - no point in reinventing the wheel.

One other noteworthy thing is that the code to delete a page uses the
low level [Go net http client][3], rather than the higher level
[confluence-go-api client][4]. This is because there was a subtle bug
with the confluence-go-api client (it was returning an error even after
a successful delete, despite returning [the correct 204 status
code][5]). It may be worth removing the confluence-go-api client
altogether in a future pull request, as [minimising dependencies is
generally a good thing][6].

[1]: https://docs.gauge.org/writing-specifications.html#concepts
[2]: https://github.com/getgauge/gauge-tests
[3]: https://pkg.go.dev/net/http
[4]: https://github.com/Virtomize/confluence-go-api
[5]: https://developer.atlassian.com/server/confluence/confluence-rest-api-examples/#delete-a-page
[6]: https://endjin.com/blog/2018/09/whose-package-is-it-anyway-why-its-important-to-minimise-dependencies-in-your-solutions
@johnboyes johnboyes requested a review from eadragomir July 12, 2021 22:27
Copy link
Collaborator

@eadragomir eadragomir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to go. I understood easily the changes you proposed and also the implementation.

@johnboyes johnboyes merged commit 78e8d71 into master Jul 13, 2021
@johnboyes johnboyes deleted the do-not-publish-empty-dirs branch July 13, 2021 18:53
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants