Skip to content

Commit 8cab572

Browse files
committed
DOC-212 Test out different resource docs layout
Signed-off-by: Ian Maddaus <[email protected]>
1 parent cd7eac8 commit 8cab572

13 files changed

+260
-113
lines changed

content/resources/_index.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ description = "This reference describes each of the resources available to Chef
55
gh_repo = "chef-web-docs"
66
aliases = ["/resource_reference.html", "/resources.html", "resource_examples.html", "/chef/resources.html"]
77
data_path = ["infra","resources"]
8-
layout = "infra_resources_all"
9-
toc_layout = "infra_resources_all_toc"
8+
109
[cascade]
1110
product = ["client"]
1211

Original file line numberDiff line numberDiff line change
@@ -1,13 +1,4 @@
11
---
2-
resource_reference: true
3-
resources_common_guards: true
4-
resources_common_notification: true
5-
resources_common_properties: true
6-
resource: alternatives
7-
resource_description_list:
8-
- markdown: Use the **alternatives** resource to configure command alternatives in
9-
Linux using the alternatives or update-alternatives packages.
10-
resource_new_in: '16.0'
112
syntax_full_code_block: |-
123
alternatives 'name' do
134
link String # default value: "/usr/bin/LINK_NAME"
@@ -26,7 +17,7 @@ syntax_full_properties_list:
2617
resource."
2718
actions_list:
2819
:nothing:
29-
shortcode: resources_common_actions_nothing.md
20+
file: content/reusable/md/resources_common_actions_nothing.md
3021
:install:
3122
markdown: Install an alternative on the system including symlinks. (default)
3223
:set:
@@ -62,52 +53,3 @@ properties_list:
6253
required: false
6354
description_list:
6455
- markdown: The priority of the alternative.
65-
examples: |
66-
**Install an alternative**:
67-
68-
```ruby
69-
alternatives 'python install 2' do
70-
link_name 'python'
71-
path '/usr/bin/python2.7'
72-
priority 100
73-
action :install
74-
end
75-
```
76-
77-
**Set an alternative**:
78-
79-
```ruby
80-
alternatives 'python set version 3' do
81-
link_name 'python'
82-
path '/usr/bin/python3'
83-
action :set
84-
end
85-
```
86-
87-
**Set the automatic alternative state**:
88-
89-
```ruby
90-
alternatives 'python auto' do
91-
link_name 'python'
92-
action :auto
93-
end
94-
```
95-
96-
**Refresh an alternative**:
97-
98-
```ruby
99-
alternatives 'python refresh' do
100-
link_name 'python'
101-
action :refresh
102-
end
103-
```
104-
105-
**Remove an alternative**:
106-
107-
```ruby
108-
alternatives 'python remove' do
109-
link_name 'python'
110-
path '/usr/bin/python3'
111-
action :remove
112-
end
113-
```
+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
**Install an alternative**:
2+
3+
```ruby
4+
alternatives 'python install 2' do
5+
link_name 'python'
6+
path '/usr/bin/python2.7'
7+
priority 100
8+
action :install
9+
end
10+
```
11+
12+
**Set an alternative**:
13+
14+
```ruby
15+
alternatives 'python set version 3' do
16+
link_name 'python'
17+
path '/usr/bin/python3'
18+
action :set
19+
end
20+
```
21+
22+
**Set the automatic alternative state**:
23+
24+
```ruby
25+
alternatives 'python auto' do
26+
link_name 'python'
27+
action :auto
28+
end
29+
```
30+
31+
**Refresh an alternative**:
32+
33+
```ruby
34+
alternatives 'python refresh' do
35+
link_name 'python'
36+
action :refresh
37+
end
38+
```
39+
40+
**Remove an alternative**:
41+
42+
```ruby
43+
alternatives 'python remove' do
44+
link_name 'python'
45+
path '/usr/bin/python3'
46+
action :remove
47+
end
48+
```

content/resources/alternatives.md renamed to content/resources/alternatives/index.md

+11-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,17 @@ draft = false
44
robots = ""
55
gh_repo = "chef-web-docs"
66
data_path = ["infra","resources","alternatives"]
7-
layout = "infra_resource"
8-
toc_layout = "infra_resource_toc"
7+
layout = "infra_resource_test"
8+
9+
resource_reference = true
10+
resources_common_guards = true
11+
resources_common_notification = true
12+
resources_common_properties = true
13+
resource = "alternatives"
14+
resource_new_in = '16.0'
15+
resource_description = [
16+
"content/resources/alternatives/description.md",
17+
]
918

1019
[menu]
1120
[menu.infra]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Use the **alternatives** resource to configure command alternatives in
2+
Linux using the alternatives or update-alternatives packages.

data/infra/resources/apt_package.yaml renamed to content/resources/apt_package/data.yaml

+3-48
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,4 @@
11
---
2-
resource_reference: true
3-
multi_package_resource: true
4-
resources_common_guards: true
5-
resources_common_notification: true
6-
resources_common_properties: true
7-
resource: apt_package
8-
resource_description_list:
9-
- markdown: Use the **apt_package** resource to manage packages on Debian, Ubuntu,
10-
and other platforms that use the APT package system.
11-
- notes_resource_based_on_package: true
12-
syntax_description: |
13-
An **apt_package** resource block manages a package on a node,
14-
typically by installing it. The simplest use of the **apt_package** resource is:
15-
16-
```ruby
17-
apt_package 'package_name'
18-
```
19-
20-
which will install the named package using all of the default options and the default action of `:install`.
212
syntax_full_code_block: |-
223
apt_package 'name' do
234
default_release String
@@ -63,6 +44,8 @@ properties_list:
6344
required: false
6445
description_list:
6546
- markdown: 'The default release. For example: `stable`.'
47+
- file: 'content/reusable/md/notes_resource_based_on_package.md'
48+
- markdown: '**TESTING** Additional text for testing. **TESTING** '
6649
- property: options
6750
ruby_type: String, Array
6851
required: false
@@ -107,34 +90,6 @@ properties_list:
10790
- markdown: The amount of time (in seconds) to wait before timing out.
10891
- property: version
10992
ruby_type: String, Array
110-
required: false
93+
required: true
11194
description_list:
11295
- markdown: The version of a package to be installed or upgraded.
113-
examples: |
114-
**Install a package using package manager**:
115-
116-
```ruby
117-
apt_package 'name of package' do
118-
action :install
119-
end
120-
```
121-
122-
**Install a package without specifying the default action**:
123-
124-
```ruby
125-
apt_package 'name of package'
126-
```
127-
128-
**Install multiple packages at once**:
129-
130-
```ruby
131-
apt_package %w(package1 package2 package3)
132-
```
133-
134-
**Install without using recommend packages as a dependency**:
135-
136-
```ruby
137-
package 'apache2' do
138-
options '--no-install-recommends'
139-
end
140-
```
+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
**Install a package using package manager**:
2+
3+
```ruby
4+
apt_package 'name of package' do
5+
action :install
6+
end
7+
```
8+
9+
**Install a package without specifying the default action**:
10+
11+
```ruby
12+
apt_package 'name of package'
13+
```
14+
15+
**Install multiple packages at once**:
16+
17+
```ruby
18+
apt_package %w(package1 package2 package3)
19+
```
20+
21+
**Install without using recommend packages as a dependency**:
22+
23+
```ruby
24+
package 'apache2' do
25+
options '--no-install-recommends'
26+
end
27+
```

content/resources/apt_package.md renamed to content/resources/apt_package/index.md

+13-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,19 @@ draft = false
44
robots = ""
55
gh_repo = "chef-web-docs"
66
data_path = ["infra","resources","apt_package"]
7-
layout = "infra_resource"
8-
toc_layout = "infra_resource_toc"
7+
layout = "infra_resource_test"
8+
9+
resource_reference = true
10+
multi_package_resource = true
11+
resources_common_guards = true
12+
resources_common_notification = true
13+
resources_common_properties = true
14+
resource = "apt_package"
15+
16+
resource_description = [
17+
"content/resources/apt_package/description.md",
18+
"content/reusable/md/notes_resource_based_on_package.md"
19+
]
920

1021
[menu]
1122
[menu.infra]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Use the **apt_package** resource to manage packages on Debian, Ubuntu,
2+
and other platforms that use the APT package system.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
An **apt_package** resource block manages a package on a node,
2+
typically by installing it. The simplest use of the **apt_package** resource is:
3+
4+
```ruby
5+
apt_package 'package_name'
6+
```
7+
8+
which will install the named package using all of the default options and the default action of `:install`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
In many cases, it is better to use the **package** resource instead of
2+
this one. This is because when the **package** resource is used in a
3+
recipe, Chef Infra Client will use details that are collected by Ohai at
4+
the start of a Chef Infra Client run to determine the correct package
5+
application. Using the **package** resource allows a recipe to be
6+
authored in a way that allows it to be used across many platforms.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
This resource block does not act unless notified by another resource to
2+
take action. Once notified, this resource block either runs immediately
3+
or is queued up to run at the end of a Chef Infra Client run.

0 commit comments

Comments
 (0)