Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .fixtures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ fixtures:
repo: "puppetlabs/stdlib"
vcsrepo:
repo: "puppetlabs/vcsrepo"
ref: "5.5.0"
repositories:
wget: "https://github.com/rehanone/puppet-wget.git"
symlinks:
Expand Down
299 changes: 299 additions & 0 deletions REFERENCE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,299 @@
# Reference

<!-- DO NOT EDIT: This document was generated by Puppet Strings -->

## Table of Contents

### Classes

* [`ohmyzsh`](#ohmyzsh): Install and configure Oh-My-ZSH

### Defined types

#### Public Defined types

* [`ohmyzsh::fetch::theme`](#ohmyzshfetchtheme): Install a theme from a defined source
* [`ohmyzsh::install`](#ohmyzshinstall): Install and configure Oh-My-ZSH for an user
* [`ohmyzsh::plugins`](#ohmyzshplugins): Install and configure Oh-My-ZSH plugins for an user
* [`ohmyzsh::profile`](#ohmyzshprofile): Configure the ZSH profile for an user
* [`ohmyzsh::theme`](#ohmyzshtheme): Configure the ZSH theme for an user

#### Private Defined types

* `ohmyzsh::install::classic`: Manage the zsh file with the original mode (file copy from the repository)
* `ohmyzsh::install::concat`: Manage the zsh file with concat

## Classes

### <a name="ohmyzsh"></a>`ohmyzsh`

This is the ohmyzsh module. It creates a profile directory under user home and allows
custom scripts to setup and made avalible on the path.

This module is called ohmyzsh as Puppet does not support hyphens in module
names.

View README.md for full documentation.

#### Parameters

The following parameters are available in the `ohmyzsh` class:

* [`source`](#source)
* [`home`](#home)
* [`zsh_shell_path`](#zsh_shell_path)
* [`installs`](#installs)
* [`themes`](#themes)
* [`plugins`](#plugins)
* [`profiles`](#profiles)
* [`concat`](#concat)

##### <a name="source"></a>`source`

Data type: `Stdlib::Httpsurl`

Oh-My-ZSH repository. See data/ for the default value.

##### <a name="home"></a>`home`

Data type: `Stdlib::Absolutepath`

Default home base directory. See data/ for the default value.

##### <a name="zsh_shell_path"></a>`zsh_shell_path`

Data type: `Stdlib::Absolutepath`

Path of the zsh executable. See data/ for the default value.

##### <a name="installs"></a>`installs`

Data type: `Hash`

Install and configure Oh-My-ZSH for users defined in this hash. See data/ for the default value.

##### <a name="themes"></a>`themes`

Data type: `Hash`

Configure the themes for users defined in this hash. See data/ for the default value.

##### <a name="plugins"></a>`plugins`

Data type: `Hash`

Configure the plugins for users defined in this hash. See data/ for the default value.

##### <a name="profiles"></a>`profiles`

Data type: `Hash`

Configure the profile for users defined in this hash. See data/ for the default value.

##### <a name="concat"></a>`concat`

Data type: `Boolean`

Use the concat module to manage .zshrc files.

## Defined types

### <a name="ohmyzshfetchtheme"></a>`ohmyzsh::fetch::theme`

Install a theme from a defined source

#### Parameters

The following parameters are available in the `ohmyzsh::fetch::theme` defined type:

* [`url`](#url)
* [`source`](#source)
* [`content`](#content)
* [`filename`](#filename)
* [`revision`](#revision)
* [`depth`](#depth)

##### <a name="url"></a>`url`

Data type: `Optional[Stdlib::Httpurl]`

The URL of the git repository (if `source` is `git`) or to the file

Default value: ``undef``

##### <a name="source"></a>`source`

Data type: `Optional[String]`

`git` for a repository, `undef` for a file to download or the source to pass to Puppet `file`

Default value: ``undef``

##### <a name="content"></a>`content`

Data type: `Optional[String]`

The content to pass to Puppet `file`, only if `source` and `url` is unset.

Default value: ``undef``

##### <a name="filename"></a>`filename`

Data type: `Optional[String]`

The file name to use while saving the theme

Default value: ``undef``

##### <a name="revision"></a>`revision`

Data type: `Optional[String]`

Revision to checkout while using Git

Default value: ``undef``

##### <a name="depth"></a>`depth`

Data type: `Optional[Integer]`

Controls the shallow clone for Git

Default value: ``undef``

### <a name="ohmyzshinstall"></a>`ohmyzsh::install`

Install and configure Oh-My-ZSH for an user

#### Parameters

The following parameters are available in the `ohmyzsh::install` defined type:

* [`ensure`](#ensure)
* [`set_sh`](#set_sh)
* [`update_zshrc`](#update_zshrc)
* [`backup_zshrc`](#backup_zshrc)
* [`auto_update_mode`](#auto_update_mode)
* [`auto_update_frequency`](#auto_update_frequency)

##### <a name="ensure"></a>`ensure`

Data type: `Enum[present, latest]`

Controls the way the Oh-My-ZSH repository is managed by Puppet.

Default value: `latest`

##### <a name="set_sh"></a>`set_sh`

Data type: `Boolean`

Controls whether to change the user shell to zsh.

Default value: ``false``

##### <a name="update_zshrc"></a>`update_zshrc`

Data type: `Enum[always, disabled, sync]`

Controls the update of .zshrc from the upstream template.

Default value: `disabled`

##### <a name="backup_zshrc"></a>`backup_zshrc`

Data type: `Boolean`

Controls if a backup of .zshrc need to be sone before changes.

Default value: ``true``

##### <a name="auto_update_mode"></a>`auto_update_mode`

Data type: `Enum[auto, disabled, reminder]`

Controls the update check for oh-my-zsh.

Default value: `disabled`

##### <a name="auto_update_frequency"></a>`auto_update_frequency`

Data type: `Integer[0]`

Controls the update check frequency.

Default value: `14`

### <a name="ohmyzshplugins"></a>`ohmyzsh::plugins`

Install and configure Oh-My-ZSH plugins for an user

#### Parameters

The following parameters are available in the `ohmyzsh::plugins` defined type:

* [`plugins`](#plugins)
* [`custom_plugins`](#custom_plugins)

##### <a name="plugins"></a>`plugins`

Data type: `Array[String]`

List of built-in plugins.

Default value: `['git']`

##### <a name="custom_plugins"></a>`custom_plugins`

Data type: `Hash[String,
Struct[
{
source => Enum[git],
url => Stdlib::Httpsurl,
ensure => Enum[present, latest],
revision => Optional[String],
depth => Optional[Integer]
}
]
]`

List of plugins to install and use.

Default value: `{}`

### <a name="ohmyzshprofile"></a>`ohmyzsh::profile`

Configure the ZSH profile for an user

#### Parameters

The following parameters are available in the `ohmyzsh::profile` defined type:

* [`scripts`](#scripts)

##### <a name="scripts"></a>`scripts`

Data type: `Hash[String[1], Stdlib::Filesource]`

A hash of name => paths to all the scripts.

Default value: `{}`

### <a name="ohmyzshtheme"></a>`ohmyzsh::theme`

Configure the ZSH theme for an user

#### Parameters

The following parameters are available in the `ohmyzsh::theme` defined type:

* [`theme`](#theme)

##### <a name="theme"></a>`theme`

Data type: `String`

The name of the theme to use.

Default value: `'clean'`

1 change: 1 addition & 0 deletions data/common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ ohmyzsh::installs: {}
ohmyzsh::themes: {}
ohmyzsh::plugins: {}
ohmyzsh::profiles: {}
ohmyzsh::concat: false
38 changes: 38 additions & 0 deletions examples/concat-with-local-overrides.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
class { 'ohmyzsh':
concat => true,
}

# for a single user
ohmyzsh::install { 'root':
set_sh => true,
auto_update_mode => reminder,
auto_update_frequency => 7,
}

file { '/root/.zshrc.local':
ensure => file,
replace => 'no',
owner => 'root',
group => 'root',
mode => '0644',
content => "# Use this file to customize ZSH, it's not managed by Puppet",
}

concat::fragment { '/root/.zshrc:puppet':
target => '/root/.zshrc',
content => "### Use the file ~/.zshrc.local for your changes\n",
order => '000',
}

concat::fragment { '/root/.zshrc:load-local':
target => '/root/.zshrc',
content => @("EOF"/L)
# Load local zshrc if exist
if [ -f ~/.zshrc.local ]
then
source ~/.zshrc.local
fi
| EOF
,
order => '099',
}
43 changes: 43 additions & 0 deletions examples/concat-with-powerlevel10k.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
class { 'ohmyzsh':
concat => true,
}

# for a single user
ohmyzsh::install { 'root':
set_sh => true,
auto_update_mode => reminder,
auto_update_frequency => 7,
}

ohmyzsh::fetch::theme { 'root':
filename => 'powerlevel10k',
source => 'git',
depth => 1,
url => 'https://github.com/romkatv/powerlevel10k.git',
}

ohmyzsh::theme { 'root':
theme => 'powerlevel10k/powerlevel10k',
}

ohmyzsh::plugins { 'root':
plugins => ['git', 'github'],
}

file { '/root/.p10k.zsh':
owner => 'root',
group => 'root',
content => 'YOUR P10K CONFIGURATION FILE',
}

concat::fragment { '/root/.zshrc:p10k-instant-prompt':
target => '/root/.zshrc',
content => 'YOUR P10K INSTANT PROMPT SNIPPET',
order => '005',
}

concat::fragment { '/root/.zshrc:p10k-load':
target => '/root/.zshrc',
content => "[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh\n",
order => '095',
}
1 change: 1 addition & 0 deletions files/concat/zshrc-000-header.zsh-template
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
### This file is managed by Puppet, any changes will be lost
Loading