Skip to content

Commit

Permalink
Merge branch '87-make-init-project-hugo-docs-not-parsing-gitlab_group…
Browse files Browse the repository at this point in the history
…' into 'master'

Resolve "make init-project-hugo-docs not parsing GITLAB_GROUP"

Closes #87

See merge request consensus.enterprises/drumkit!36
  • Loading branch information
Seonaid Lee committed Mar 15, 2021
2 parents 5fdb0df + 7eac8fe commit 9bca274
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 32 deletions.
6 changes: 3 additions & 3 deletions features/projects/hugo-docs.feature
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ Feature: Initialize Hugo Docs Projects
"""
Initializing Hugo Docs project
Downloading the
Your new docs site is initialized, please edit docs/config.yaml to fill in site details
Your new docs site has been added, configuration instructions are in docs/config.yaml
"""

@unit
Scenario: Initialize config.yaml file
When I run "unset DRUMKIT && source d && make docs/config.yaml GITLAB_GROUP=mygroup GITLAB_PROJECT_NAME=myproject"
When I run "unset DRUMKIT && source d && make docs/config.yaml"
Then I should get:
"""
Initializing config.yaml
Expand Down Expand Up @@ -53,7 +53,7 @@ Feature: Initialize Hugo Docs Projects
docs/layouts
docs/static
"""
When I run "make hugo-docs-search-index"
When I run "make docs/layouts/index.json"
Then I should get:
"""
Initializing search index.json
Expand Down
13 changes: 8 additions & 5 deletions files/hugo-docs/config.yaml.tmpl
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
baseUrl: "http://{{ GITLAB_GROUP }}.gitlab.io/{{ GITLAB_PROJECT_NAME }}/"
# To configure this for deployment to gitlab pages, replace "mygroup" with your group name
# and replace all instances of "myproject" with the name of the project.

baseUrl: "http://mygroup.gitlab.io/myproject/"
languageCode: "en-US"
defaultContentLanguage: "en"

title: "{{ GITLAB_PROJECT_NAME }} Docs Site"
title: "myproject Docs Site"
theme: "learn"
metaDataFormat: "yaml"
defaultContentLanguageInSubdir: true

params:
editURL: "https://gitlab.com/{{ GITLAB_GROUP }}/{{ GITLAB_PROJECT_NAME }}/tree/master/docs/content/"
editURL: "https://gitlab.com/mygroup/myproject/tree/master/docs/content/"
description: "Description of project docs site"
author: "Consensus Enterprises"
showVisitedLinks: true
Expand All @@ -24,10 +27,10 @@ params:
menu:
shortcuts:
- name: "<i class='fa fa-gitlab'></i> Gitlab repo"
url: "https://gitlab.com/{{ GITLAB_GROUP }}/{{ GITLAB_PROJECT_NAME }}"
url: "https://gitlab.com/mygroup/myproject"
weight: 10
- name: "<i class='fa fa-bullhorn'></i> Contributors"
url: "https://gitlab.com/{{ GITLAB_GROUP }}/{{ GITLAB_PROJECT_NAME }}/graphs/master"
url: "https://gitlab.com/mygroup/myproject/graphs/master"
weight: 30

# For search functionality
Expand Down
37 changes: 13 additions & 24 deletions mk/projects/20_hugo-docs.mk
Original file line number Diff line number Diff line change
@@ -1,29 +1,12 @@
init-project-hugo-docs-intro:
@echo "Initializing Hugo Docs project."
@echo "OS is $(OS)"

hugo-docs.conf:
@echo "Please provide the following information to initialize your Hugo Gitlab Pages site:"
@read -p "GitLab group name: " group && export GITLAB_GROUP=$${group} && \
read -p "GitLab project name: " project && export GITLAB_PROJECT_NAME=$${project}

docs/config.yaml: mustache
@echo "Initializing config.yaml."
@mkdir -p docs
@mustache ENV $(FILES_DIR)/hugo-docs/config.yaml.tmpl > $@
@rm -f docs/config.toml

.PHONY: init-project-hugo-docs

clean-hugo-docs.conf:
@rm hugo-docs.conf


init-project-hugo-docs: init-project-hugo-docs-intro hugo-docs.conf init-project-hugo-docs-dir docs/config.yaml hugo-docs-search-index ##@projects Initialize a hugo site
init-project-hugo-docs: init-project-hugo-docs-dir docs/config.yaml docs/layouts/index.json ##@projects Initialize a hugo site
@echo "Initializing Hugo Docs project."
@git add docs
@git commit -m "Initialize docs site."
@cd docs && hugo new _index.md
@echo "Your new docs site is initialized, please edit docs/config.yaml to fill in site details."
@echo "Initial homepage _index.md file requires edits to be published (remove draft: true). "
@echo "Your new docs site has been added, configuration instructions are in docs/config.yaml"
@echo "To publish content/_index.md, remove 'draft: true' from forematter"
@echo "Usage (from inside docs folder):"
@echo " hugo new <path/to/file.md> --> create new pages."
@echo " hugo serve --> serve files locally at http://localhost:1313/PROJECT"
Expand All @@ -33,6 +16,12 @@ init-project-hugo-docs-dir: hugo
@hugo new site docs
@git submodule add https://github.com/matcornic/hugo-theme-learn.git docs/themes/learn

hugo-docs-search-index:
docs/config.yaml:
@echo "Initializing config.yaml."
@mkdir -p docs
@cp $(FILES_DIR)/hugo-docs/config.yaml.tmpl $@
@rm -f docs/config.toml

docs/layouts/index.json:
@echo "Initializing search index.json."
@cp $(FILES_DIR)/hugo-docs/index.json docs/layouts/index.json
@cp $(FILES_DIR)/hugo-docs/index.json $@

0 comments on commit 9bca274

Please sign in to comment.