mirror of
1
0
Fork 0

Forgot to add the newly created files from the plugin update

This commit is contained in:
Amir Salihefendic 2018-12-17 12:33:49 +01:00
parent e99e9e9c3e
commit 96b46f56ae
18 changed files with 1543 additions and 0 deletions

View File

@ -0,0 +1,54 @@
" Author: Martino Pilia <martino.pilia@gmail.com>
" Description: Lint Ada files with GCC
call ale#Set('ada_gcc_executable', 'gcc')
" -gnatwa: activate most optional warnings
" -gnatq: try semantic analysis even if syntax errors have been found
call ale#Set('ada_gcc_options', '-gnatwa -gnatq')
function! ale_linters#ada#gcc#GetCommand(buffer) abort
" Build a suitable output file name. The output file is specified because
" the .ali file may be created even if no code generation is attempted.
" The output file name must match the source file name (except for the
" extension), so here we cannot use the null file as output.
let l:tmp_dir = fnamemodify(ale#engine#CreateDirectory(a:buffer), ':p')
let l:out_file = l:tmp_dir . fnamemodify(bufname(a:buffer), ':t:r') . '.o'
" -gnatc: Check syntax and semantics only (no code generation attempted)
return '%e -x ada -c -gnatc'
\ . ' -o ' . ale#Escape(l:out_file)
\ . ' -I ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h'))
\ . ale#Pad(ale#Var(a:buffer, 'ada_gcc_options'))
\ . ' %t'
endfunction
" For the message format please refer to:
" https://gcc.gnu.org/onlinedocs/gnat_ugn/Output-and-Error-Message-Control.html
" https://gcc.gnu.org/onlinedocs/gnat_ugn/Warning-Message-Control.html
function! ale_linters#ada#gcc#Handle(buffer, lines) abort
" Error format: <filename>:<lnum>:<col>: <text>
" Warning format: <filename>:<lnum>:<col>: warning: <text>
let l:re = '\v(.+):([0-9]+):([0-9]+):\s+(warning:)?\s*(.+)\s*'
let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:re)
call add(l:output, {
\ 'bufnr': a:buffer,
\ 'lnum': str2nr(l:match[2]),
\ 'col': str2nr(l:match[3]),
\ 'type': l:match[4] is# 'warning:' ? 'W' : 'E',
\ 'text': l:match[5],
\})
endfor
return l:output
endfunction
call ale#linter#Define('ada', {
\ 'name': 'gcc',
\ 'output_stream': 'stderr',
\ 'executable_callback': ale#VarFunc('ada_gcc_executable'),
\ 'command_callback': 'ale_linters#ada#gcc#GetCommand',
\ 'callback': 'ale_linters#ada#gcc#Handle',
\})

View File

@ -0,0 +1,9 @@
" Author: Jeff Kreeftmeijer https://github.com/jeffkreeftmeijer
" Description: vale for AsciiDoc files
call ale#linter#Define('asciidoc', {
\ 'name': 'vale',
\ 'executable': 'vale',
\ 'command': 'vale --output=line %t',
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
\})

View File

@ -0,0 +1,74 @@
" Author: Horacio Sanson - https://github.com/hsanson
" Description: Support for bibclean linter for BibTeX files.
call ale#Set('bib_bibclean_executable', 'bibclean')
function! ale_linters#bib#bibclean#GetCommand(buffer) abort
let l:executable = ale#Var(a:buffer, 'bib_bibclean_executable')
return ale#Escape(l:executable) . ' -file-position '
endfunction
function! ale_linters#bib#bibclean#get_type(str) abort
if a:str is# '??'
return 'E'
else
return 'W'
endif
endfunction
function! ale_linters#bib#bibclean#match_msg(line) abort
return matchlist(a:line, '^\(.*\) "stdin", line \(.*\): \(.*\)$')
endfunction
function! ale_linters#bib#bibclean#match_entry(line) abort
return matchlist(a:line, 'Entry input byte=.* line=\(.*\) column=\(.*\) output .*$')
endfunction
function! ale_linters#bib#bibclean#match_value(line) abort
return matchlist(a:line, 'Value input byte=.* line=\(.*\) column=\(.*\) output .*$')
endfunction
function! ale_linters#bib#bibclean#Handle(buffer, lines) abort
let l:output = []
let l:type = 'E'
let l:msg = ''
for l:line in a:lines
if empty(l:msg)
let l:mlist = ale_linters#bib#bibclean#match_msg(l:line)
if !empty(l:mlist)
let l:msg = l:mlist[3]
let l:type = ale_linters#bib#bibclean#get_type(l:mlist[1])
endif
else
if l:type is# 'E'
let l:mlist = ale_linters#bib#bibclean#match_entry(l:line)
else
let l:mlist = ale_linters#bib#bibclean#match_value(l:line)
endif
if !empty(l:mlist)
call add(l:output, {
\ 'lnum': l:mlist[1],
\ 'col': l:mlist[2],
\ 'text': l:msg,
\ 'type': l:type
\})
let l:msg = ''
endif
endif
endfor
return l:output
endfunction
call ale#linter#Define('bib', {
\ 'name': 'bibclean',
\ 'executable_callback': ale#VarFunc('bib_bibclean_executable'),
\ 'command_callback': 'ale_linters#bib#bibclean#GetCommand',
\ 'output_stream': 'stderr',
\ 'callback': 'ale_linters#bib#bibclean#Handle',
\})

View File

