Skip to content

Commit e415c00

Browse files
authored
Merge pull request #501 from procore-oss/jh/2.0-docs
Docs with mdbook & Github Pages
2 parents 51581e5 + 3f591e5 commit e415c00

31 files changed

+2201
-2
lines changed

.github/workflows/docs.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Docs - Github Pages
2+
on:
3+
push:
4+
branches:
5+
# - main
6+
- release-2.0
7+
- jh/2.0-docs
8+
paths:
9+
- docs/**
10+
11+
jobs:
12+
deploy:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v2
16+
17+
- name: Setup mdBook
18+
uses: peaceiris/actions-mdbook@v2
19+
with:
20+
mdbook-version: "latest"
21+
22+
- run: mdbook build
23+
24+
- name: Deploy
25+
uses: peaceiris/actions-gh-pages@v3
26+
with:
27+
github_token: ${{ secrets.GITHUB_TOKEN }}
28+
publish_dir: ./docs-dist
29+
publish_branch: docs

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ spec/dummy/db/*.sqlite3-journal
66
spec/dummy/log/*.log
77
spec/dummy/tmp/
88
doc/
9+
docs-dist/
910
.yardoc/
1011
Gemfile.lock
1112
.vscode

book.toml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[book]
2+
authors = ["Procore Technologies, Inc."]
3+
language = "en"
4+
src = "docs"
5+
title = "Blueprinter"
6+
7+
[build]
8+
build-dir = "docs-dist"
9+
10+
# https://rust-lang.github.io/mdBook/format/configuration/renderers.html?highlight=top%20bar#html-renderer-options
11+
[output.html]
12+
additional-css = ["theme/hljs-overrides.css", "theme/custom.css"]
13+
default-theme = "light"
14+
preferred-dark-theme = "navy"
15+
no-section-label = true
16+
git-repository-url = "https://github.com/procore-oss/blueprinter"

docs/SUMMARY.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Summary
2+
3+
- [Introduction](./introduction.md)
4+
5+
- [Blueprinter DSL](./dsl/index.md)
6+
- [Fields](./dsl/fields.md)
7+
- [Views](./dsl/views.md)
8+
- [Partials](./dsl/partials.md)
9+
- [Formatters](./dsl/formatters.md)
10+
- [Options](./dsl/options.md)
11+
- [Extensions](./dsl/extensions.md)
12+
13+
- [Rendering](./rendering.md)
14+
15+
- [Blueprinter API](./api/index.md)
16+
- [Extensions](./api/extensions.md)
17+
- [Reflection](./api/reflection.md)
18+
- [Context Objects](./api/context-objects.md)
19+
- [Fields](./api/fields.md)
20+
21+
---
22+
23+
- [Upgrading](./upgrading/index.md)
24+
- [Configuration](./upgrading/configuration.md)
25+
- [Customization](./upgrading/customization.md)
26+
- [Fields](./upgrading/fields.md)
27+
- [Rendering](./upgrading/rendering.md)
28+
- [Reflection](./upgrading/reflection.md)
29+
- [Extensions](./upgrading/extensions.md)
30+
- [Legacy/V1 Docs](./v1.md)

docs/api/context-objects.md

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
# Context Objects
2+
3+
Context objects are the arguments passed to APIs like [field blocks](../dsl/fields.md#field-blocks), [option procs](../dsl/options.md) and [extension hooks](./extensions.md). There are several kinds of context objects, each with its own set of fields.
4+
5+
## Render Context
6+
7+
_* Field can be assigned._
8+
9+
> **blueprint** \
10+
> The current Blueprint instance. You can use this to access the Blueprint's name, options, reflections, and instance methods.
11+
12+
> **fields** * \
13+
> A frozen array of field definitions that will be serialized, in order. See [Fields API](./fields.md).
14+
15+
> **options** * \
16+
> The frozen options Hash passed to `render`. An empty Hash if none was passed.
17+
18+
> **store** \
19+
> A Hash that can be used to store & access information by extensions and your application.
20+
21+
> **depth** \
22+
> The current blueprint depth (1-indexed).
23+
24+
## Object Context
25+
26+
_* Field can be assigned._
27+
28+
> **blueprint** \
29+
> The current Blueprint instance. You can use this to access the Blueprint's name, options, reflections, and instance methods.
30+
31+
> **fields** \
32+
> A frozen array of field definitions that will be serialized, in order. See [Fields API](./fields.md) and the [blueprint_fields](./extensions.md#blueprint_fields) hook.
33+
34+
> **options** \
35+
> The frozen options Hash passed to `render`. An empty Hash if none was passed.
36+
37+
> **object** * \
38+
> The object or collection currently being serialized.
39+
40+
> **store** \
41+
> A Hash that can be used to store & access information by extensions and your application.
42+
43+
> **depth** \
44+
> The current blueprint depth (1-indexed).
45+
46+
## Field Context
47+
48+
> **blueprint** \
49+
> The current Blueprint instance. You can use this to access the Blueprint's name, options, reflections, and instance methods.
50+
51+
> **fields** \
52+
> A frozen array of field definitions that will be serialized, in order. See [Fields API](./fields.md) and the [blueprint_fields](./extensions.md#blueprint_fields) hook.
53+
54+
> **options** \
55+
> The frozen options Hash passed to `render`. An empty Hash if none was passed.
56+
57+
> **object** \
58+
> The object currently being serialized.
59+
60+
> **field** \
61+
> A struct of the field, object, or collection currently being rendered. You can use this to access the field's name and options. See [Fields API](./fields.md).
62+
63+
> **store** \
64+
> A Hash that can be used to store & access information by extensions and your application.
65+
66+
> **depth** \
67+
> The current blueprint depth (1-indexed).
68+
69+
## Result Context
70+
71+
_* Field can be assigned._
72+
73+
> **blueprint** * \
74+
> The current Blueprint instance. You can use this to access the Blueprint's name, options, reflections, and instance methods.
75+
76+
> **fields** \
77+
> A frozen array of field definitions that were serialized, in order. See [Fields API](./fields.md) and the [around_blueprint_init](./extensions.md#around_blueprint_init) hook.
78+
79+
> **options** * \
80+
> The frozen options Hash passed to `render`. An empty Hash if none was passed.
81+
82+
> **object** * \
83+
> The object or collection that was just serialized.
84+
85+
> **store** \
86+
> A Hash that can be used to store & access information by extensions and your application.
87+
88+
> **format** * \
89+
> The requested serialization format (e.g. `:json`, `:hash`).
90+
91+
## Hook Context
92+
93+
> **blueprint** \
94+
> The current Blueprint instance. You can use this to access the Blueprint's name, options, reflections, and instance methods.
95+
96+
> **fields** \
97+
> A frozen array of field definitions that will be serialized, in order. See [Fields API](./fields.md) and the [around_blueprint_init](./extensions.md#around_blueprint_init) hook.
98+
99+
> **options** \
100+
> The frozen options Hash passed to `render`. An empty Hash if none was passed.
101+
102+
> **extension** \
103+
> Instance of the current extension
104+
105+
> **hook** \
106+
> Name of the current hook
107+
108+
> **store** \
109+
> A Hash that can be used to store & access information by extensions and your application.
110+
111+
> **depth** \
112+
> The current blueprint depth (1-indexed).

0 commit comments

Comments
 (0)