Skip to content

Commit

Permalink
DOC-212 Test out different resource docs layout
Browse files Browse the repository at this point in the history
Signed-off-by: Ian Maddaus <[email protected]>
  • Loading branch information
IanMadd committed Jan 19, 2023
1 parent cd7eac8 commit 8cab572
Show file tree
Hide file tree
Showing 13 changed files with 260 additions and 113 deletions.
3 changes: 1 addition & 2 deletions content/resources/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ description = "This reference describes each of the resources available to Chef
gh_repo = "chef-web-docs"
aliases = ["/resource_reference.html", "/resources.html", "resource_examples.html", "/chef/resources.html"]
data_path = ["infra","resources"]
layout = "infra_resources_all"
toc_layout = "infra_resources_all_toc"

[cascade]
product = ["client"]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
---
resource_reference: true
resources_common_guards: true
resources_common_notification: true
resources_common_properties: true
resource: alternatives
resource_description_list:
- markdown: Use the **alternatives** resource to configure command alternatives in
Linux using the alternatives or update-alternatives packages.
resource_new_in: '16.0'
syntax_full_code_block: |-
alternatives 'name' do
link String # default value: "/usr/bin/LINK_NAME"
Expand All @@ -26,7 +17,7 @@ syntax_full_properties_list:
resource."
actions_list:
:nothing:
shortcode: resources_common_actions_nothing.md
file: content/reusable/md/resources_common_actions_nothing.md
:install:
markdown: Install an alternative on the system including symlinks. (default)
:set:
Expand Down Expand Up @@ -62,52 +53,3 @@ properties_list:
required: false
description_list:
- markdown: The priority of the alternative.
examples: |
**Install an alternative**:
```ruby
alternatives 'python install 2' do
link_name 'python'
path '/usr/bin/python2.7'
priority 100
action :install
end
```
**Set an alternative**:
```ruby
alternatives 'python set version 3' do
link_name 'python'
path '/usr/bin/python3'
action :set
end
```
**Set the automatic alternative state**:
```ruby
alternatives 'python auto' do
link_name 'python'
action :auto
end
```
**Refresh an alternative**:
```ruby
alternatives 'python refresh' do
link_name 'python'
action :refresh
end
```
**Remove an alternative**:
```ruby
alternatives 'python remove' do
link_name 'python'
path '/usr/bin/python3'
action :remove
end
```
48 changes: 48 additions & 0 deletions content/resources/alternatives/examples.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
**Install an alternative**:

```ruby
alternatives 'python install 2' do
link_name 'python'
path '/usr/bin/python2.7'
priority 100
action :install
end
```

**Set an alternative**:

```ruby
alternatives 'python set version 3' do
link_name 'python'
path '/usr/bin/python3'
action :set
end
```

**Set the automatic alternative state**:

```ruby
alternatives 'python auto' do
link_name 'python'
action :auto
end
```

**Refresh an alternative**:

```ruby
alternatives 'python refresh' do
link_name 'python'
action :refresh
end
```

**Remove an alternative**:

```ruby
alternatives 'python remove' do
link_name 'python'
path '/usr/bin/python3'
action :remove
end
```
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,17 @@ draft = false
robots = ""
gh_repo = "chef-web-docs"
data_path = ["infra","resources","alternatives"]
layout = "infra_resource"
toc_layout = "infra_resource_toc"
layout = "infra_resource_test"

resource_reference = true
resources_common_guards = true
resources_common_notification = true
resources_common_properties = true
resource = "alternatives"
resource_new_in = '16.0'
resource_description = [
"content/resources/alternatives/description.md",
]