@ -0,0 +1,62 @@
" Author: aclemons - https://github.com/aclemons
" based on the ale rubocop linter
" Description: Ruumba, RuboCop linting for ERB templates.
call ale#Set('eruby_ruumba_executable', 'ruumba')
call ale#Set('eruby_ruumba_options', '')
function! ale_linters#eruby#ruumba#GetCommand(buffer) abort
let l:executable = ale#Var(a:buffer, 'eruby_ruumba_executable')
return ale#handlers#ruby#EscapeExecutable(l:executable, 'ruumba')
\ . ' --format json --force-exclusion '
\ . ale#Var(a:buffer, 'eruby_ruumba_options')
\ . ' --stdin ' . ale#Escape(expand('#' . a:buffer . ':p'))
endfunction
function! ale_linters#eruby#ruumba#Handle(buffer, lines) abort
try
let l:errors = json_decode(a:lines[0])
catch
return []
endtry
if !has_key(l:errors, 'summary')
\|| l:errors['summary']['offense_count'] == 0
\|| empty(l:errors['files'])
return []
endif
let l:output = []
for l:error in l:errors['files'][0]['offenses']
let l:start_col = l:error['location']['column'] + 0
call add(l:output, {
\ 'lnum': l:error['location']['line'] + 0,
\ 'col': l:start_col,
\ 'end_col': l:start_col + l:error['location']['length'] - 1,
\ 'code': l:error['cop_name'],
\ 'text': l:error['message'],
\ 'type': ale_linters#eruby#ruumba#GetType(l:error['severity']),
\})
endfor
return l:output
endfunction
function! ale_linters#eruby#ruumba#GetType(severity) abort
if a:severity is? 'convention'
\|| a:severity is? 'warning'
\|| a:severity is? 'refactor'
return 'W'
endif
return 'E'
endfunction
call ale#linter#Define('eruby', {
\ 'name': 'ruumba',
\ 'executable_callback': ale#VarFunc('eruby_ruumba_executable'),
\ 'command_callback': 'ale_linters#eruby#ruumba#GetCommand',
\ 'callback': 'ale_linters#eruby#ruumba#Handle',
\})

View File

@ -0,0 +1,45 @@
" Author: Martino Pilia <martino.pilia@gmail.com>
" Description: Lint ispc files with the Intel(R) SPMD Program Compiler
call ale#Set('ispc_ispc_executable', 'ispc')
call ale#Set('ispc_ispc_options', '')
function! ale_linters#ispc#ispc#GetCommand(buffer) abort
" --nowrap: do not wrap message lines
return '%e --nowrap'
\ . ale#Pad(ale#c#IncludeOptions(ale#c#FindLocalHeaderPaths(a:buffer)))
\ . ale#Pad(ale#Var(a:buffer, 'ispc_ispc_options'))
\ . ' %s'
endfunction
" Note that we ignore the two warnings in the beginning of the compiler output
" ('no output file specified' and 'no --target specified'), since they have
" nothing to do with linting.
function! ale_linters#ispc#ispc#Handle(buffer, lines) abort
" Message format: <filename>:<lnum>:<col> <type>: <text>
" As far as I know, <type> can be any of:
" 'error', 'Error', 'fatal error', 'Warning', 'Performance Warning'
let l:re = '\v.+:([0-9]+):([0-9]+):\s+([^:]+):\s+(.+)'
let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:re)
call add(l:output, {
\ 'bufnr': a:buffer,
\ 'lnum': str2nr(l:match[1]),
\ 'col': str2nr(l:match[2]),
\ 'type': l:match[3] =~? 'error' ? 'E' : 'W',
\ 'text': l:match[4],
\})
endfor
return l:output
endfunction
call ale#linter#Define('ispc', {
\ 'name': 'ispc',
\ 'output_stream': 'stderr',
\ 'executable_callback': ale#VarFunc('ispc_ispc_executable'),
\ 'command_callback': 'ale_linters#ispc#ispc#GetCommand',
\ 'callback': 'ale_linters#ispc#ispc#Handle',
\ 'lint_file': 1,
\})

View File

@ -0,0 +1,74 @@
" Author: Pablo Acosta <pmasdev@gmail.com>
" Description: pydocstyle for python files
call ale#Set('python_pydocstyle_executable', 'pydocstyle')
call ale#Set('python_pydocstyle_options', '')
call ale#Set('python_pydocstyle_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('python_pydocstyle_auto_pipenv', 0)
function! ale_linters#python#pydocstyle#GetExecutable(buffer) abort
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pydocstyle_auto_pipenv'))
\ && ale#python#PipenvPresent(a:buffer)
return 'pipenv'
endif
return ale#python#FindExecutable(a:buffer, 'python_pydocstyle', ['pydocstyle'])
endfunction
function! ale_linters#python#pydocstyle#GetCommand(buffer) abort
let l:dir = fnamemodify(bufname(a:buffer), ':p:h')
let l:executable = ale_linters#python#pydocstyle#GetExecutable(a:buffer)
let l:exec_args = l:executable =~? 'pipenv$'
\ ? ' run pydocstyle'
\ : ''
return ale#path#CdString(l:dir)
\ . ale#Escape(l:executable) . l:exec_args
\ . ' ' . ale#Var(a:buffer, 'python_pydocstyle_options')
\ . ' ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:t'))
endfunction
function! ale_linters#python#pydocstyle#Handle(buffer, lines) abort
" Matches patterns like the following:
" mydir/myfile.py:33 in public function `myfunction`:
" DXXX: Error description
let l:fname = ale#Escape(fnamemodify(bufname(a:buffer), ':p:t'))
let l:line1_pattern = '\v^' . l:fname . ':\s*(\d+)\s+.*$'
let l:line2_pattern = '\v^.*([a-zA-Z]\d+):\s*(.*)$'
let l:output = []
let l:num_lines = len(a:lines)
let l:index = 0
while l:index < l:num_lines
let l:lnum = matchlist(a:lines[l:index], l:line1_pattern)
if !empty(l:lnum) && (l:index + 1 < l:num_lines)
let l:desc = matchlist(a:lines[l:index + 1], l:line2_pattern)
if !empty(l:desc)
call add(l:output, {
\ 'lnum': l:lnum[1] + 0,
\ 'col': 1,
\ 'type': 'W',
\ 'text': l:desc[2],
\ 'code': l:desc[1],
\})
endif
let l:index = l:index + 2
else
let l:index = l:index + 1
endif
endwhile
return l:output
endfunction
call ale#linter#Define('python', {
\ 'name': 'pydocstyle',
\ 'executable_callback': 'ale_linters#python#pydocstyle#GetExecutable',
\ 'command_callback': 'ale_linters#python#pydocstyle#GetCommand',
\ 'callback': 'ale_linters#python#pydocstyle#Handle',
\})

