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

Small changes for GitLab #971

Merged
merged 6 commits into from
Mar 3, 2019
Merged

Small changes for GitLab #971

merged 6 commits into from
Mar 3, 2019

Conversation

JackDunnNZ
Copy link
Contributor

I have been experimenting with getting docs to build on GitLab and found a few things to fix up.

For reference and to help anyone else, I've been using the following hacked together script that calls git_push to skip all of the travis-specific processing in deploydocs:

if haskey(ENV, "CI")
  tag = get(ENV, "CI_COMMIT_TAG", "")
  tag_ok = isempty(tag) || occursin(Base.VERSION_REGEX, tag)

  if tag_ok
    root = pwd()
    build_dir = "docs/build"
    target_repo = "gitlab.com/xxx/yyy"

    mktempdir() do temp
      devurl = "dev"
      Documenter.git_push(root, temp, target_repo;
          target=build_dir,
          tag=tag,
          host="gitlab.com",
          key=ENV["DOCUMENTER_KEY"],
          # Defaults from Documenter.deploydocs
          sha=readchomp(`git rev-parse --short HEAD`),
          devurl=devurl,
          versions=["stable" => "v^", "v#.#", devurl => devurl],
          forcepush=false,
      )
    end
  end
end

There are three commits each with a minor change:

  1. Add a host option to git_push so that the url rewriting and temp ssh config file work for gitlab.com urls as well
  2. Makes the .ssh directory if it doesn't already exist to avoid crashing
  3. Wraps the identity file path in quotes in case of spaces in the filename

Happy to rework anything as required

@@ -599,15 +599,15 @@ and when building docs for a tag they are deployed to a `vX.Y.Z` directory.
function git_push(
root, temp, repo;
branch="gh-pages", dirname="", target="site", tag="", key="", sha="", devurl="dev",
versions, forcepush=false,
versions, forcepush=false, host="github.com",
Copy link
Member

Choose a reason for hiding this comment

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

Are you planning to call git_push directly or where is this kwarg set? Couldn't we find the host from the repo argument to deploydocs?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes currently I call git_push directly as in the first comment. We could definitely pull the host from the repo argument as something like split(repo, "/")[1] if you think that would be better - it's probably more robust.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, parsing repo seems better here.

I think currently we allow both github.com: and github.com/ as the start of the repo. So we could formalize that a bit and say repo has to start with the domain name, then you have / or : as a separator, and then the rest of the URL follows. So we should also split by :, or probably use a regex to match the start.

src/Documenter.jl Outdated Show resolved Hide resolved
@mortenpi mortenpi added this to the 0.22.0 milestone Feb 28, 2019
@mortenpi
Copy link
Member

Other than the repo/host thing, LGTM! @JackDunnNZ could you also drop a small note into CHANGELOG.md?

@JackDunnNZ
Copy link
Contributor Author

Thanks both for the comments! I've changed to extract the host using regex and added the note to the changelog

@mortenpi mortenpi merged commit 1ee88b3 into JuliaDocs:master Mar 3, 2019
@mortenpi
Copy link
Member

mortenpi commented Mar 3, 2019

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants