Skip to content

Commit 0019acb

Browse files
author
Luke Sneeringer
authored
refactor: Replace Jekyll, support piecemeal AIP format. (aip-dev#540)
refactor: Replace Jekyll, support piecemeal AIP format.
1 parent ef21104 commit 0019acb

File tree

176 files changed

+923
-4905
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

176 files changed

+923
-4905
lines changed

.dockerignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66
Dockerfile
77
.dockerignore
88

9-
# Ruby & Jekyll scaffolding
10-
_site
11-
129
# Translations
1310
*.mo
1411

.github/workflows/publish.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
name: publish
3+
on:
4+
push:
5+
branches: master
6+
jobs:
7+
github-pages:
8+
runs-on: ubuntu-latest
9+
container: python:3.8
10+
steps:
11+
- uses: actions/checkout@v2
12+
- name: Install system dependencies.
13+
run: apt-get update && apt-get install -y rsync
14+
- name: Install the site generator.
15+
run: pip install -r requirements.txt
16+
- name: Build the static site.
17+
run: aip-site-gen . out
18+
- name: Publish the static site to GitHub Pages.
19+
uses: jamesives/github-pages-deploy-action@releases/v3
20+
with:
21+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
22+
BRANCH: gh-pages
23+
FOLDER: out

.github/workflows/test.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
name: test
3+
on:
4+
pull_request:
5+
branches: master
6+
jobs:
7+
build:
8+
runs-on: ubuntu-latest
9+
container: python:3.8
10+
steps:
11+
- uses: actions/checkout@v2
12+
- name: Install the site-generator
13+
run: pip install -r requirements.txt
14+
- name: Build the site.
15+
run: aip-site-gen . /out

.gitignore

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
# Jekyll
2-
default.profraw
3-
_site
4-
.jekyll-metadata
1+
# pytest
2+
site/.coverage
3+
site/.pytest_cache
4+
site/htmlcov
55

6-
# npm
7-
node_modules/
8-
*/package-lock.json
6+
# mypy
7+
.mypy_cache

CONTRIBUTING.md

Lines changed: 22 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ We'd love to accept your patches and contributions to this project.
44

55
## Development Environment
66

7-
If you are contributing documentation (rather than samples) and want to be able
8-
to view it in your browser, the easiest way to do so is to run the provided
7+
If you are contributing AIP content (rather than code) and want to be able to
8+
view it in your browser, the easiest way to do so is to run the provided
99
development server.
1010

11-
We use [GitHub Pages][1] to make this documentation available, which uses
12-
[Jekyll][2] under the hood.
11+
We use [GitHub Pages][1] to make this documentation available, and a specific
12+
[site generator][2] to build the site.
1313

1414
If you have [Docker][3] installed, clone this repository and run the `serve.sh`
1515
file at the root of the repository. This script does two things:
@@ -18,45 +18,35 @@ file at the root of the repository. This script does two things:
1818
as `aip-site`.
1919
- It runs the `aip-site` image.
2020

21-
The Jekyll development server uses port 4000 by default; point your web browser
22-
to `http://localhost:4000`, and you should see the site.
21+
The development server uses port 4000; point your web browser to
22+
`http://localhost:4000`, and you should see the site.
2323

2424
**Note:** After building the Docker image for the first time, you may
25-
experience issues if Ruby dependencies change underneath you. If this happens,
26-
remove your Docker image (`docker rmi aip-site`) and run `serve.sh` again.
25+
experience issues if Python dependencies change underneath you. If this
26+
happens, remove your Docker image (`docker rmi aip-site`) and run `serve.sh`
27+
again.
2728

2829
### Arguments
2930

30-
Any arguments provided to `serve.sh` (or `docker run`) are forwarded to Jekyll.
31-
Note that the Docker entrypoint automatically provides `--destination` and
32-
`--host` arguments, and you should not change these. Additionally, changing
33-
ports is not advised (call `docker run` yourself with a customized `-p` switch
34-
if you need to use custom ports).
31+
Any arguments provided to `serve.sh` (or `docker run`) are forwarded (however,
32+
the current site generator does not honor any; this may change in the future).
3533

3634
### Hot reloading
3735

38-
The Jekyll development server supports "hot reloading" (where local changes
39-
will be automatically reflected in your browser without having to manually
40-
reload). You can activate this by sending the `--livereload` flag (`-l` for
41-
short) to `serve.sh`.
36+
The development server recognizes when files change (including static files)
37+
and local changes will be automatically reflected in your browser upon reload.
4238

4339
### Local Installation
4440

4541
It is possible to run the development server locally also. The general gist of
4642
how to do so correctly is:
4743

48-
- Install [rbenv](https://github.com/rbenv/rbenv).
49-
- Use rbenv to install an appropriate version of Ruby.
50-
- `gem install bundler`
51-
- `bundle install`
52-
53-
Once this is done, you can run `bundle exec jekyll serve` to run the
54-
development server (as above, include `--livereload` to get automatic
55-
reloading).
56-
57-
**Note:** The Jekyll default setup will write the static site in-place to the
58-
`_site` subdirectory. (The Docker image redirects this to an arbitrary spot in
59-
the image so as not to pollute the local disk.)
44+
- Install Python 3.8 if you do not already have it (direct install is fine, but
45+
[pyenv][5] is probably the best way if you have other Python projects).
46+
- Create a Python 3.8 [venv][6]. Once it is created, activate it in your shell
47+
(`source path/to/venv/bin/activate`).
48+
- `pip install git+https://github.com/aip-dev/site-generator.git`
49+
- `aip-site-serve .`
6050

6151
## Contributor License Agreement
6252

@@ -84,6 +74,8 @@ to ensure a consistent style throughout our source. You can add prettier as a
8474
plugin in most development environments.
8575

8676
[1]: https://pages.github.com/
87-
[2]: https://jekyllrb.com/
77+
[2]: https://github.com/aip-dev/site-generator
8878
[3]: https://docker.com/
8979
[4]: https://prettier.io/
80+
[5]: https://github.com/pyenv/pyenv
81+
[6]: https://docs.python.org/3/library/venv.html

Dockerfile

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,23 @@
1-
FROM ruby:2.6-alpine
1+
FROM python:3.8-alpine
22

3-
# Copy the existing code into the Docker image.
4-
#
5-
# This will copy everything *at build time* (not at runtime), so it is
6-
# still important to use `--mount` to get a reasonable development loop.
7-
# This makes the image work for both purposes, though.
8-
COPY . /code/
3+
# Define the working directory.
4+
# Note: There is no code here; it is pulled from the repository by mounting
5+
# the directory (see `serve.sh`).
96
WORKDIR /code/
107

11-
# Install bundler and gems for this project.
12-
RUN echo "gem: --no-ri --no-rdoc" > ~/.gemrc && \
13-
apk add --no-cache alpine-sdk && \
14-
gem update --system && \
15-
gem install bundler && \
16-
bundle install && \
17-
apk del --no-cache alpine-sdk && \
18-
rm ~/.gemrc
8+
# Install Python packages for this project.
9+
COPY requirements.txt /code/requirements.txt
10+
RUN apk add git && \
11+
pip install -r requirements.txt && \
12+
apk del git
1913

20-
# Install git. (Jekyll expects it.)
21-
RUN apk add --no-cache git
14+
# Set environment variables.
15+
ENV FLASK_ENV development
2216

2317
# Expose appropriate ports.
2418
EXPOSE 4000
2519
EXPOSE 35729
2620

27-
# Run Jekyll's dev server.
28-
# Reminder: Use -p with `docker run` to publish ports.
29-
ENTRYPOINT ["bundle", "exec", "jekyll", "serve", \
30-
"--destination", "/site", \
31-
"--host", "0.0.0.0"]
21+
# Run the development server.
22+
# Reminder: Use -p with `docker run` to publish ports (see `serve.sh`).
23+
ENTRYPOINT ["aip-site-serve", "."]

Gemfile

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)