View File

@ -0,0 +1,23 @@
" Author: Justin Searls https://github.com/searls, ynonp - https://github.com/ynonp, Eddie Lebow https://github.com/elebow
" based on the ale rubocop linter
" Description: StandardRB - Ruby Style Guide, with linter & automatic code fixer
call ale#Set('ruby_standardrb_executable', 'standardrb')
call ale#Set('ruby_standardrb_options', '')
function! ale_linters#ruby#standardrb#GetCommand(buffer) abort
let l:executable = ale#Var(a:buffer, 'ruby_standardrb_executable')
return ale#handlers#ruby#EscapeExecutable(l:executable, 'standardrb')
\ . ' --format json --force-exclusion '
\ . ale#Var(a:buffer, 'ruby_standardrb_options')
\ . ' --stdin ' . ale#Escape(expand('#' . a:buffer . ':p'))
endfunction
" standardrb is based on RuboCop so the callback is the same
call ale#linter#Define('ruby', {
\ 'name': 'standardrb',
\ 'executable_callback': ale#VarFunc('ruby_standardrb_executable'),
\ 'command_callback': 'ale_linters#ruby#standardrb#GetCommand',
\ 'callback': 'ale#ruby#HandleRubocopOutput',
\})

View File

@ -0,0 +1,15 @@
" Author: Horacio Sanson - https://github.com/hsanson
" Description: Support for bibclean fixer for BibTeX files.
call ale#Set('bib_bibclean_executable', 'bibclean')
call ale#Set('bib_bibclean_options', '-align-equals')
function! ale#fixers#bibclean#Fix(buffer) abort
let l:options = ale#Var(a:buffer, 'bib_bibclean_options')
let l:executable = ale#Var(a:buffer, 'bib_bibclean_executable')
return {
\ 'command': ale#Escape(l:executable)
\ . ' ' . (empty(l:options) ? '' : l:options),
\}
endfunction

View File