[menu]
[menu.infra]
Expand Down
2 changes: 2 additions & 0 deletions content/resources/alternatives/resource_description.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Use the **alternatives** resource to configure command alternatives in
Linux using the alternatives or update-alternatives packages.
Original file line number Diff line number Diff line change
@@ -1,23 +1,4 @@
---
resource_reference: true
multi_package_resource: true
resources_common_guards: true
resources_common_notification: true
resources_common_properties: true
resource: apt_package
resource_description_list:
- markdown: Use the **apt_package** resource to manage packages on Debian, Ubuntu,
and other platforms that use the APT package system.
- notes_resource_based_on_package: true
syntax_description: |
An **apt_package** resource block manages a package on a node,
typically by installing it. The simplest use of the **apt_package** resource is:
```ruby
apt_package 'package_name'
```
which will install the named package using all of the default options and the default action of `:install`.
syntax_full_code_block: |-
apt_package 'name' do
default_release String
Expand Down Expand Up @@ -63,6 +44,8 @@ properties_list:
required: false
description_list:
- markdown: 'The default release. For example: `stable`.'
- file: 'content/reusable/md/notes_resource_based_on_package.md'
- markdown: '**TESTING** Additional text for testing. **TESTING** '
- property: options
ruby_type: String, Array
required: false
Expand Down Expand Up @@ -107,34 +90,6 @@ properties_list:
- markdown: The amount of time (in seconds) to wait before timing out.
- property: version
ruby_type: String, Array
required: false
required: true
description_list:
- markdown: The version of a package to be installed or upgraded.
examples: |
**Install a package using package manager**:
```ruby
apt_package 'name of package' do
action :install
end
```
**Install a package without specifying the default action**:
```ruby
apt_package 'name of package'
```
**Install multiple packages at once**:
```ruby
apt_package %w(package1 package2 package3)
```
**Install without using recommend packages as a dependency**:
```ruby
package 'apache2' do
options '--no-install-recommends'
end
```
27 changes: 27 additions & 0 deletions content/resources/apt_package/examples.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
**Install a package using package manager**:

```ruby
apt_package 'name of package' do
action :install
end
```

**Install a package without specifying the default action**:

```ruby
apt_package 'name of package'
```

**Install multiple packages at once**:

```ruby
apt_package %w(package1 package2 package3)
```

**Install without using recommend packages as a dependency**:

```ruby
package 'apache2' do
options '--no-install-recommends'
end
```
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,19 @@ draft = false
robots = ""
gh_repo = "chef-web-docs"
data_path = ["infra","resources","apt_package"]
layout = "infra_resource"
toc_layout = "infra_resource_toc"
layout = "infra_resource_test"

resource_reference = true
multi_package_resource = true
resources_common_guards = true
resources_common_notification = true
resources_common_properties = true
resource = "apt_package"

resource_description = [
"content/resources/apt_package/description.md",
"content/reusable/md/notes_resource_based_on_package.md"
]

[menu]
[menu.infra]
Expand Down
2 changes: 2 additions & 0 deletions content/resources/apt_package/resource_description.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Use the **apt_package** resource to manage packages on Debian, Ubuntu,
and other platforms that use the APT package system.
8 changes: 8 additions & 0 deletions content/resources/apt_package/syntax_description.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
An **apt_package** resource block manages a package on a node,
typically by installing it. The simplest use of the **apt_package** resource is:

```ruby
apt_package 'package_name'
```

which will install the named package using all of the default options and the default action of `:install`.
6 changes: 6 additions & 0 deletions content/reusable/md/notes_resource_based_on_package.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
In many cases, it is better to use the **package** resource instead of
this one. This is because when the **package** resource is used in a
recipe, Chef Infra Client will use details that are collected by Ohai at
the start of a Chef Infra Client run to determine the correct package
application. Using the **package** resource allows a recipe to be
authored in a way that allows it to be used across many platforms.
3 changes: 3 additions & 0 deletions content/reusable/md/resources_common_actions_nothing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This resource block does not act unless notified by another resource to
take action. Once notified, this resource block either runs immediately
or is queued up to run at the end of a Chef Infra Client run.
Loading

0 comments on commit 8cab572

Please sign in to comment.