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

[#177] publish does not include docs #180

Merged
merged 3 commits into from
Aug 31, 2020

Conversation

jfacorro
Copy link
Contributor

Fixes #177

@@ -8,9 +8,10 @@
-include("rebar3_hex.hrl").

-define(PROVIDER, docs).
-define(DEPS, [{default, edoc}]).
-define(DEPS, [{default, lock}]).
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removing the dependency on edoc addresses #57 in a way.

-spec assert_doc_dir(string()) -> true.
assert_doc_dir(DocDir) ->
filelib:is_dir(DocDir) orelse
rebar_api:abort( "Docs were not published since they "
Copy link
Contributor Author

@jfacorro jfacorro Aug 17, 2020

Choose a reason for hiding this comment

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

Since the publish command calls the rebar3_hex_docs:publish/3 function once it has already succeeded publishing the package itself, I though it would be better to use rebar_api:abort/2 for showing the user the error and aborting the execution. This will only abort the docs publishing and not the package publishing.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah I wonder if we actually want to bail on the publish 🤔 Like, if you're expecting it all in one go, then I could see where we might want to bail on the package publishing too, but I don't have strong feelings about it either.

Copy link
Member

@starbelly starbelly Aug 19, 2020

Choose a reason for hiding this comment

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

Yeah, I thought about this more and I really think we should strive for parity with hex (mix hex) here. Specifically, calling rebar3 hex publish assumes you want to publish both, we should check that docs exist before we attempt to publish anything, if they do not, bail and give the user a message.

We should also provide switches so inform publish to only publish the package or only publish the docs. --package and --docs.

The message I would expect in the case that we see no docs and bail would be something like what you have + If you really only want to publish the package without docs use the --package switch

Thoughts?

Copy link
Contributor Author

@jfacorro jfacorro Aug 19, 2020

Choose a reason for hiding this comment

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

I think that is a good idea, but I think the discussion around the details of implementing this new approach (i.e. publish = pkg+docs plus --package and --docs flags) deserves its own issue and separate PR. There might be many details that need to be discussed, for example, it would be nice to show the docs directory that will be used when listing the details on what is going to be published.

Since this PR address the bug in the current behaviour discussed in #180 I would like to get it merged to avoid the unexpected results we get today.

Copy link
Collaborator

Choose a reason for hiding this comment

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

To be clear, since I'm missing some context, we are running the edoc provider before publishing, right? If not we should have publish depending on or calling the edoc provider from rebar3 and then doing the publish.

If there aren't any docs even though it ran edoc then it should just continue on I would think, without erroring. Obviously will be an issue of someone overriding where edoc outputs shit, but whatever, can deal with that later.

Copy link
Contributor Author

@jfacorro jfacorro Aug 19, 2020

Choose a reason for hiding this comment

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

The publish command currently also publishes the docs by calling the internal function in rebar3_hex_docs:publish3. It is in this situation that the published docs are empty.

The docs command depends on {default, edoc}. This PR removes that dependency to allow users to rely on other tools to generate documentation.

There is more context in the related issue #177.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah ok. Yea, I guess that function should call the edoc provider instead of having the provider use a dependency on it.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, I'm cool with merging this now per what @jfacorro points out, i.e., it fixes a very confusing issue.

@@ -1,6 +1,12 @@
-module(rebar3_hex).
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Whitespace only changes.

@@ -1,18 +1,19 @@
-module(rebar3_hex_client).
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Whitespace only changes.

@@ -1,15 +1,15 @@
-module(rebar3_hex_config).
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Mostly whitespace only changes.

@@ -1,8 +1,7 @@
-module(rebar3_hex_file).
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Whitespace only changes.

@@ -3,25 +3,28 @@
%% @end
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Whitespace only changes.

@jfacorro
Copy link
Contributor Author

@starbelly @tsloughter Would it be possible to merge this? Or are there any changes that you think should be applied?

Copy link
Member

@starbelly starbelly left a comment

Choose a reason for hiding this comment

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

I plan on merging this today, I was waiting to see what @tsloughter thought overall, but I think he's inundated with rebar3 itself. I'm changing this back to requested changes as I need to test the bug myself and QA this branch. Will have an update later this evening.

Copy link
Member

@starbelly starbelly left a comment

Choose a reason for hiding this comment

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

@jfacorro okie dokie! Tested this, looks good to me... we'll do a new minor version to cover the change in behavior.

@starbelly starbelly merged commit d6b874a into erlef:master Aug 31, 2020
SirWumpus pushed a commit to SirWumpus/rebar3_hex that referenced this pull request Jul 13, 2021
* [erlef#177] Code formatting

* [erlef#177] Make sure publishing docs fails if directory doesn't exist

* [erlef#177] Remove edoc command as a dependency of docs command
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Publish does not build the docs
3 participants