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

Replace old workstation docs with new workstation docs #1037

Merged
merged 15 commits into from
Mar 31, 2020
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions .expeditor/buildkite/hugo_lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

set -euo pipefail

LINT_STATUS="$(grep -r -I --color=auto -o --with-filename -n -P '[^\x00-\x7F]' ./www/site/content/docs &> /dev/null ; echo $?)"
LINT_STATUS="$(grep -r -I --color=auto -o --with-filename -n -P '[^\x00-\x7F]' ./www/content | grep -v '[✓]' &> /dev/null ; echo $?)"

if [ "$LINT_STATUS" == 1 ]; then
echo "Success!"
exit 0
else
echo "Failure!"
grep -r -I --color=auto -o --with-filename -n -P '[^\x00-\x7F]' ./www/site/content/docs
grep -r -I --color=auto -o --with-filename -n -P '[^\x00-\x7F]' ./www/content | grep -v '[✓]'
if [ "$LINT_STATUS" == 0 ]; then
exit 1
else
Expand Down
37 changes: 27 additions & 10 deletions www/.gitignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,30 @@
# Hugo
public
.DS_Store

# markdownlint
.markdownlint.json
# ignore doctree files in translation folders
*.doctree
*.pickle

# chef-www-acceptance.cd.chef.co content
chef-sh
public/
/resources/

**/.sass-cache
**/.sass-cache/*
*.css.map
*.css_t.map

/.delivery/cli.toml

/.vscode

/.venv

*.*~
*~
TAGS

results/

static/fonts/fontawesome
node_modules
vendor

# upstream repos
chef-www
site/themes/chef
site/layouts
30 changes: 12 additions & 18 deletions www/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,20 @@
# so we have to override the default shell here
SHELL=bash

chef-www:
git clone https://github.com/chef/chef-www.git chef-www

site/themes/chef:
git clone https://github.com/chef/chef-hugo-theme.git site/themes/chef
assets:
pushd themes/docs-new && make assets && popd

clean:
rm -rf chef-sh
rm -rf chef-www
rm -rf site/layouts
rm -rf site/themes/chef
pushd themes/docs-new && make clean && popd
rm -rf resources/

sync: chef-www site/themes/chef
pushd chef-www && git fetch && git reset --hard origin/master && popd
pushd site/themes/chef && git fetch && git reset --hard origin/master && popd
cp -R chef-www/site/layouts site/
aws --profile chef-cd s3 sync s3://chef-www-acceptance.cd.chef.co chef-sh --delete
clean_all:
pushd themes/docs-new && make clean_all && popd
rm -rf resources/
rm -rf results/

serve: sync
cd site && hugo server --buildDrafts --noHTTPCache
serve: assets
hugo server --buildDrafts --noHTTPCache

lint: chef-www site/themes/chef
pushd site && hugo -D && popd
lint: assets
hugo -D
68 changes: 19 additions & 49 deletions www/README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,14 @@
# Chef Workstation + http://chef.sh

Chef Workstation hosts its marketing and documentation content on [chef.sh](https://chef.sh) (the microsite) along with marketing and documentation for other Chef products including Chef Server, Chef Client, and ChefDK. The primary source code for [chef.sh](https://chef.sh) is kept with the [chef/chef-www](https://github.com/chef/chef-www) code along with most of the marketing materials, but the documentation source is kept with the code repositories. To handle this, we have a dedicated code structure here in `chef/chef-workstation` that is pulled into `chef/chef-www` when it is updated.
This folder contains the source for the [Chef Workstation documentation](https://docs.chef.io/workstation/). It is
copied and deployed via [chef/chef-www](https://github.com/chef/chef-www) as a Hugo module.

The primary source code for [chef.sh](https://chef.sh) (the microsite) is kept with the [chef/chef-www](https://github.com/chef/chef-www) repo along with most of the marketing materials.

## Getting Started

### One Time Install

1. **DISABLE SMART QUOTES**
OS X is annoying and tries to use smartquotes when editing Hugo docs. You want smartquotes disabled regardless if you are writing code.
Here's how [you can disable it](http://www.iclarified.com/38772/how-to-disable-curly-quotes-in-mac-os-x-mavericks).

1. Install the AWS CLI

```
$ brew install awscli
```

1. Follow the instructions [here](https://github.com/chef/okta_aws#installation) to install and setup [okta_aws](https://github.com/chef/okta_aws).

1. Run `okta_aws --list` and make sure you see `chef-cd` in the output.
1. If you do not, please reach out to the #helpdesk and have them add you to the "Chef CD AWS Account".

1. Install Hugo

```
Expand All @@ -31,13 +19,7 @@ Chef Workstation hosts its marketing and documentation content on [chef.sh](http

_These are the steps you'll need to run every time you launch a development environment._

1. Authentiate against the `chef-cd` AWS Account

```
$ okta_aws chef-cd
```

1. From the `www` directory, run the following command to start the live-reload development environment. When this is running, any changes you make to content in the `www/site` directory will be automatically compiled and updated the browser.
1. From the `www` directory, run the following command to start the live-reload development environment. When this is running, any changes you make to content in the `www/content` directory will be automatically compiled and updated the browser.

```
$ make serve
Expand Down Expand Up @@ -66,65 +48,53 @@ in [Markdown](https://en.wikipedia.org/wiki/Markdown).
.
├── Makefile # contains helpers to quickly start up the development environment
├── README.md
├── chef-sh # hidden directory that contains the pre-compiled source for chef.sh
├── chef-www # chef/chef-www submodule to pull in the chef-sh theme for local development
├── site # the hugo site directory used for local development
├── www # the hugo site directory used for local development
```

### Local Content
```
.
├── site
│   ├── content
│   │   ├── docs
│   │   │   ├── chef-workstation # where to keep markdown file documentation
│   │   ├── workstation # where to keep markdown file documentation
│   ├── data
│   │   ├── chef-workstation # where to keep structured data files used for data templates
│   ├── layouts
| │   ├── shortcodes
| │   │   ├── cw-* # how to name your workstation-specific shortcodes
| │   │   ├── workstation # how to name your workstation-specific shortcodes
| ├── static
| | ├── images
| | | ├── chef-workstation # where to keep any images you need to reference in your documentation
| | ├── css
```

### What is happening behind the scenes

Everytime a PR is merged into `chef/chef-workstation`, the contents of the `chef-workstation` directories from the `site` directory are synced to `chef/chef-www` and the `chef-www-acceptance.cd.chef.co` acceptance environment is automatically updated. This is handled by the Expeditor subscriptions in the `chef/chef-www` GitHub repository.
TODO

## Helpers

make sync
: Pull down the current chef.sh content and chef-hugo-theme submodule. You'll need [okta_aws](https://github.com/chef/okta_aws) configured and have access to the `chef-cd` profile.
make assets
: TODO

make clean
: Reset the locally built site

make serve
: Start the live-reload development environment

## Markdown Content

Please try to keep all your documentation in the `chef-workstation` directory. Any new documents should automatically show up in the sidebar. If you need to control the ordering of the sidebar, you can add `weight` to the frontmatter of the documents.

To add a new Markdown file, simply run the following command from the `www/site` directory:
Please keep all your documentation in the `content/workstation` directory. To add a new Markdown file, simply run the following command from the `www` directory:

```
hugo new docs/chef-workstation/<filename>.md
hugo new content/workstation/<filename>.md
```

This will create the file and fill in the necessary frontmatter automatically.

## Data Content

Hugo allows us to nest our data directory structure as much as necessary. You can add as many folders as necessary under `site/data/chef-workstation`, Expeditor will sync them all into `chef/chef-www`.

```
.
├── site
│   ├── data
│   │   ├── chef-workstation
| │   │   ├── cli
| | │   │   ├── command_one.yml
| | │   │   └── command_two.yml
```
If you add content it will not automatically show up on the sidebar. You can see this by serving the website locally,
going to the root page and search for anything with `Workstation Menu: False`.

## Shortcode Content

Expand Down
4 changes: 2 additions & 2 deletions www/site/archetypes/default.md → www/archetypes/default.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ date = {{ .Date }}
draft = true
weight = 10
[menu]
[menu.docs]
parent = "Chef Workstation"
[menu.workstation]
parent = "chef_workstation"
+++

Loading