Skip to content

Commit 725caa0

Browse files
authored
Merge pull request #54 from justwriteclick/add-contrib
Add contributing and building instructions
2 parents 51b42b6 + 542e257 commit 725caa0

1 file changed

Lines changed: 135 additions & 20 deletions

File tree

README.md

Lines changed: 135 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,145 @@
11
# Docs Like Code
22

3-
## Us...
3+
## The Website
44

5-
I've been using "docs like code" techniques for multiple projects in
6-
multiple contexts from open source software docs to blog posts to
7-
enterprise documentation sites.
5+
This website is intended to offer stories and articles about how to treat docs like code, and lessons learned along the way.
86

9-
## You...
10-
I know you. You want to learn and experiment with improving documentation by
11-
changing the way you think about docs? Then here is your opportunity to
12-
prove you can moderinize your docs.
7+
## To Contribute
138

14-
You need to know about docs like code, what is it? Why would you apply the
15-
techniques behind docs like code? You need a tutorial and a quick set
16-
of wins to prove to yourself and your team that your docs are ready
17-
for a new mindset, a new toolset, and a new docset. Let's go.
9+
You can directly submit a pull request using the fork-and-pull workflow to add an article, or submit to the [justwriteclick/docs-like-code-stories](https://github.com/justwriteclick/docs-like-code-stories) repo if you want to follow a question-and-answer template.
1810

19-
## Notes
11+
## Theme Colophon
12+
Theme courtesy of https://mmistakes.github.io/so-simple-theme/
2013

21-
To Setup a custom domain for a gh-pages Project Pages repo that handles www.yourdomain.com and yourdomain.com (assumes you already have a gh-pages branch on your repo):
14+
## To Build Locally (Mac only)
2215

23-
From your project repo, gh-pages branch. Create a CNAME file with the contents yourdomain.com. Commit then push.
24-
In your DNS manager, setup two cname records. One for the root apex (@) and one for www. Both point to YOURusername.github.io. If your DNS provider does NOT support ALIAS records on the root apex (@), simply create A records that point to 192.30.252.153 and 192.30.252.154
25-
Wait til your name servers update:
16+
Test your additions and changes to content by running a local build.
2617

27-
dig yourdomain.com +nostats +nocomments +nocmd
18+
To prepare your environment to build locally, you need to install brew, bundler.io, and Ruby version manager:
2819

29-
## Theme Colophon
30-
Theme courtesy of https://mmistakes.github.io/so-simple-theme/
20+
1. Use brew to install a Ruby version manager.
21+
22+
```
23+
$ brew install rbenv ruby-build
24+
```
25+
26+
1. Add rbenv to bash so that it loads every time you open a terminal.
27+
28+
```
29+
$ echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.bash_profile
30+
```
31+
32+
1. Source your `.bash_profile` file.
33+
34+
```
35+
$ source ~/.bash_profile
36+
```
37+
38+
1. Install the version Ruby we need:
39+
40+
```
41+
$ rbenv install 2.3.1
42+
$ rbenv global 2.3.1
43+
$ ruby -v
44+
```
45+
46+
1. Run `gem install bundle` to install the bundler gem, which helps with Ruby dependencies.
47+
1. Run `bundle install` the first time you are in the `docslikecode` directory.
48+
49+
To build locally:
50+
Once you have completed preparing your environment, then you can build locally and review the site in your browser.
51+
52+
1. Run the serve command.
53+
54+
```
55+
$ bundle exec jekyll serve
56+
```
57+
58+
1. Use the **Server address** URL `http://127.0.0.1:4000/` in a browser to preview the content.
59+
1. Press `Ctrl+C` in the serve terminal to stop the server.
60+
61+
> ***TIP***
62+
> Leave the serve terminal open and running. Every time you save changes to a file, it automatically regenerates the site so you can test the output immediately. The only file where changes require a restart is the `_config.yml` file.
63+
64+
## To build locally (Docker required)
65+
66+
1. Install Docker Community Version.
67+
68+
2. In the root directory where the `docslikecode` repo is cloned, create a file named `Dockerfile` containing:
69+
70+
```
71+
FROM grahamc/jekyll:latest
72+
73+
# Install whatever is in your Gemfile
74+
WORKDIR /tmp
75+
ADD Gemfile /tmp/
76+
ADD Gemfile.lock /tmp/
77+
RUN bundle install
78+
79+
# Change back to the Jekyll site directory
80+
WORKDIR /src
81+
82+
```
83+
3. Create a `_config.dev.yml` file, also in the root directory, containing the following:
84+
85+
```
86+
# Develop override settings
87+
# Use when building with Docker container and preview.sh script locally
88+
89+
url : http://192.168.99.100:4000
90+
91+
# Analytics
92+
analytics:
93+
provider : false
94+
```
95+
96+
4. Create a `preview.sh` file, also in the root directory, containing the following:
97+
98+
```
99+
#!/usr/bin/env bash
100+
101+
# Set to the name of the Docker machine you want to use
102+
DOCKER_MACHINE_NAME=default
103+
104+
# Set to the name of the Docker image you want to use
105+
DOCKER_IMAGE_NAME=dlc-site
106+
107+
# Stop on first error
108+
set -e
109+
110+
# Create a Docker host
111+
if !(docker-machine ls | grep "^$DOCKER_MACHINE_NAME "); then
112+
docker-machine create --driver virtualbox $DOCKER_MACHINE_NAME
113+
fi
114+
115+
# Start the host
116+
if (docker-machine ls | grep "^$DOCKER_MACHINE_NAME .* Stopped"); then
117+
docker-machine start $DOCKER_MACHINE_NAME
118+
fi
119+
120+
# Load your Docker host's environment variables
121+
eval $(docker-machine env $DOCKER_MACHINE_NAME)
122+
123+
if [ -e Dockerfile ]; then
124+
# Build a custom Docker image that has custom Jekyll plug-ins installed
125+
docker build --tag $DOCKER_IMAGE_NAME --file Dockerfile .
126+
127+
# Remove dangling images from previous runs
128+
docker rmi -f $(docker images --filter "dangling=true" -q) > /dev/null 2>&1 || true
129+
else
130+
# Use an existing Jekyll Docker image
131+
DOCKER_IMAGE_NAME=grahamc/jekyll
132+
fi
133+
134+
echo "***********************************************************"
135+
echo " Your site will be available at http://$(docker-machine ip $DOCKER_MACHINE_NAME):4000"
136+
echo "***********************************************************"
137+
138+
# Start Jekyll and watch for changes
139+
docker run --rm \
140+
-e JEKYLL_ENV=production \
141+
--volume=/$(pwd):/src \
142+
--publish 4000:4000 \
143+
$DOCKER_IMAGE_NAME \
144+
serve --watch --drafts --force_polling -H 0.0.0.0
145+
```

0 commit comments

Comments
 (0)