@ -0,0 +1,23 @@
" Author: Justin Searls - https://github.com/searls
" Description: Fix Ruby files with StandardRB.
call ale#Set('ruby_standardrb_options', '')
call ale#Set('ruby_standardrb_executable', 'standardrb')
function! ale#fixers#standardrb#GetCommand(buffer) abort
let l:executable = ale#Var(a:buffer, 'ruby_standardrb_executable')
let l:config = ale#path#FindNearestFile(a:buffer, '.standard.yml')
let l:options = ale#Var(a:buffer, 'ruby_standardrb_options')
return ale#handlers#ruby#EscapeExecutable(l:executable, 'standardrb')
\ . (!empty(l:config) ? ' --config ' . ale#Escape(l:config) : '')
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ' --fix --force-exclusion %t'
endfunction
function! ale#fixers#standardrb#Fix(buffer) abort
return {
\ 'command': ale#fixers#standardrb#GetCommand(a:buffer),
\ 'read_temporary_file': 1,
\}
endfunction

View File

@ -0,0 +1,136 @@
scriptencoding utf-8
" Author: w0rp <devw0rp@gmail.com>
" Author: Luan Santos <cfcluan@gmail.com>
" Description: Shows lint message for the current line as virtualtext, if any
" Controls the milliseconds delay before showing a message.
let g:ale_virtualtext_delay = get(g:, 'ale_virtualtext_delay', 10)
let s:cursor_timer = -1
let s:last_pos = [0, 0, 0]
if has('nvim-0.3.2')
let s:ns_id = nvim_create_namespace('ale')
endif
if !hlexists('ALEVirtualTextError')
highlight link ALEVirtualTextError ALEError
endif
if !hlexists('ALEVirtualTextStyleError')
highlight link ALEVirtualTextStyleError ALEVirtualTextError
endif
if !hlexists('ALEVirtualTextWarning')
highlight link ALEVirtualTextWarning ALEWarning
endif
if !hlexists('ALEVirtualTextStyleWarning')
highlight link ALEVirtualTextStyleWarning ALEVirtualTextWarning
endif
if !hlexists('ALEVirtualTextInfo')
highlight link ALEVirtualTextInfo ALEVirtualTextWarning
endif
function! ale#virtualtext#Clear() abort
if !has('nvim-0.3.2')
return
endif
let l:buffer = bufnr('')
call nvim_buf_clear_highlight(l:buffer, s:ns_id, 0, -1)
endfunction
function! ale#virtualtext#ShowMessage(message, hl_group) abort
if !has('nvim-0.3.2')
return
endif
let l:cursor_position = getcurpos()
let l:line = line('.')
let l:buffer = bufnr('')
let l:prefix = get(g:, 'ale_virtualtext_prefix', '> ')
call nvim_buf_set_virtual_text(l:buffer, s:ns_id, l:line-1, [[l:prefix.a:message, a:hl_group]], {})
endfunction
function! s:StopCursorTimer() abort
if s:cursor_timer != -1
call timer_stop(s:cursor_timer)
let s:cursor_timer = -1
endif
endfunction
function! ale#virtualtext#ShowCursorWarning(...) abort
if !g:ale_virtualtext_cursor
return
endif
let l:buffer = bufnr('')
if mode(1) isnot# 'n'
return
endif
if ale#ShouldDoNothing(l:buffer)
return
endif
let [l:info, l:loc] = ale#util#FindItemAtCursor(l:buffer)
call ale#virtualtext#Clear()
if !empty(l:loc)
let l:msg = get(l:loc, 'detail', l:loc.text)
let l:hl_group = 'ALEVirtualTextInfo'
let l:type = get(l:loc, 'type', 'E')
if l:type is# 'E'
if get(l:loc, 'sub_type', '') is# 'style'
let l:hl_group = 'ALEVirtualTextStyleError'
else
let l:hl_group = 'ALEVirtualTextError'
endif
elseif l:type is# 'W'
if get(l:loc, 'sub_type', '') is# 'style'
let l:hl_group = 'ALEVirtualTextStyleWarning'
else
let l:hl_group = 'ALEVirtualTextWarning'
endif
endif
call ale#virtualtext#ShowMessage(l:msg, l:hl_group)
endif
endfunction
function! ale#virtualtext#ShowCursorWarningWithDelay() abort
let l:buffer = bufnr('')
if !g:ale_virtualtext_cursor
return
endif
if mode(1) isnot# 'n'
return
endif
call s:StopCursorTimer()
let l:pos = getcurpos()[0:2]
" Check the current buffer, line, and column number against the last
" recorded position. If the position has actually changed, *then*
" we should show something. Otherwise we can end up doing processing
" the show message far too frequently.
if l:pos != s:last_pos
let l:delay = ale#Var(l:buffer, 'virtualtext_delay')
let s:last_pos = l:pos
let s:cursor_timer = timer_start(
\ l:delay,
\ function('ale#virtualtext#ShowCursorWarning')
\)
endif
endfunction

View File

@ -0,0 +1,25 @@
===============================================================================
ALE Ada Integration *ale-ada-options*
===============================================================================
gcc *ale-ada-gcc*
g:ale_ada_gcc_executable *g:ale_ada_gcc_executable*
*b:ale_ada_gcc_executable*
Type: |String|
Default: `'gcc'`
This variable can be changed to use a different executable for gcc.
g:ale_ada_gcc_options *g:ale_ada_gcc_options*
*b:ale_ada_gcc_options*
Type: |String|
Default: `'-gnatwa -gnatq'`
This variable can be set to pass additional options to gcc.
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View File

@ -0,0 +1,19 @@
===============================================================================
ALE BibTeX Integration *ale-bib-options*
===============================================================================
bibclean *ale-bib-bibclean*
g:ale_bib_bibclean_executable *g:ale_bib_bibclean_executable*
Type: |String|
Default: `'bibclean'`
g:ale_bib_bibclean_options *g:ale_bib_bibclean_options*
Type: |String|
Default: `'-align-equals'`
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View File

@ -0,0 +1,24 @@
===============================================================================
ALE ISPC Integration *ale-ispc-options*
===============================================================================
ispc *ale-ispc-ispc*
g:ale_ispc_ispc_executable *g:ale_ispc_ispc_executable*
*b:ale_ispc_ispc_executable*
Type: |String|
Default: `'ispc'`
This variable can be changed to use a different executable for ispc.
g:ale_ispc_ispc_options *g:ale_ispc_ispc_options*
*b:ale_ispc_ispc_options*
Type: |String|
Default: `''`
This variable can be changed to modify flags given to ispc.
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View File

@ -0,0 +1,38 @@
" ============================================================================
" File: vcs.vim
" Description: NERDTree plugin that provides a command to open on the root of
" a version control system repository.
" Maintainer: Phil Runninger
" License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
" ============================================================================
command! -n=? -complete=dir -bar NERDTreeVCS :call <SID>CreateTabTreeVCS('<args>')
" FUNCTION: s:CreateTabTreeVCS(a:name) {{{1
function! s:CreateTabTreeVCS(name)
let l:path = g:NERDTreeCreator._pathForString(a:name)
let l:path = s:FindParentVCSRoot(l:path)
call g:NERDTreeCreator.createTabTree(empty(l:path) ? "" : l:path._str())
endfunction
" FUNCTION: s:FindParentVCSRoot(a:path) {{{1
" Finds the root version control system folder of the given path. If a:path is
" not part of a repository, return the original path.
function! s:FindParentVCSRoot(path)
let l:path = a:path
while !empty(l:path) &&
\ l:path._str() !~ '^\(\a:\\\|\/\)$' &&
\ !isdirectory(l:path._str() . '/.git') &&
\ !isdirectory(l:path._str() . '/.svn') &&
\ !isdirectory(l:path._str() . '/.hg') &&
\ !isdirectory(l:path._str() . '/.bzr') &&
\ !isdirectory(l:path._str() . '/_darcs')
let l:path = l:path.getParent()
endwhile
return (empty(l:path) || l:path._str() =~ '^\(\a:\\\|\/\)$') ? a:path : l:path
endfunction

View File

@ -0,0 +1,54 @@
" don't spam the user when Vim is started in Vi compatibility mode
let s:cpo_save = &cpo
set cpo&vim
function! Test_GoDebugStart_Empty() abort
call s:debug()
endfunction
function! Test_GoDebugStart_RelativePackage() abort
call s:debug('./debugmain')
endfunction
function! Test_GoDebugStart_Package() abort
call s:debug('debugmain')
endfunction
function! s:debug(...) abort
if !go#util#has_job()
return
endif
try
let l:tmp = gotest#load_fixture('debugmain/debugmain.go')
call go#debug#Breakpoint(6)
call assert_false(exists(':GoDebugStop'))
if a:0 == 0
let l:cd = exists('*haslocaldir') && haslocaldir() ? 'lcd' : 'cd'
execute l:cd . ' debugmain'
call go#debug#Start(0)
else
call go#debug#Start(0, a:1)
endif
let l:start = reltime()
while !exists(':GoDebugStop') && reltimefloat(reltime(l:start)) < 10
sleep 100m
endwhile
call go#debug#Stop()
call assert_false(exists(':GoDebugStop'))
finally
call delete(l:tmp, 'rf')
endtry
endfunction
" restore Vi compatibility settings
let &cpo = s:cpo_save
unlet s:cpo_save
" vim: sw=2 ts=2 et

View File

@ -0,0 +1,7 @@
package main
import "fmt"
func main() {
fmt.Println("vim-go")
}

View File

@ -0,0 +1,591 @@
snippet service_sample_spec
apiVersion: v1
kind: Service
metadata:
{{- if .Values.$1.service.annotations }}
annotations:
{{ toYaml .Values.$1.service.annotations | indent 4 }}
{{- end }}
labels:
{{- if .Values.$1.service.labels }}
{{ toYaml .Values.$1.service.labels | indent 4 }}
{{- end }}
app: {{ template "$2.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
component: "{{ .Values.$1.name }}"
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
name: {{ template "$2.$1.fullname" . }}
spec:
clusterIP: "{{ .Values.$1.service.clusterIP }}"
{{- if .Values.$1.service.externalIPs }}
externalIPs:
{{ toYaml .Values.$1.service.externalIPs | indent 4 }}
{{- end }}
{{- if .Values.$1.service.loadBalancerIP }}
loadBalancerIP: "{{ .Values.$1.service.loadBalancerIP }}"
{{- end }}
{{- if .Values.$1.service.loadBalancerSourceRanges }}
loadBalancerSourceRanges:
{{ toYaml .Values.$1.service.loadBalancerSourceRanges | indent 4 }}
{{- end }}
healthCheckNodePort: {{ .Values.$1.service.healthCheckNodePort }}
ports:
- name: http
port: 80
protocol: TCP
targetPort: {{ .Values.$1.service.targetPorts.http }}
{{- if (and (eq .Values.$1.service.type "NodePort") (not (empty .Values.$1.service.nodePorts.http))) }}
nodePort: {{ .Values.$1.service.nodePorts.http }}
{{- end }}
- name: https
port: 443
protocol: TCP
targetPort: {{ .Values.$1.service.targetPorts.https }}
{{- if (and (eq .Values.$1.service.type "NodePort") (not (empty .Values.$1.service.nodePorts.https))) }}
nodePort: {{ .Values.$1.service.nodePorts.https }}
{{- end }}
{{- range $key, $value := .Values.tcp }}
- name: "{{ $key }}-tcp"
port: {{ $key }}
protocol: TCP
targetPort: "{{ $key }}-tcp"
{{- end }}
{{- range $key, $value := .Values.udp }}
- name: "{{ $key }}-udp"
port: {{ $key }}
protocol: UDP
targetPort: "{{ $key }}-udp"
{{- end }}
selector:
app: {{ template "${2:chartName}.name" . }}
component: "{{ .Values.$1.name }}"
release: {{ .Release.Name }}
type: "{{ .Values.${1:value_key}.service.type }}"
snippet service_spec
apiVersion: v1
kind: Service
metadata:
{{- if .Values.$1.service.annotations }}
annotations:
{{ toYaml .Values.$1.service.annotations | indent 4 }}
{{- end }}
labels:
{{- if .Values.$1.service.labels }}
{{ toYaml .Values.$1.service.labels | indent 4 }}
{{- end }}
app: {{ template "$2.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
component: "{{ .Values.$1.name }}"
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
name: {{ template "${2:chartName}.${1:value_key}.fullname" . }}
# spec
${0}
snippet annotations_spec
{{- if .Values.$1.service.annotations }}
annotations:
{{ toYaml .Values.${1:value_key}.service.annotations | indent 4 }}
{{- end }}
${0}
snippet labels_spec
labels:
{{- if .Values.$1.service.labels }}
{{ toYaml .Values.$1.service.labels | indent 4 }}
{{- end }}
app: {{ template "$2.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
component: "{{ .Values.$1.name }}"
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
name: {{ template "${2:chartName}.${1:value_key}.fullname" . }}
${0}
snippet service_spec
spec:
type: "{{ .Values.$1.service.type }}"
clusterIP: "{{ .Values.$1.service.clusterIP }}"
{{- if .Values.$1.service.externalIPs }}
externalIPs:
{{ toYaml .Values.$1.service.externalIPs | indent 4 }}
{{- end }}
{{- if .Values.$1.service.loadBalancerIP }}
loadBalancerIP: "{{ .Values.$1.service.loadBalancerIP }}"
{{- end }}
{{- if .Values.$1.service.loadBalancerSourceRanges }}
loadBalancerSourceRanges:
{{ toYaml .Values.$1.service.loadBalancerSourceRanges | indent 4 }}
{{- end }}
{{- if and (semverCompare ">=1.7-0" .Capabilities.KubeVersion.GitVersion) (.Values.$1.service.externalTrafficPolicy) }}
externalTrafficPolicy: "{{ .Values.$1.service.externalTrafficPolicy }}"
{{- end }}
{{- if and (semverCompare ">=1.7-0" .Capabilities.KubeVersion.GitVersion) (.Values.$1.service.healthCheckNodePort) }}
healthCheckNodePort: {{ .Values.${1:value_key}.service.healthCheckNodePort }}
{{- end }}
${0}
snippet ports_spec
ports:
${0}
snippet portHTTP_spec
- name: http
port: 80
protocol: TCP
targetPort: {{ .Values.$1.service.targetPorts.http }}
{{- if (and (eq .Values.$1.service.type "NodePort") (not (empty .Values.$1.service.nodePorts.http))) }}
nodePort: {{ .Values.${1:value_key}.service.nodePorts.http }}
{{- end }}
${0}
snippet portHTTPS_spec
- name: https
port: 443
protocol: TCP
targetPort: {{ .Values.$1.service.targetPorts.https }}
{{- if (and (eq .Values.$1.service.type "NodePort") (not (empty .Values.$1.service.nodePorts.https))) }}
nodePort: {{ .Values.${1:value_key}.service.nodePorts.https }}
{{- end }}
${0}
snippet portTCP_spec
{{- range $key, $value := .Values.tcp }}
- name: "{{ $key }}-tcp"
port: {{ $key }}
protocol: TCP
targetPort: "{{ $key }}-tcp"
{{- end }}
${0}
snippet portUDP_spec
{{- range $key, $value := .Values.udp }}
- name: "{{ $key }}-udp"
port: {{ $key }}
protocol: UDP
targetPort: "{{ $key }}-udp"
{{- end }}
${0}
snippet selector_spec
selector:
app: {{ template "${2:chartName}.name" . }}
component: "{{ .Values.${1:value_key}.name }}"
release: {{ .Release.Name }}
${0}
snippet deploy_sample_spec
{{- if .Values.$1.enabled }}
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
labels:
app: {{ template "$2.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
component: "{{ .Values.$1.name }}"
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
name: {{ template "$2.$1.fullname" . }}
spec:
replicas: {{ .Values.$1.replicaCount }}
revisionHistoryLimit: {{ .Values.revisionHistoryLimit }}
template:
metadata:
{{- if .Values.$1.podAnnotations }}
annotations:
{{ toYaml .Values.$1.podAnnotations | indent 8 }}
{{- end }}
labels:
app: {{ template "$2.name" . }}
component: "{{ .Values.$1.name }}"
release: {{ .Release.Name }}
{{- if .Values.$1.podLabels }}
{{ toYaml .Values.$1.podLabels | indent 8 }}
{{- end }}
spec:
{{- if .Values.imagePullSecrets }}
imagePullSecrets:
{{ toYaml .Values.imagePullSecrets | indent 8 }}
{{- end }}
containers:
- name: {{ template "${2:chartName}.name" . }}-{{ .Values.$1.name }}
image: "{{ .Values.$1.image.repository }}:{{ .Values.$1.image.tag }}"
imagePullPolicy: "{{ .Values.$1.image.pullPolicy }}"
args:
{{- range $key, $value := .Values.$1.extraArgs }}
{{- if $value }}
- --{{ $key }}={{ $value }}
{{- else }}
- --{{ $key }}
{{- end }}
{{- end }}
livenessProbe:
httpGet:
path: /healthz
port: 8080
scheme: HTTP
initialDelaySeconds: 30
timeoutSeconds: 5
ports:
- name: http
containerPort: 8080
protocol: TCP
resources:
{{ toYaml .Values.$1.resources | indent 12 }}
{{- if .Values.$1.nodeSelector }}
nodeSelector:
{{ toYaml .Values.$1.nodeSelector | indent 8 }}
{{- end }}
{{- if .Values.$1.tolerations }}
tolerations:
{{ toYaml .Values.$1.tolerations | indent 8 }}
{{- end }}
{{- if .Values.$1.affinity }}
affinity:
{{ toYaml .Values.${1:value_key}.affinity | indent 8 }}
{{- end }}
terminationGracePeriodSeconds: 60
{{- end }}
snippet deploy_spec
{{- if .Values.$1.enabled }}
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
labels:
app: {{ template "$2.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
component: "{{ .Values.$1.name }}"
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
name: {{ template "${2:chartName}.${1:value_key}.fullname" . }}
# spec
# containers_spec
# livenessProbe_spec
# PersistentVolumeClaim_spec
# initContainers_spec
# resources_spec
# nodeselector_spec
# tolerations_spec
# affinity_spec
${0}
snippet spec_spec
spec:
replicas: {{ .Values.$1.replicaCount }}
revisionHistoryLimit: {{ .Values.revisionHistoryLimit }}
template:
metadata:
{{- if .Values.$1.podAnnotations }}
annotations:
{{ toYaml .Values.$1.podAnnotations | indent 8 }}
{{- end }}
labels:
app: {{ template "${2:chartName}.name" . }}
component: "{{ .Values.$1.name }}"
release: {{ .Release.Name }}
{{- if .Values.$1.podLabels }}
{{ toYaml .Values.${1:value_key}.podLabels | indent 8 }}
{{- end }}
spec:
{{- if .Values.imagePullSecrets }}
imagePullSecrets:
{{ toYaml .Values.imagePullSecrets | indent 8 }}
{{- end }}
${0}
snippet imagePullSecrets_spec
{{- if .Values.imagePullSecrets }}
imagePullSecrets:
{{ toYaml .Values.imagePullSecrets | indent 8 }}
{{- end }}
${0}
snippet imagePullPolicy_spec
imagePullPolicy: ${1:imagePullPolicy}
${0}
snippet containers_spec
containers:
- name: {{ template "${2:chartName}.name" . }}-{{ .Values.$1.name }}
image: "{{ .Values.$1.image.repository }}:{{ .Values.$1.image.tag }}"
imagePullPolicy: "{{ .Values.${1:value_key}.image.pullPolicy }}"
${0}
snippet args_spec
args:
{{- range $key, $value := .Values.${1:value_key}.extraArgs }}
{{- if $value }}
- --{{ $key }}={{ $value }}
{{- else }}
- --{{ $key }}
{{- end }}
{{- end }}
${0}
snippet livenessProbe_spec
livenessProbe:
httpGet:
path: /healthz
port: 8080
scheme: HTTP
initialDelaySeconds: 30
timeoutSeconds: 5
${0}
snippet readinessProbe_spec
readinessProbe:
httpGet:
path: /go/api/v1/health
port: 8153
initialDelaySeconds: {{ .Values.$1.healthCheck.initialDelaySeconds }}
periodSeconds: {{ .Values.$1.healthCheck.periodSeconds }}
failureThreshold: {{ .Values.$1.healthCheck.failureThreshold }}
${0}
snippet resources_spec
resources:
{{ toYaml .Values.${1:value_key}.resources | indent 12 }}
${0}
snippet nodeselector_spec
{{- if .Values.$1.nodeSelector }}
nodeSelector:
{{ toYaml .Values.${1:value_key}.nodeSelector | indent 8 }}
{{- end }}
${0}
snippet tolerations_spec
{{- if .Values.$1.tolerations }}
tolerations:
{{ toYaml .Values.${1:value_key}.tolerations | indent 8 }}
{{- end }}
${0}
snippet affinity_spec
{{- if .Values.$1.affinity }}
affinity:
{{ toYaml .Values.${1:value_key}.affinity | indent 8 }}
{{- end }}
terminationGracePeriodSeconds: 60
{{- end }}
${0}
snippet PersistentVolumeClaim_spec
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: {{ template "${2}.$1.fullname" . }}
labels:
app: {{ template "${2:chartName}.name" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
spec:
accessModes:
- {{ .Values.$1.persistence.accessMode | quote }}
resources:
requests:
storage: {{ .Values.$1.persistence.size | quote }}
{{- if .Values.$1.persistence.storageClass }}
{{- if (eq "-" .Values.$1.persistence.storageClass) }}
storageClassName: ""
{{- else }}
storageClassName: "{{ .Values.${1:value_key}.persistence.storageClass }}"
{{- end }}
{{- end }}
{{- end }}
{{- end }}
${0}
snippet configMap_spec
{{- if .Values.artifactory.enabled -}}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "${2:chartName}.fullname" . }}-${1:value_key}-config
labels:
app: {{ template "${2}.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
data:
${3:nameOfConfigFile}.conf: |
# data goes here
{{- end -}}
${0}
snippet initContainers_spec
{{- if .Values.$1.initContainers }}
initContainers:
- name: wait-workers
image: "{{ .Values.$1.image.repository }}:{{ .Values.$1.image.tag }}"
imagePullPolicy: {{ .Values.${1:value_key}.image.pullPolicy }}
# env
command:
- sh
- -c
- |
until printf "." && nc -z -w 2 {{ template "${2:chartName}.fullname" . }} {{ .Values.postgresql.service.port }}; do
sleep 2;
done;
echo 'PostgreSQL OK ✓'
# args
{{- end }}
${0}
snippet pvc_spec
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: {{ template "$2.fullname" . }}
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
app: {{ template "${2:chartName}.fullname" . }}
spec:
accessModes:
- {{ .Values.persistence.accessMode | quote }}
resources:
requests:
storage: {{ .Values.persistence.size | quote }}
{{- if .Values.persistence.storageClass }}
{{- if (eq "-" .Values.persistence.storageClass) }}
storageClassName: ""
{{- else }}
storageClassName: "{{ .Values.persistence.storageClass }}"
{{- end }}
{{- end }}
{{- end }}
${0}
snippet pv_nfs_spec
apiVersion: v1
kind: PersistentVolume
metadata:
name: {{ template "$2.fullname" . }}-data-pv
labels:
app: {{ template "$2.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
id: {{ template "${2:chartName}.name" . }}-data-pv
type: nfs-volume
spec:
capacity:
storage: {{ .Values.$1.persistence.nfs.capacity }}
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Retain
nfs:
server: {{ .Values.$1.persistence.nfs.ip }}
path: "{{ .Values.${1:value_key}.persistence.nfs.haDataMount }}"
readOnly: false
${0}
snippet pvc_hostpath_spec
{{- if and .Values.persistence.enabled .Values.persistence.$1.hostPath (not
.Values.persistence.$1.existingClaim) -}}
apiVersion: v1
kind: PersistentVolume
metadata:
name: {{ template "${2:chartName}.fullname" . }}-$1
spec:
accessModes:
- {{ .Values.persistence.$1.accessMode | quote }}
capacity:
storage: {{ .Values.persistence.$1.size | quote }}
hostPath:
path: {{ .Values.persistence.${1:value_key}.hostPath | quote }}
{{- end -}}
${0}
snippet deploy_values
$1:
name: ${1:value_key}
image:
repository:
tag:
pullPolicy: IfNotPresent
hostNetwork: false
dnsPolicy: ClusterFirst
daemonset:
useHostPort: false
podLabels: {}
scope:
enabled: false
namespace: "" # defaults to .Release.Namespace
extraArgs: {}
extraEnvs: []
kind: Deployment
updateStrategy: {}
minReadySeconds: 0
tolerations: []
affinity: {}
nodeSelector: {}
podAnnotations: {}
replicaCount: 1
minAvailable: 1
resources: {}
autoscaling:
enabled: false
extraContainers: {}
extraVolumeMounts: {}
extraVolumes: {}
extraInitContainers: []
lifecycle: {}
revisionHistoryLimit: 10
${0}
snippet rbac_values
${1:value_key}:
rbac:
create: true
serviceAccount:
create: true
name:
imagePullSecrets: []
${0}
snippet service_values
${1:value_key}:
service:
annotations: {}
labels: {}
clusterIP: ""
externalIPs: []
loadBalancerIP: ""
loadBalancerSourceRanges: []
externalTrafficPolicy: ""
healthCheckNodePort: 0
targetPorts:
http: http
https: https
type: LoadBalancer
nodePorts:
http: ""
https: ""
${0}
snippet readinessProbe_values
${1:value_key}:
readinessProbe:
failureThreshold: 3
initialDelaySeconds: 10
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
port: 10254
${0}
snippet livenessProbe_values
${1:value_key}:
livenessProbe:
failureThreshold: 3
initialDelaySeconds: 10
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
port: 10254
${0}

View File

@ -0,0 +1,270 @@
snippet steps
steps {
sh '${1:make check}'
junit '${2:reports/**/*.xml}'
}
${0}
snippet stage
stage('${1:Test}'){
steps {
sh '${2:make check}'
junit '${3:reports/**/*.xml}'
}
}
${0}
snippet pipeline
pipeline {
agent any
stages {
stage('${1:Build}') {
steps {
sh '${2:make}'
}
}
}
}
${0}
snippet pipeline_sample
pipeline {
agent any
stages {
stage('${1:Build}') {
steps {
sh '${2:make}'
}
}
stage('${3:Test}'){
steps {
sh '${4:make check}'
junit '${5:reports/**/*.xml}'
}
}
stage('${6:Deploy}') {
steps {
sh '${7:make publish}'
}
}
}
}
${0}
snippet d
docker {
image '${1:myregistry.com/node'}'
label '${2:my-defined-label'}'
registryUrl '${3:https://myregistry.com/'}'
registryCredentialsId '${4:myPredefinedCredentialsInJenkins'}'
}
snippet df
dockerfile {
filename '${1:Dockerfile.build}'
dir '${2:build}'
label '${3:my-defined-label}'
registryUrl '${4:https://myregistry.com/}'
registryCredentialsId '${5:myPredefinedCredentialsInJenkins}'
}
snippet pa
post {
always {
${1}
}
}
${0}
snippet pc
post {
changed {
${1}
}
}
${0}
snippet pf
post {
fixed {
${1}
}
}
${0}
snippet pr
post {
regression {
${1}
}
}
${0}
snippet pab
post {
aborted {
${1}
}
}
${0}
snippet pfa
post {
failure {
${1}
}
}
${0}
snippet ps
post {
success {
${1}
}
}
${0}
snippet pu
post {
unstable {
${1}
}
}
${0}
snippet pc
post {
cleanup {
${1}
}
}
${0}
snippet psss
pipeline {
agent any
stages {
stage('${1:Build}') {
steps {
sh '${2:make}'
}
}
}
${0}
snippet sss
stages {
stage('${1:Build}') {
steps {
sh '${2:make}'
}
}
}
${0}
snippet parameters
parameters{
${1}
}
${0}
snippet paramtext
text(name: "${1:BIOGRAPHY}" , defaultValue: "${2:default}" , description: "${3:Enter some information about the person}")
${0}
snippet parambool
booleanParam(name: "${1:TOGGLE}" , defaultValue: ${2:default}, description: "${3:Toggle this value}")
${0}
snippet paramchoice
choice(name: "${1:CHOICE}" , choices: ["${2:Choices}",] , description: "${3:Pick something}")
${0}
snippet parampassword
password(name: "${1:PASSWORD}" , defaultValue: "${2:SECRET}" , description: "${3:Enter a password}")
${0}
snippet paramfile
file(name: "${1:FILE}" , description: "${2:Choose a file to upload}")${0}
${0}
snippet triggers
triggers {
cron('${1:H */4 * * 1-5}')
}
${0}
snippet input
input {
message '${1:Should we continue?}'
ok '${2:Yes, we should.}'
submitter '${3:alice,bob}'
parameters {
string(name: '${4:PERSON}' , defaultValue: '${5:Mr Jenkins}' , description: '${6:Who should I say hello to?}')
}
}
${0}
snippet whenbranch
when {
branch '${1:branch}'
}
${0}
snippet whenbuildingTag
when {
buildingTag '${1:tag}'
}
${0}
snippet whenchangelog
when {
changelog '${1:changelog}'
}
${0}
snippet whenchangeset
when {
changeset '${1:changeSet}'
}
${0}
snippet whenchangeRequest
when {
changeRequest '${1:changeRequest}'
}
${0}
snippet whenenvironment
when {
environment '${1:environment}'
}
${0}
snippet whenequals
when {
equals '${1:equals}'
}
${0}
snippet whenexpression
when {
expression '${1:expression}'
}
${0}
snippet whentag
when {
tag '${1:tag}'
}
${0}
snippet whennot
when {
not '${1:not}'
}
${0}
snippet whenallOf
when {
allOf '${1:allOf}'
}
${0}
snippet whenanyOf
when {
anyOf '${1:anyOf}'
}