How to build and test website locally

Hi - does anyone here do this? I mean pull from git@gitlab.com:graphviz/graphviz.gitlab.io.git
and build this, and open localhost:something and
see at least the top of the website.

Or are you testing some other way? How?

It has been several years, so I’ve forgotten how to do this manually. I realize the links in the website may refer to the canonical URL (now graphviz.org) so possibly this doesn’t get very far but I wanted to see.

I tried to follow Edit this website locally | GitLab
and got to step 7, NO_CONTRACTS=true bundle exec middleman
but eventually I run into
$ bundler: failed to load command: middleman (/usr/local/lib/ruby/gems/2.7.0/bin/middleman)

Despite having installed middleman, done the bundler install, etc. I’ve tried setting GEM_ROOT, I’ve checked that /usr/local/opt/ruby/bin/ruby is there, I’ve checked that $GEM_ROOT/middleman-1.2.8 exists, so I must be missing something obvious.

SCN

1 Like

Hi Stephen, thanks for asking – I should document this better!

I think Edit this website locally | GitLab is a red herring - it’s how to update the docs for the GitLab product, not the Graphviz docs.

I assume you’re on Mac? Here’s how I run the graphviz docs locally on macOS

# Get a new version of Ruby, as the macOS version is old
$ brew install ruby
# Install all the gems in Gemfile
$ /usr/local/opt/ruby/bin/bundle install
# Start an HTTP server
$ /usr/local/opt/ruby/bin/bundle exec jekyll serve
1 Like

I’ve just added a README.md to the docs repo documenting this: https://gitlab.com/graphviz/graphviz.gitlab.io/-/merge_requests/92

1 Like

From the README: “Assuming you have a recent Ruby version installed:”

Does this count as recent?

magjac@t440:~/graphviz.gitlab.io$ ruby --version
ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-linux]

It sort of works but not fully. The page looks like this:

And the log is:

magjac@t440:~/graphviz.gitlab.io$ bundle exec jekyll serve
Configuration file: /home/magjac/graphviz.gitlab.io/_config.yml
            Source: /home/magjac/graphviz.gitlab.io
       Destination: /home/magjac/graphviz.gitlab.io/_site
 Incremental build: disabled. Enable with --incremental
      Generating... 
                    done in 0.55 seconds.
 Auto-regeneration: enabled for '/home/magjac/graphviz.gitlab.io'
        ** ERROR: directory is already being watched! **

        Directory: /home/magjac/graphviz.gitlab.io/_pages/Gallery

        is already being watched through: /home/magjac/graphviz.gitlab.io/_pages/Gallery

        MORE INFO: https://github.com/guard/listen/wiki/Duplicate-directory-errors
    Server address: http://127.0.0.1:4000/
  Server running... press ctrl-c to stop.

That should work…

https://jekyllrb.com/docs/installation/#requirements says ruby 2.5.0 is the min requirement.

Looks like the errors are related to file watching. we have some symlinks to directories like Gallery… it worked on my Mac but maybe that doesn’t work with file watching cross platform.

Try removing the Gallery symlink (I think from either / or /_pages/) and see if that works?

1 Like