Merge branch 'kelvix-feat/puppet'
This commit is contained in:
commit
5a0d37f5d7
|
@ -36,6 +36,7 @@ before_install:
|
|||
# - gem install ruby-beautify --verbose
|
||||
- gem install rubocop
|
||||
- gem install htmlbeautifier
|
||||
- gem install puppet-lint
|
||||
# Python language support
|
||||
- brew install python
|
||||
- pip install --upgrade autopep8
|
||||
|
|
|
@ -85,6 +85,9 @@ install:
|
|||
# HTMLBeautifier
|
||||
- gem install htmlbeautifier
|
||||
- where htmlbeautifier
|
||||
# Puppet-Lint
|
||||
- gem install puppet-lint
|
||||
- where puppet-lint
|
||||
|
||||
# emacs
|
||||
- cinst emacs -y
|
||||
|
|
127
docs/options.md
127
docs/options.md
|
@ -273,6 +273,34 @@ If lists of assignments or properties should be vertically aligned for faster an
|
|||
|
||||
Path to uncrustify config file. i.e. uncrustify.cfg (Supported by Uncrustify)
|
||||
|
||||
#### [gherkin - Indent size](#gherkin---indent-size)
|
||||
|
||||
**Key**: `gherkin_indent_size`
|
||||
|
||||
**Default**: `4`
|
||||
|
||||
**Type**: `integer`
|
||||
|
||||
**Supported Beautifiers**: [`Gherkin formatter`](#gherkin-formatter)
|
||||
|
||||
**Description**:
|
||||
|
||||
Indentation size/length (Supported by Gherkin formatter)
|
||||
|
||||
#### [gherkin - Indent char](#gherkin---indent-char)
|
||||
|
||||
**Key**: `gherkin_indent_char`
|
||||
|
||||
**Default**: ` `
|
||||
|
||||
**Type**: `string`
|
||||
|
||||
**Supported Beautifiers**: [`Gherkin formatter`](#gherkin-formatter)
|
||||
|
||||
**Description**:
|
||||
|
||||
Indentation character (Supported by Gherkin formatter)
|
||||
|
||||
#### [Fortran - Emacs path](#fortran---emacs-path)
|
||||
|
||||
**Key**: `fortran_emacs_path`
|
||||
|
@ -1263,6 +1291,40 @@ Default Beautifier to be used for ERB
|
|||
|
||||
Automatically beautify ERB files on save
|
||||
|
||||
#### [Language Config - gherkin - Disable Beautifying Language](#language-config---gherkin---disable-beautifying-language)
|
||||
|
||||
**Key**: `language_gherkin_disabled`
|
||||
|
||||
**Type**: `boolean`
|
||||
|
||||
**Description**:
|
||||
|
||||
Disable gherkin Beautification
|
||||
|
||||
#### [Language Config - gherkin - Default Beautifier](#language-config---gherkin---default-beautifier)
|
||||
|
||||
**Key**: `language_gherkin_default_beautifier`
|
||||
|
||||
**Default**: `Gherkin formatter`
|
||||
|
||||
**Type**: `string`
|
||||
|
||||
**Enum**: `Gherkin formatter`
|
||||
|
||||
**Description**:
|
||||
|
||||
Default Beautifier to be used for gherkin
|
||||
|
||||
#### [Language Config - gherkin - Beautify On Save](#language-config---gherkin---beautify-on-save)
|
||||
|
||||
**Key**: `language_gherkin_beautify_on_save`
|
||||
|
||||
**Type**: `boolean`
|
||||
|
||||
**Description**:
|
||||
|
||||
Automatically beautify gherkin files on save
|
||||
|
||||
#### [Language Config - Go - Disable Beautifying Language](#language-config---go---disable-beautifying-language)
|
||||
|
||||
**Key**: `language_go_disabled`
|
||||
|
@ -1807,6 +1869,40 @@ Default Beautifier to be used for PHP
|
|||
|
||||
Automatically beautify PHP files on save
|
||||
|
||||
#### [Language Config - Puppet - Disable Beautifying Language](#language-config---puppet---disable-beautifying-language)
|
||||
|
||||
**Key**: `language_puppet_disabled`
|
||||
|
||||
**Type**: `boolean`
|
||||
|
||||
**Description**:
|
||||
|
||||
Disable Puppet Beautification
|
||||
|
||||
#### [Language Config - Puppet - Default Beautifier](#language-config---puppet---default-beautifier)
|
||||
|
||||
**Key**: `language_puppet_default_beautifier`
|
||||
|
||||
**Default**: `puppet-lint`
|
||||
|
||||
**Type**: `string`
|
||||
|
||||
**Enum**: `puppet-lint`
|
||||
|
||||
**Description**:
|
||||
|
||||
Default Beautifier to be used for Puppet
|
||||
|
||||
#### [Language Config - Puppet - Beautify On Save](#language-config---puppet---beautify-on-save)
|
||||
|
||||
**Key**: `language_puppet_beautify_on_save`
|
||||
|
||||
**Type**: `boolean`
|
||||
|
||||
**Description**:
|
||||
|
||||
Automatically beautify Puppet files on save
|
||||
|
||||
#### [Language Config - Python - Disable Beautifying Language](#language-config---python---disable-beautifying-language)
|
||||
|
||||
**Key**: `language_python_disabled`
|
||||
|
@ -3157,6 +3253,37 @@ Add a space before an anonymous function's parens, ie. function () (Support
|
|||
Wrap lines at next opportunity after N characters (Supported by JS Beautify, Pretty Diff)
|
||||
|
||||
|
||||
### Gherkin formatter
|
||||
|
||||
#### [gherkin - Indent size](#gherkin---indent-size)
|
||||
|
||||
**Key**: `gherkin_indent_size`
|
||||
|
||||
**Default**: `4`
|
||||
|
||||
**Type**: `integer`
|
||||
|
||||
**Supported Beautifiers**: [`Gherkin formatter`](#gherkin-formatter)
|
||||
|
||||
**Description**:
|
||||
|
||||
Indentation size/length (Supported by Gherkin formatter)
|
||||
|
||||
#### [gherkin - Indent char](#gherkin---indent-char)
|
||||
|
||||
**Key**: `gherkin_indent_char`
|
||||
|
||||
**Default**: ` `
|
||||
|
||||
**Type**: `string`
|
||||
|
||||
**Supported Beautifiers**: [`Gherkin formatter`](#gherkin-formatter)
|
||||
|
||||
**Description**:
|
||||
|
||||
Indentation character (Supported by Gherkin formatter)
|
||||
|
||||
|
||||
### Fortran Beautifier
|
||||
|
||||
#### [Fortran - Emacs path](#fortran---emacs-path)
|
||||
|
|
|
@ -0,0 +1,95 @@
|
|||
# Define quantum::generic_service
|
||||
#
|
||||
# This class implements basic ceilomer services.
|
||||
# It is derived from https://github.com/stackforge/puppet-quantum/blob/master/manifests/generic_service.pp
|
||||
#
|
||||
define quantum::generic_service (
|
||||
|
||||
$package_name = '',
|
||||
$package_ensure = 'present',
|
||||
|
||||
$service_name = '',
|
||||
$service_ensure = 'running',
|
||||
$service_enable = true,
|
||||
|
||||
$config_file_path = undef,
|
||||
$config_file_notify = 'default',
|
||||
$config_file_require = 'default',
|
||||
$config_file_replace = undef,
|
||||
$config_file_source = undef,
|
||||
$config_file_template = undef,
|
||||
$config_file_content = undef,
|
||||
$config_file_options_hash = { },
|
||||
|
||||
$config_dir_path = '/etc/quantum',
|
||||
) {
|
||||
|
||||
$distro_prefix = $::osfamily ? {
|
||||
RedHat => 'openstack-',
|
||||
Debian => '',
|
||||
}
|
||||
|
||||
$manage_package_name = pickx($package_name, "${distro_prefix}${name}")
|
||||
$manage_service_name = pickx($service_name, "${distro_prefix}${name}")
|
||||
$manage_config_file_path = pickx($config_file_path, "${config_dir_path}/${name}.conf")
|
||||
$manage_config_file_content = default_content($config_file_content, $config_file_template)
|
||||
$manage_config_file_notify = $config_file_notify ? {
|
||||
'default' => "Service[${name}]",
|
||||
'' => undef,
|
||||
default => $config_file_notify,
|
||||
}
|
||||
$manage_config_file_require = $config_file_require ? {
|
||||
'default' => "Package[${name}]",
|
||||
default => $config_file_require,
|
||||
}
|
||||
|
||||
if $package_ensure == 'absent' {
|
||||
$manage_service_enable = undef
|
||||
$manage_service_ensure = stopped
|
||||
$config_file_ensure = absent
|
||||
} else {
|
||||
$manage_service_enable = $service_enable ? {
|
||||
'' => undef,
|
||||
'undef' => undef,
|
||||
default => $service_enable,
|
||||
}
|
||||
$manage_service_ensure = $service_ensure ? {
|
||||
'' => undef,
|
||||
'undef' => undef,
|
||||
default => $service_ensure,
|
||||
}
|
||||
$config_file_ensure = present
|
||||
}
|
||||
|
||||
if ($manage_package_name) {
|
||||
package { $name:
|
||||
ensure => $package_ensure,
|
||||
name => $manage_package_name,
|
||||
}
|
||||
}
|
||||
|
||||
if ($manage_service_name) {
|
||||
service { $name:
|
||||
ensure => $manage_service_ensure,
|
||||
name => $manage_service_name,
|
||||
enable => $manage_service_enable,
|
||||
require => Package[$manage_package_name],
|
||||
}
|
||||
}
|
||||
|
||||
if $config_file_source
|
||||
or $manage_config_file_content {
|
||||
file { "${name}.conf":
|
||||
ensure => $config_file_ensure,
|
||||
path => $manage_config_file_path,
|
||||
mode => $config_file_mode,
|
||||
owner => $config_file_owner,
|
||||
group => $config_file_group,
|
||||
source => $config_file_source,
|
||||
content => $manage_config_file_content,
|
||||
notify => $manage_config_file_notify,
|
||||
require => $manage_config_file_require,
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,95 @@
|
|||
# Define quantum::generic_service
|
||||
#
|
||||
# This class implements basic ceilomer services.
|
||||
# It is derived from https://github.com/stackforge/puppet-quantum/blob/master/manifests/generic_service.pp
|
||||
#
|
||||
define quantum::generic_service (
|
||||
|
||||
$package_name = '',
|
||||
$package_ensure = 'present',
|
||||
|
||||
$service_name = '',
|
||||
$service_ensure = 'running',
|
||||
$service_enable = true,
|
||||
|
||||
$config_file_path = undef,
|
||||
$config_file_notify = 'default',
|
||||
$config_file_require = 'default',
|
||||
$config_file_replace = undef,
|
||||
$config_file_source = undef,
|
||||
$config_file_template = undef,
|
||||
$config_file_content = undef,
|
||||
$config_file_options_hash = { },
|
||||
|
||||
$config_dir_path = '/etc/quantum',
|
||||
) {
|
||||
|
||||
$distro_prefix = $::osfamily ? {
|
||||
RedHat => 'openstack-',
|
||||
Debian => '',
|
||||
}
|
||||
|
||||
$manage_package_name = pickx($package_name, "${distro_prefix}${name}")
|
||||
$manage_service_name = pickx($service_name, "${distro_prefix}${name}")
|
||||
$manage_config_file_path = pickx($config_file_path, "${config_dir_path}/${name}.conf")
|
||||
$manage_config_file_content = default_content($config_file_content, $config_file_template)
|
||||
$manage_config_file_notify = $config_file_notify ? {
|
||||
'default' => "Service[${name}]",
|
||||
'' => undef,
|
||||
default => $config_file_notify,
|
||||
}
|
||||
$manage_config_file_require = $config_file_require ? {
|
||||
'default' => "Package[${name}]",
|
||||
default => $config_file_require,
|
||||
}
|
||||
|
||||
if $package_ensure == 'absent' {
|
||||
$manage_service_enable = undef
|
||||
$manage_service_ensure = stopped
|
||||
$config_file_ensure = absent
|
||||
} else {
|
||||
$manage_service_enable = $service_enable ? {
|
||||
'' => undef,
|
||||
'undef' => undef,
|
||||
default => $service_enable,
|
||||
}
|
||||
$manage_service_ensure = $service_ensure ? {
|
||||
'' => undef,
|
||||
'undef' => undef,
|
||||
default => $service_ensure,
|
||||
}
|
||||
$config_file_ensure = present
|
||||
}
|
||||
|
||||
if ($manage_package_name) {
|
||||
package { $name:
|
||||
ensure => $package_ensure,
|
||||
name => $manage_package_name,
|
||||
}
|
||||
}
|
||||
|
||||
if ($manage_service_name) {
|
||||
service { $name:
|
||||
ensure => $manage_service_ensure,
|
||||
name => $manage_service_name,
|
||||
enable => $manage_service_enable,
|
||||
require => Package[$manage_package_name],
|
||||
}
|
||||
}
|
||||
|
||||
if $config_file_source
|
||||
or $manage_config_file_content {
|
||||
file { "${name}.conf":
|
||||
ensure => $config_file_ensure,
|
||||
path => $manage_config_file_path,
|
||||
mode => $config_file_mode,
|
||||
owner => $config_file_owner,
|
||||
group => $config_file_group,
|
||||
source => $config_file_source,
|
||||
content => $manage_config_file_content,
|
||||
notify => $manage_config_file_notify,
|
||||
require => $manage_config_file_require,
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -47,6 +47,7 @@ module.exports = class Beautifiers extends EventEmitter
|
|||
'perltidy'
|
||||
'php-cs-fixer'
|
||||
'prettydiff'
|
||||
'puppet-fix'
|
||||
'rubocop'
|
||||
'ruby-beautify'
|
||||
'rustfmt'
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
###
|
||||
Requires [puppet-link](http://puppet-lint.com/)
|
||||
###
|
||||
"use strict"
|
||||
Beautifier = require('./beautifier')
|
||||
|
||||
module.exports = class PuppetFix extends Beautifier
|
||||
# this is what displays as your Default Beautifier in Language Config
|
||||
name: "puppet-lint"
|
||||
|
||||
options: {
|
||||
Puppet: true
|
||||
}
|
||||
|
||||
cli: (options) ->
|
||||
if not options.puppet_path?
|
||||
return new Error("'puppet-lint' path is not set!" +
|
||||
" Please set this in the Atom Beautify package settings.")
|
||||
else
|
||||
return options.puppet_path
|
||||
|
||||
beautify: (text, language, options) ->
|
||||
@run("puppet-lint", [
|
||||
'--fix'
|
||||
tempFile = @tempFile("input", text)
|
||||
], {
|
||||
ignoreReturnCode: true
|
||||
help: {
|
||||
link: "http://puppet-lint.com/"
|
||||
}
|
||||
})
|
||||
.then(=>
|
||||
@readFile(tempFile)
|
||||
)
|
|
@ -39,6 +39,7 @@ module.exports = class Languages
|
|||
"pawn"
|
||||
"perl"
|
||||
"php"
|
||||
"puppet"
|
||||
"python"
|
||||
"ruby"
|
||||
"rust"
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
module.exports = {
|
||||
|
||||
name: "Puppet"
|
||||
namespace: "puppet"
|
||||
|
||||
###
|
||||
Supported Grammars
|
||||
###
|
||||
grammars: [
|
||||
"Puppet"
|
||||
]
|
||||
|
||||
###
|
||||
Supported extensions
|
||||
###
|
||||
extensions: [
|
||||
"pp"
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue