├── .gitconfig_example ├── .github └── ISSUE_TEMPLATE │ └── bug_report.md ├── .gitignore ├── .pre-commit-config.yaml ├── .secrets.baseline ├── CODE_OF_CONDUCT.md ├── LICENSE ├── OWNERS ├── README.md ├── _config.yml ├── dependency-matrix ├── matrix.md └── matrix.yaml ├── dev-env ├── dev-env-zsh ├── docs └── goland.md ├── env ├── cloud │ ├── .bashrc │ ├── .tmux.conf.local │ └── .vimrc ├── default │ └── .vim │ │ ├── colors │ │ └── molokai_dark.vim │ │ └── syntax │ │ └── groovy.vim ├── env.sh └── mac │ ├── .bashrc │ ├── .tmux.conf.local │ └── .vimrc └── jenkins-x.yml /.gitconfig_example: -------------------------------------------------------------------------------- 1 | [user] 2 | name = 3 | email = 4 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Desktop (please complete the following information):** 27 | - OS: [e.g. iOS] 28 | - Browser [e.g. chrome, safari] 29 | - Version [e.g. 22] 30 | 31 | **Smartphone (please complete the following information):** 32 | - Device: [e.g. iPhone6] 33 | - OS: [e.g. iOS8.1] 34 | - Browser [e.g. stock browser, safari] 35 | - Version [e.g. 22] 36 | 37 | **Additional context** 38 | Add any other context about the problem here. 39 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | env/custom-env.sh -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | repos: 2 | - repo: git://github.com/pre-commit/pre-commit-hooks 3 | rev: v2.2.3 4 | hooks: 5 | - id: check-added-large-files 6 | - id: check-executables-have-shebangs 7 | - id: check-merge-conflict 8 | - id: check-symlinks 9 | - id: detect-private-key 10 | - id: end-of-file-fixer 11 | - id: trailing-whitespace 12 | -------------------------------------------------------------------------------- /.secrets.baseline: -------------------------------------------------------------------------------- 1 | { 2 | "exclude": { 3 | "files": null, 4 | "lines": null 5 | }, 6 | "generated_at": "2019-07-25T11:11:08Z", 7 | "plugins_used": [ 8 | { 9 | "name": "AWSKeyDetector" 10 | }, 11 | { 12 | "name": "ArtifactoryDetector" 13 | }, 14 | { 15 | "base64_limit": 4.5, 16 | "name": "Base64HighEntropyString" 17 | }, 18 | { 19 | "name": "BasicAuthDetector" 20 | }, 21 | { 22 | "hex_limit": 3, 23 | "name": "HexHighEntropyString" 24 | }, 25 | { 26 | "name": "KeywordDetector" 27 | }, 28 | { 29 | "name": "PrivateKeyDetector" 30 | }, 31 | { 32 | "name": "SlackDetector" 33 | }, 34 | { 35 | "name": "StripeDetector" 36 | } 37 | ], 38 | "results": {}, 39 | "version": "0.12.5" 40 | } 41 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, sex characteristics, gender identity and expression, 9 | level of experience, education, socio-economic status, nationality, personal 10 | appearance, race, religion, or sexual identity and orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Using welcoming and inclusive language 18 | * Being respectful of differing viewpoints and experiences 19 | * Gracefully accepting constructive criticism 20 | * Focusing on what is best for the community 21 | * Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | * The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | * Trolling, insulting/derogatory comments, and personal or political attacks 28 | * Public or private harassment 29 | * Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | * Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies both within project spaces and in public spaces 49 | when an individual is representing the project or its community. Examples of 50 | representing a project or community include using an official project e-mail 51 | address, posting via an official social media account, or acting as an appointed 52 | representative at an online or offline event. Representation of a project may be 53 | further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior should be reported. 58 | The project team is obligated to maintain confidentiality with regard to the reporter 59 | of an incident. Further details of specific enforcement policies may be posted separately. 60 | 61 | Project maintainers who do not follow or enforce the Code of Conduct in good 62 | faith may face temporary or permanent repercussions as determined by other 63 | members of the project's leadership. 64 | 65 | ## Attribution 66 | 67 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 68 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 69 | 70 | [homepage]: https://www.contributor-covenant.org 71 | 72 | For answers to common questions about this code of conduct, see 73 | https://www.contributor-covenant.org/faq 74 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Cai Cooper 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /OWNERS: -------------------------------------------------------------------------------- 1 | approvers: 2 | - rawlingsj 3 | - jstrachan 4 | - ccojocar 5 | - garethjevans 6 | - pmuir 7 | - warrenbailey 8 | - cagiti 9 | - macox 10 | reviewers: 11 | - rawlingsj 12 | - jstrachan 13 | - ccojocar 14 | - garethjevans 15 | - pmuir 16 | - warrenbailey 17 | - cagiti 18 | - macox 19 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # dev-env 2 | _A development environment built upon docker._ 3 | 4 | ## overview 5 | The intention of this project is to provide the necessary tools and packages required for a standard golang development environment which is convenient and accessible. The dev-env is built upon the an [alpine 3.10 golang image](https://hub.docker.com/_/golang), this includes the following tools/packages: 6 | - [golang](https://golang.org/) 7 | - [groovy](http://groovy-lang.org/) 8 | - [git](https://git-scm.com/) 9 | - [hub](https://github.com/github/hub) 10 | - [vi](https://www.vim.org/) 11 | - [golang plugin](https://github.com/fatih/vim-go) 12 | - [buffer switcher](https://github.com/manniwood/vim-buf) 13 | - [groovy syntax highlighting](https://github.com/vim-scripts/groovy.vim) 14 | - [gcloud](https://cloud.google.com/sdk/gcloud/) 15 | - [helm](https://helm.sh/) 16 | - [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/) 17 | - [jx](https://github.com/jenkins-x/jx) 18 | - [dep](https://github.com/golang/dep) 19 | - [ko](https://github.com/google/go-containerregistry/tree/master/cmd/ko) 20 | - [delve](https://github.com/go-delve/delve) 21 | - [pre-commit](https://pre-commit.com/) 22 | #### IDE 23 | - [GoLand](docs/goland.md) 24 | 25 | ## support 26 | The dev-env has only been verified on **MacOS**. It should _execute_ on other operating systems capable of running docker containers, but you may encounter issues. 27 | 28 | ## prerequisites 29 | You'll need [Docker](https://www.docker.com/) to use the dev-env, see [Docker for MacOS](https://hub.docker.com/editions/community/docker-ce-desktop-mac). 30 | 31 | ## run 32 | ### TMUX 33 | To execute the dev-env, perform the following: 34 | ``` 35 | $ git clone https://github.com/jenkins-x/dev-env 36 | $ cd dev-env 37 | $ ./dev-env 38 | ``` 39 | ### NO TMUX 40 | ``` 41 | $ git clone https://github.com/jenkins-x/dev-env 42 | $ cd dev-env 43 | $ ./dev-env no-tmux 44 | ``` 45 | 46 | ## tmux 47 | This environment uses tmux to manage its window sessions. The environment is configured with the configuration from [here](https://github.com/gpakosz/.tmux), so a big thank you to [Gregory Pakosz](https://github.com/gpakosz) for the tmux configuration). The tmux key bindings can be found [here](https://github.com/gpakosz/.tmux#bindings), with the exception of the **horizontal split** _below_ (overridden within the environments `.tmux.conf.local` file): 48 | - ` \` splits the current pane horizontally 49 | -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-cayman -------------------------------------------------------------------------------- /dependency-matrix/matrix.md: -------------------------------------------------------------------------------- 1 | # Dependency Matrix 2 | 3 | Dependency | Sources | Version | Mismatched versions 4 | ---------- | ------- | ------- | ------------------- 5 | [jenkins-x/dev-env-base](https://github.com/jenkins-x/dev-env-base) | | [0.0.618](https://github.com/jenkins-x/dev-env-base/releases/tag/v0.0.618) | 6 | [jenkins-x/jx](https://github.com/jenkins-x/jx) | [github.com/jenkins-x/dev-env-base](https://github.com/jenkins-x/dev-env-base.git) | [2.0.725](https://github.com/jenkins-x/jx/releases/tag/v2.0.725) | 7 | [lachlanevenson/k8s-kubectl](https://github.com/lachlanevenson/k8s-kubectl) | [github.com/jenkins-x/dev-env-base](https://github.com/jenkins-x/dev-env-base.git) | [v1.16.0]() | 8 | [jenkins-x/jenkins-x-versions](https://github.com/jenkins-x/jenkins-x-versions) | [github.com/jenkins-x/dev-env-base](https://github.com/jenkins-x/dev-env-base) | [2.1.46]() | 9 | -------------------------------------------------------------------------------- /dependency-matrix/matrix.yaml: -------------------------------------------------------------------------------- 1 | dependencies: 2 | - host: github.com 3 | owner: jenkins-x 4 | repo: dev-env-base 5 | url: https://github.com/jenkins-x/dev-env-base 6 | version: 0.0.618 7 | versionURL: https://github.com/jenkins-x/dev-env-base/releases/tag/v0.0.618 8 | - host: github.com 9 | owner: jenkins-x 10 | repo: jx 11 | sources: 12 | - path: 13 | - host: github.com 14 | owner: jenkins-x 15 | repo: dev-env-base 16 | url: https://github.com/jenkins-x/dev-env-base.git 17 | version: 0.0.312 18 | versionURL: https://github.com/jenkins-x/dev-env-base/releases/tag/v0.0.312 19 | version: 2.0.725 20 | versionURL: https://github.com/jenkins-x/jx/releases/tag/v2.0.725 21 | url: https://github.com/jenkins-x/jx 22 | version: 2.0.725 23 | versionURL: https://github.com/jenkins-x/jx/releases/tag/v2.0.725 24 | - host: github.com 25 | owner: lachlanevenson 26 | repo: k8s-kubectl 27 | sources: 28 | - path: 29 | - host: github.com 30 | owner: jenkins-x 31 | repo: dev-env-base 32 | url: https://github.com/jenkins-x/dev-env-base.git 33 | version: 0.0.357 34 | versionURL: https://github.com/jenkins-x/dev-env-base/releases/tag/v0.0.357 35 | version: v1.16.0 36 | versionURL: "" 37 | url: https://github.com/lachlanevenson/k8s-kubectl 38 | version: v1.16.0 39 | versionURL: "" 40 | - host: github.com 41 | owner: jenkins-x 42 | repo: jenkins-x-versions 43 | sources: 44 | - path: 45 | - host: github.com 46 | owner: jenkins-x 47 | repo: dev-env-base 48 | url: https://github.com/jenkins-x/dev-env-base 49 | version: 0.0.618 50 | versionURL: https://github.com/jenkins-x/dev-env-base/releases/tag/v0.0.618 51 | version: 2.1.46 52 | versionURL: "" 53 | url: https://github.com/jenkins-x/jenkins-x-versions 54 | version: 2.1.46 55 | versionURL: "" 56 | -------------------------------------------------------------------------------- /dev-env: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | DEV_ENV_BASE_VERSION=0.0.618 4 | PORTS="/tmp/.ports-$(head -c 4 /dev/urandom | xxd -p)-$(date +'%Y%m%d-%H%M%S')" 5 | touch "$PORTS" 6 | TMUX=true 7 | SCRIPT_HOME="$(dirname $BASH_SOURCE | sed 's:^\.$:'"$PWD"':g')" 8 | DEFAULT_GCLOUD_BIN="\/usr\/local\/google-cloud-sdk\/bin\/gcloud" 9 | [ ! -z "$CLOUD_SHELL" ] && ENV=cloud || ENV=mac 10 | source ./env/env.sh $ENV 11 | # load custom env variables if file exists: 12 | [[ -f ./env/custom-env.sh ]] && echo "loading custom env variables" && source ./env/custom-env.sh 13 | declare -a mounted_directories=("$WORKSPACE" "$GO_WORKSPACE" "${MOUNT}/.cache" "${MOUNT}/.config" "${MOUNT}/.docker" "${MOUNT}/.gnupg" "${MOUNT}/.groovy" "${MOUNT}/.gsutil" "${MOUNT}/.helm" "${MOUNT}/.jx" "${MOUNT}/.m2" "${MOUNT}/.terraform" "${MOUNT}/.terraform.d") 14 | declare -a mounted_files=("${MOUNT}/.gitcookies" "${MOUNT}/.bash_history" "${MOUNT}/.boto") 15 | 16 | if [ -n "$1" ] && [[ "$1" == "no-tmux" ]] 17 | then 18 | TMUX=false 19 | fi 20 | 21 | function setup_workspace(){ 22 | if [[ ! -d $GO_WORKSPACE ]] 23 | then 24 | mkdir -p $GO_WORKSPACE 25 | fi 26 | } 27 | 28 | function setup_mount(){ 29 | if [[ ! -d $MOUNT ]] 30 | then 31 | mkdir -p $MOUNT 32 | fi 33 | } 34 | 35 | function setup_environment(){ 36 | if [ ! -d $MOUNT/.kube ] 37 | then 38 | mkdir $MOUNT/.kube 39 | chmod 755 $MOUNT/.kube 40 | if [ -d ~/.kube ] 41 | then 42 | cp -r ~/.kube $MOUNT 43 | if [ -f $MOUNT/.kube/config ] 44 | then 45 | sed -i "s:^\(.*cmd-path\: \).*$:\1$DEFAULT_GCLOUD_BIN:" $MOUNT/.kube/config 46 | fi 47 | fi 48 | fi 49 | 50 | if [[ -f $MOUNT/.bashrc ]] 51 | then 52 | echo ".bashrc file exists in ${MOUNT}" 53 | echo "renaming .bashrc to .bash_profile" 54 | mv ${MOUNT}/.bashrc ${MOUNT}/.bash_profile 55 | fi 56 | 57 | if [[ ! -f $MOUNT/.gitconfig ]] 58 | then 59 | echo ".gitconfig file does not exist in ${MOUNT}" 60 | echo "copying .gitconfig to ${MOUNT}" 61 | if [[ -f ~/.gitconfig ]] 62 | then 63 | cp ~/.gitconfig ${MOUNT}/.gitconfig 64 | else 65 | echo "No ~/.gitconfig file found" 66 | echo "Please create the following file: ~/.gitconfig" 67 | cat ./.gitconfig_example 68 | exit 1 69 | fi 70 | else 71 | echo "Using ${MOUNT}/.gitconfig" 72 | fi 73 | 74 | if [[ -f ~/.config/gh/config.yml ]] 75 | then 76 | if [[ ! -f ${MOUNT}/.config/gh/config.yml ]] 77 | then 78 | echo "~/.config/gh/config.yml file does not exist in ${MOUNT}" 79 | echo "copying ~/.config/gh/config.yml to ${MOUNT}" 80 | cp ~/.config/gh/config.yml ${MOUNT}/.config/gh/config.yml 81 | fi 82 | else 83 | echo "GH cli is not authorized locally" 84 | echo "Please authorise to enable it" 85 | fi 86 | 87 | echo "checking that the environment file have been created" 88 | for file in "${mounted_files[@]}" 89 | do 90 | if [ ! -f ${file} ] 91 | then 92 | echo "${file} file doesn't exist, creating..." 93 | touch ${file} 94 | fi 95 | done 96 | 97 | echo "initializing mounted directories" 98 | for dir in "${mounted_directories[@]}" 99 | do 100 | mkdir -p ${dir} 101 | done 102 | } 103 | 104 | function run(){ 105 | 106 | if $TMUX 107 | then 108 | CONTAINER_COMMAND="tmux -u" 109 | else 110 | CONTAINER_COMMAND="bash" 111 | fi 112 | 113 | rm "$PORTS" 114 | $SUDO docker run --name dev-env-$(head -c 4 /dev/urandom | xxd -p)-$(date +'%Y%m%d-%H%M%S') \ 115 | --rm \ 116 | --tty \ 117 | --env TERM=screen-256color \ 118 | --env USER=$USER \ 119 | --env HOSTNAME=$HOSTNAME \ 120 | --interactive \ 121 | --publish 8080:8080 \ 122 | --publish 8443:8443 \ 123 | --publish 1313:1313 \ 124 | --publish 2345:2345 \ 125 | --volume /home/developer/go-workspace/bin \ 126 | --volume $WORKSPACE:/home/developer/workspace:rw \ 127 | --volume $GO_WORKSPACE:/home/developer/go-workspace:cached \ 128 | --volume $MOUNT/.bash_history:/home/developer/.bash_history:cached \ 129 | --volume $MOUNT/.bash_profile:/home/developer/.bash_profile:cached \ 130 | --volume $MOUNT/.boto:/home/developer/.boto:cached \ 131 | --volume $MOUNT/.cache:/home/developer/.cache:cached \ 132 | --volume $MOUNT/.config:/home/developer/.config:cached \ 133 | --volume $MOUNT/.docker:/home/developer/.docker:cached \ 134 | --volume $MOUNT/.gitconfig:/home/developer/.gitconfig:cached \ 135 | --volume $MOUNT/.gnupg:/home/developer/.gnupg:cached \ 136 | --volume $MOUNT/.groovy:/home/developer/.groovy:cached \ 137 | --volume $MOUNT/.gsutil:/home/developer/.gsutil:cached \ 138 | --volume $MOUNT/.helm:/home/developer/.helm:cached \ 139 | --volume $MOUNT/.jx:/home/developer/.jx:cached \ 140 | --volume $MOUNT/.kube:/home/developer/.kube:cached \ 141 | --volume $MOUNT/.m2:/home/developer/.m2:cached \ 142 | --volume $MOUNT/.terraform:/home/developer/.terraform:cached \ 143 | --volume $MOUNT/.terraform.d:/home/developer/.terraform.d:cached \ 144 | --volume $SSH:/home/developer/.ssh:rw \ 145 | --volume $DOCKER_SOCKET:/var/run/docker.sock \ 146 | ${kube} \ 147 | gcr.io/jenkinsxio/dev-env-base:$DEV_ENV_BASE_VERSION-go-alpine $CONTAINER_COMMAND 148 | } 149 | 150 | setup_workspace 151 | setup_mount 152 | setup_environment 153 | run 154 | -------------------------------------------------------------------------------- /dev-env-zsh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | DEV_ENV_BASE_VERSION=0.0.618 4 | PORTS="/tmp/.ports-$(head -c 4 /dev/urandom | xxd -p)-$(date +'%Y%m%d-%H%M%S')" 5 | touch "$PORTS" 6 | SCRIPT_HOME="$(dirname $BASH_SOURCE | sed 's:^\.$:'"$PWD"':g')" 7 | DEFAULT_GCLOUD_BIN="\/usr\/local\/google-cloud-sdk\/bin\/gcloud" 8 | [ ! -z "$CLOUD_SHELL" ] && ENV=cloud || ENV=mac 9 | source ./env/env.sh $ENV 10 | # load custom env variables if file exists: 11 | [[ -f ./env/custom-env.sh ]] && echo "loading custom env variables" && source ./env/custom-env.sh 12 | declare -a mounted_directories=("$WORKSPACE" "$GO_WORKSPACE" "${MOUNT}/.cache" "${MOUNT}/.config" "${MOUNT}/.docker" "${MOUNT}/.gnupg" "${MOUNT}/.groovy" "${MOUNT}/.gsutil" "${MOUNT}/.helm" "${MOUNT}/.jx" "${MOUNT}/.m2" "${MOUNT}/.terraform" "${MOUNT}/.terraform.d") 13 | declare -a mounted_files=("${MOUNT}/.gitcookies" "${MOUNT}/.zsh_history" "${MOUNT}/.boto") 14 | 15 | function setup_workspace(){ 16 | if [[ ! -d $GO_WORKSPACE ]] 17 | then 18 | mkdir -p $GO_WORKSPACE 19 | fi 20 | } 21 | 22 | function setup_mount(){ 23 | if [[ ! -d $MOUNT ]] 24 | then 25 | mkdir -p $MOUNT 26 | fi 27 | } 28 | 29 | function get_unused_port() { 30 | for port in $(seq 8000 9000); 31 | do 32 | if [ $(grep -c "$port" "$PORTS") -eq 0 ] 33 | then 34 | nc -zv 127.0.0.1 $port > /dev/null 2>&1 35 | [ $? -eq 1 ] \ 36 | && echo $port >> "$PORTS"\ 37 | && echo "$port" \ 38 | && break; 39 | fi 40 | done 41 | } 42 | 43 | function setup_environment(){ 44 | if [ ! -d $MOUNT/.kube ] 45 | then 46 | mkdir $MOUNT/.kube 47 | chmod 755 $MOUNT/.kube 48 | if [ -d ~/.kube ] 49 | then 50 | cp -r ~/.kube $MOUNT 51 | if [ -f $MOUNT/.kube/config ] 52 | then 53 | sed -i "s:^\(.*cmd-path\: \).*$:\1$DEFAULT_GCLOUD_BIN:" $MOUNT/.kube/config 54 | fi 55 | fi 56 | fi 57 | 58 | if [[ -f $MOUNT/.bashrc ]] 59 | then 60 | echo ".bashrc file exists in ${MOUNT}" 61 | echo "renaming .bashrc to .bash_profile" 62 | mv ${MOUNT}/.bashrc ${MOUNT}/.bash_profile 63 | fi 64 | if [[ ! -f $MOUNT/.gitconfig ]] 65 | then 66 | echo ".gitconfig file does not exist in ${MOUNT}" 67 | echo "copying .gitconfig to ${MOUNT}" 68 | if [[ -f ~/.gitconfig ]] 69 | then 70 | cp ~/.gitconfig ${MOUNT}/.gitconfig 71 | else 72 | echo "No ~/.gitconfig file found" 73 | echo "Please create the following file: ~/.gitconfig" 74 | cat ./.gitconfig_example 75 | exit 1 76 | fi 77 | else 78 | echo "Using ${MOUNT}/.gitconfig" 79 | fi 80 | 81 | echo "checking that the environment file have been created" 82 | for file in "${mounted_files[@]}" 83 | do 84 | if [ ! -f ${file} ] 85 | then 86 | echo "${file} file doesn't exist, creating..." 87 | touch ${file} 88 | fi 89 | done 90 | 91 | echo "initializing mounted directories" 92 | for dir in "${mounted_directories[@]}" 93 | do 94 | mkdir -p ${dir} 95 | done 96 | } 97 | 98 | function run(){ 99 | $SUDO docker run --name dev-env-$(head -c 4 /dev/urandom | xxd -p)-$(date +'%Y%m%d-%H%M%S') \ 100 | --rm \ 101 | --tty \ 102 | --env TERM=screen-256color-bce \ 103 | --env USER=$USER \ 104 | --env HOSTNAME=$HOSTNAME \ 105 | --interactive \ 106 | --volume /home/developer/go-workspace/bin \ 107 | --volume $MOUNT/.config:/home/developer/.config:cached \ 108 | --volume $MOUNT/.docker:/home/developer/.docker:cached \ 109 | --volume $MOUNT/.gitconfig:/home/developer/.gitconfig:cached \ 110 | --volume $MOUNT/.gnupg:/home/developer/.gnupg:cached \ 111 | --volume $MOUNT/.groovy:/home/developer/.groovy:cached \ 112 | --volume $MOUNT/.gsutil:/home/developer/.gsutil:cached \ 113 | --volume $MOUNT/.helm:/home/developer/.helm:cached \ 114 | --volume $MOUNT/.jx:/home/developer/.jx:cached \ 115 | --volume $MOUNT/.kube:/home/developer/.kube:cached \ 116 | --volume $MOUNT/.zsh_profile:/home/developer/.zsh_profile:cached \ 117 | --volume $MOUNT/.zsh_history:/home/developer/.zsh_history:cached \ 118 | --volume $MOUNT/.boto:/home/developer/.boto:cached \ 119 | --volume $MOUNT/.cache:/home/developer/.cache:cached \ 120 | --volume $MOUNT/.m2:/home/developer/.m2:cached \ 121 | --volume $MOUNT/.terraform:/home/developer/.terraform:cached \ 122 | --volume $MOUNT/.terraform.d:/home/developer/.terraform.d:cached \ 123 | --volume $WORKSPACE:/home/developer/workspace:rw \ 124 | --volume $GO_WORKSPACE:/home/developer/go-workspace:cached \ 125 | ${kube} \ 126 | --volume $SSH:/home/developer/.ssh:rw \ 127 | --volume $DOCKER_SOCKET:/var/run/docker.sock \ 128 | gcr.io/jenkinsxio/dev-env-base:$DEV_ENV_BASE_VERSION-go-alpine-zsh tmux -u 129 | } 130 | 131 | setup_workspace 132 | setup_mount 133 | setup_environment 134 | run 135 | -------------------------------------------------------------------------------- /docs/goland.md: -------------------------------------------------------------------------------- 1 | # GoLand 2 | _This is a guide for executing goland using a docker container. The container image is maintained by [rycus86](https://hub.docker.com/r/rycus86/goland/)_ 3 | 4 | ## overview 5 | The intention of executing [GoLand](https://www.jetbrains.com/go/) through a docker container is to enable an easier upgrade path with minimal user maintenance. 6 | 7 | ## prerequisites 8 | You'll need: 9 | - [Docker](https://www.docker.com/), see [Docker for MacOS](https://hub.docker.com/editions/community/docker-ce-desktop-mac). 10 | - [XQuartz](https://www.xquartz.org/) 11 | 12 | ## run 13 | To execute the dev-env, perform the following: 14 | 1. Start XQuartz from command line using 15 | ``` 16 | open -a XQuartz 17 | ``` 18 | 2. In the XQuartz preferences, go to the “Security” tab and make sure you’ve got “Allow connections from network clients” ticked. 19 | 20 | 3. Then execute goland using the following docker run command: 21 | ### MacOS 22 | ``` 23 | $ docker run --rm \ 24 | --detach \ 25 | --env DISPLAY=$(hostname):0 \ 26 | --security-opt=seccomp:unconfined \ 27 | --volume ${DISPLAY/:0}:/tmp/.X11-unix \ 28 | --volume ~/.GoLand:/home/developer/.GoLand \ 29 | --volume ~/.GoLand.java:/home/developer/.java \ 30 | --volume ~/Development/go-workspace:/home/developer/go \ 31 | --name goland-$(head -c 4 /dev/urandom | xxd -p)-$(date +'%Y%m%d-%H%M%S') \ 32 | rycus86/goland:latest 33 | ``` 34 | 35 | ### Ubuntu 36 | ``` 37 | $ docker run --rm \ 38 | --detach \ 39 | --security-opt=seccomp:unconfined \ 40 | --volume /tmp/.X11-unix:/tmp/.X11-unix \ 41 | --volume ~/.GoLand:/home/developer/.GoLand \ 42 | --volume ~/.GoLand.java:/home/developer/.java \ 43 | --volume ~/Development/go-workspace:/home/developer/go \ 44 | --name goland-$(head -c 4 /dev/urandom | xxd -p)-$(date +'%Y%m%d-%H%M%S') \ 45 | rycus86/goland:latest 46 | ``` 47 | 48 | ## support 49 | The execution of this GoLand container has only been verified on **MacOS**. 50 | -------------------------------------------------------------------------------- /env/cloud/.bashrc: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | export PS1='$(echo -e "'"\U1F645"'") \[\033[32m\]\u \[\033[33m\]\w($(git branch 2>/dev/null | sed -n "s/* \(.*\)/\1/p"))\[\033[00m\]$ ' 4 | export JAVA_HOME=$(dirname $(readlink -f $(which java)) | sed 's:/bin::') 5 | 6 | function load_ssh_key(){ 7 | if [ -z "$SSH_AUTH_SOCK" ] ; then 8 | eval `ssh-agent -s` >/dev/null 9 | ssh-add >/dev/null 2>/dev/null 10 | fi 11 | } 12 | 13 | function setup_aliases(){ 14 | alias l='ls -l' 15 | alias ll='ls -la' 16 | alias tmux='tmux -u' 17 | alias t='tmux -u' 18 | alias kc='kubectl' 19 | alias wkc='tmux split-window -h "kubectl get pods -w"; tmux split-window -v "kubectl get prowjobs -w"; tmux split-window -v "kubectl get pipelinerun -w"; watch jx logs -k' 20 | } 21 | 22 | function setup_hub(){ 23 | eval "$(hub alias -s)" 24 | } 25 | 26 | setup_aliases 27 | load_ssh_key 28 | setup_hub 29 | set -o vi 30 | -------------------------------------------------------------------------------- /env/cloud/.tmux.conf.local: -------------------------------------------------------------------------------- 1 | set -g default-command bash 2 | bind \ split-window -h 3 | tmux_conf_theme_status_left=' ❐ #S | ↑#{?uptime_d, #{uptime_d}d,}#{?uptime_h, #{uptime_h}h,}#{?uptime_m, #{uptime_m}m,} ' 4 | tmux_conf_theme_status_right='#{prefix}#{pairing}#{synchronized} , #(if [ `jx env -b | grep -c "prod"` -gt 0 ]; then tmux set -g window-style 'fg=white,bg=red'; jx env -b; else tmux set -g window-style 'fg=default,bg=default'; jx env -b; fi), #(curl 'wttr.in?format=2') , load: #{loadavg} ,%d %b %R, #{hostname} ' 5 | -------------------------------------------------------------------------------- /env/cloud/.vimrc: -------------------------------------------------------------------------------- 1 | " map '§' as Escape for iPad 2 | imap § 3 | 4 | " enable vim features instead of strict vi compatibility 5 | set nocompatible 6 | 7 | " do not wrap long lines; have them scroll off the side 8 | set nowrap 9 | 10 | " try to detect the filetype 11 | filetype on 12 | 13 | " enable syntax highlighting 14 | syntax on 15 | 16 | " enable loading the plugin file for specific file types 17 | filetype plugin on 18 | 19 | " enable loading the indent file for specific file types 20 | filetype indent on 21 | 22 | " tell vim it's OK to use 256 colors at the terminal 23 | set t_Co=256 24 | 25 | " show matching brackets and parens 26 | set showmatch 27 | 28 | " don't bother redrawing during macros and such 29 | "set lazyredraw 30 | 31 | " use pop-up menu for tab completion of filenames 32 | set wildmenu 33 | 34 | " sync syntax highlighting in a 5000-line window 35 | " syntax sync minlines=5000 36 | 37 | " sync syntax highlighting from the start of the file 38 | syntax sync fromstart 39 | 40 | " do not make backup~ files 41 | set nobackup 42 | set nowritebackup 43 | 44 | " set character encoding to UTF-8 45 | set encoding=utf-8 46 | 47 | " show 3 lines above or below cursor when scrolling 48 | set scrolloff=3 49 | 50 | " show insert, replace, or visual mode in last line 51 | set showmode 52 | 53 | " show command in last line 54 | set showcmd 55 | 56 | " highlight the line the cursor is on 57 | " set cursorline " leave off for now; ugly when listing hidden chars 58 | 59 | " turn on line numbers 60 | set number 61 | 62 | " flash screen on bell 63 | set visualbell 64 | 65 | " assumes fast connection 66 | set ttyfast 67 | 68 | " show line and column number 69 | set ruler 70 | 71 | " every window gets a status line 72 | set laststatus=2 73 | 74 | " switch off search pattern highlighting 75 | set nohlsearch 76 | 77 | " make command line one line high 78 | set ch=1 79 | 80 | " turn off mouse pointer when typing begins 81 | set mousehide 82 | 83 | " put mouse in command-line mode, so mouse clicks don't move cursor 84 | set mouse=c 85 | 86 | " set molokai_dark color scheme 87 | colorscheme molokai_dark 88 | 89 | " set leader to comma 90 | let mapleader = "," 91 | 92 | " local leader to backslash. (local leader is used for only specific file 93 | " types) 94 | let maplocalleader = "\\" 95 | 96 | " Searching 97 | " ------------ 98 | " Highlight matches in search 99 | set hlsearch 100 | 101 | " Turn off search highlight when done 102 | nnoremap :nohlsearch 103 | 104 | " Listing unprintable chars 105 | " ------------ 106 | " Change vertical split character from a bar to a space 107 | " (so note that trailing space here is significant) 108 | set fillchars+=vert:\ 109 | 110 | " Show spaces and tabs; to turn off for copying, use `:set nolist` 111 | set listchars=tab:→\ ,space:·,trail:·,nbsp:· 112 | 113 | " Default to listing hidden chars 114 | set list 115 | 116 | " Toggle listing hidden chars 117 | nnoremap :set list! 118 | 119 | " Status Line 120 | " ------------ 121 | " %< means truncate on the left if too long 122 | " %F is full path to the file we are editing 123 | set statusline=%<%F 124 | 125 | " %m shows [+] if the file is modified but not saved 126 | set statusline+=%m 127 | 128 | " %r shows [RO] if a file is read-only 129 | set statusline+=%r 130 | 131 | " %h shows [Help] if we are in a help buffer 132 | set statusline+=%h 133 | 134 | " %w shows [Preview] if we are in a preview window 135 | set statusline+=%w 136 | 137 | " separation point between the left and right items 138 | set statusline+=%= 139 | 140 | " prints the fileformat; that is, the kind of newline (one of unix, dos or mac) 141 | " (If you type `:set fileformat?`, vim will tell you the current file format) 142 | set statusline+=%{&fileformat} 143 | 144 | " a literal forward slash 145 | set statusline+=/ 146 | 147 | " %Y shows the filetype, such as VIM or HTML or GO 148 | set statusline+=%Y 149 | 150 | " %l shows the line number, and %8l uses 8 left-padded spaces to do so 151 | set statusline+=%8l 152 | 153 | " a literal comma 154 | set statusline+=, 155 | 156 | " %v shows the virtual column number; 157 | " instead of counting a tab as one char, it counts it as the number 158 | " of spaces it uses in the display 159 | " %-8v leaves 8 spaces to the right to do so 160 | set statusline+=%-8v 161 | 162 | " disable recording macros: I hit this key accidentally too often 163 | nnoremap q 164 | 165 | " Window Manipulation 166 | " ------------------- 167 | " Note to self: 168 | " :resize will resize a horizontal split, *and* you can give it 169 | " relative lines, like :resize +5 or :resize -5 170 | " :vertical resize can be used for vertical splits. 171 | 172 | " remap window switching to leader then navigation letter 173 | nnoremap j 174 | nnoremap k 175 | nnoremap l 176 | nnoremap h 177 | 178 | " remap window equal resizing to leader equals 179 | nnoremap = 180 | 181 | " when opening horizontal splits, place cursor in new split 182 | set splitbelow 183 | 184 | " when opening vertical splits, place cursor in new split 185 | set splitright 186 | 187 | function DestroyButKeepWindow() 188 | " get the number of the buffer we will close 189 | let l:current_bufnum = bufnr('%') 190 | " open a new empty buffer in this window 191 | enew 192 | " destroy the original buffer 193 | execute "bdelete " . l:current_bufnum 194 | endfunction 195 | 196 | " Make :Bd call the window closer 197 | command Bd call DestroyButKeepWindow() 198 | 199 | " Explore 200 | " ------- 201 | " Note to self: 202 | " :Explore brings up explorer 203 | " :Sexplore brings up explorer in a horizontal split 204 | " :Vexplore brings up explorer in a vertical split 205 | 206 | " Remove explorer banner 207 | let g:netrw_banner = 0 208 | 209 | " Ruby 210 | " ---- 211 | augroup filetype_ruby 212 | autocmd! 213 | autocmd FileType ruby setlocal shiftwidth=2 214 | autocmd FileType ruby setlocal softtabstop=2 215 | autocmd FileType ruby setlocal expandtab 216 | augroup END 217 | 218 | " Golang 219 | " ------ 220 | augroup filetype_golang 221 | " when we use :make, autosave file; used by vim-go 222 | set autowrite 223 | 224 | autocmd! 225 | autocmd FileType go setlocal shiftwidth=2 226 | autocmd FileType go setlocal tabstop=2 227 | autocmd FileType go setlocal softtabstop=0 228 | autocmd FileType go setlocal noexpandtab 229 | "autocmd FileType go nmap d (go-def-vertical) 230 | "autocmd FileType go nmap D (go-doc-vertical) 231 | "autocmd FileType go nmap b (go-doc-browser) 232 | "autocmd FileType go nmap i (go-implements) 233 | "autocmd FileType go nmap n (go-info) 234 | "autocmd FileType go nmap r (go-rename) 235 | augroup END 236 | let g:go_highlight_array_whitespace_error = 1 237 | let g:go_highlight_chan_whitespace_error = 1 238 | let g:go_highlight_space_tab_error = 1 239 | let g:go_highlight_trailing_whitespace_error = 1 240 | let g:go_highlight_format_strings = 1 241 | let g:go_highlight_types = 1 242 | let g:go_highlight_fields = 1 243 | let g:go_highlight_functions = 1 244 | let g:go_highlight_methods = 1 245 | let g:go_highlight_structs = 1 246 | let g:go_highlight_operators = 1 247 | let g:go_highlight_extra_types = 1 248 | let g:go_highlight_build_constraints = 1 249 | let g:go_highlight_generate_tags = 1 250 | let g:go_fmt_command = "goimports" 251 | let g:go_metalinter_enabled = ['vet', 'golint', 'errcheck'] 252 | "These next two were too invasive, so I disabled them. 253 | "let g:go_metalinter_autosave = 1 254 | "let g:go_metalinter_autosave_enabled = ['vet', 'golint', 'errcheck'] 255 | "This next one was too distracting (but cool!); just use :GoInfo 256 | "let g:go_auto_type_info = 1 257 | 258 | " Use j and k to navigate up and down autocomplete, 259 | " at the expense of not being able to type j and k 260 | inoremap j ((pumvisible())?("\"):("j")) 261 | inoremap k ((pumvisible())?("\"):("k")) 262 | 263 | au BufNewFile,BufRead Jenkinsfile* setf groovy 264 | au BufNewFile,BufRead *.groovy setf groovy 265 | -------------------------------------------------------------------------------- /env/default/.vim/colors/molokai_dark.vim: -------------------------------------------------------------------------------- 1 | " Vim color file 2 | " 3 | " Author: Tomas Restrepo 4 | " https://github.com/flazz/vim-colorschemes 5 | " 6 | " Note: Based on the monokai theme for textmate 7 | " by Wimer Hazenberg and its darker variant 8 | " by Hamish Stuart Macpherson 9 | " by Eric Zhang for make it even darker and look 10 | " cooler 11 | 12 | hi clear 13 | 14 | set background=dark 15 | if version > 580 16 | " no guarantees for version 5.8 and below, but this makes it stop 17 | " complaining 18 | hi clear 19 | if exists("syntax_on") 20 | syntax reset 21 | endif 22 | endif 23 | let g:colors_name="molokai" 24 | 25 | hi Boolean guifg=#CC0000 gui=bold 26 | hi Character guifg=#E6DB74 27 | hi Number guifg=#AE81FF 28 | hi String guifg=#44DD00 29 | hi Conditional guifg=#F92672 gui=bold 30 | hi Constant guifg=#8302C3 gui=bold 31 | hi Cursor guifg=#000000 guibg=#F8F8F0 32 | hi iCursor guifg=#000000 guibg=#F8F8F0 33 | hi Debug guifg=#BCA3A3 gui=bold 34 | hi Define guifg=#66D9EF 35 | hi Delimiter guifg=#8F8F8F 36 | hi DiffAdd guibg=#13354A 37 | hi DiffChange guifg=#89807D guibg=#4C4745 38 | hi DiffDelete guifg=#960050 guibg=#1E0010 39 | hi DiffText guibg=#4C4745 gui=italic,bold 40 | 41 | hi Directory guifg=#A6E22E gui=bold 42 | hi Error guifg=#E6DB74 guibg=#1E0010 43 | hi ErrorMsg guifg=#F92672 guibg=#232526 gui=bold 44 | hi Exception guifg=#A6E22E gui=bold 45 | hi Float guifg=#AE81FF 46 | hi FoldColumn guifg=#465457 guibg=#000000 47 | hi Folded guifg=#465457 guibg=#000000 48 | hi Function guifg=#A6E22E 49 | hi Identifier guifg=#FD971F 50 | hi Ignore guifg=#808080 guibg=bg 51 | hi IncSearch guifg=#C4BE89 guibg=#000000 52 | 53 | hi Keyword guifg=#F92672 gui=bold 54 | hi Label guifg=#E6DB74 gui=bold 55 | hi Macro guifg=#D5A102 gui=italic 56 | hi SpecialKey guifg=#66D9EF gui=italic 57 | 58 | hi MatchParen guifg=#000000 guibg=#FD971F gui=bold 59 | hi ModeMsg guifg=#E6DB74 60 | hi MoreMsg guifg=#E6DB74 61 | hi Operator guifg=#F92672 62 | 63 | " complete menu 64 | hi Pmenu guifg=#66D9EF guibg=#000000 65 | hi PmenuSel guibg=#808080 66 | hi PmenuSbar guibg=#080808 67 | hi PmenuThumb guifg=#66D9EF 68 | 69 | hi PreCondit guifg=#A6E22E gui=bold 70 | hi PreProc guifg=#A6E22E 71 | hi Question guifg=#66D9EF 72 | hi Repeat guifg=#F92672 gui=bold 73 | hi Search guifg=#FFFFFF guibg=#455354 74 | " marks 75 | hi SignColumn guifg=#A6E22E guibg=#232526 76 | hi SpecialChar guifg=#DC322F gui=bold 77 | hi SpecialComment guifg=#7E8E91 gui=bold 78 | hi Special guifg=#66D9EF guibg=bg gui=italic 79 | if has("spell") 80 | hi SpellBad guisp=#FF0000 gui=undercurl 81 | hi SpellCap guisp=#7070F0 gui=undercurl 82 | hi SpellLocal guisp=#70F0F0 gui=undercurl 83 | hi SpellRare guisp=#FFFFFF gui=undercurl 84 | endif 85 | hi Statement guifg=#CC0000 gui=bold 86 | hi StatusLine guifg=#455354 guibg=fg gui=bold,reverse 87 | hi StatusLineNC guifg=#808080 guibg=#080808 88 | hi StorageClass guifg=#FD971F gui=italic 89 | hi Structure guifg=#66D9EF gui=bold 90 | hi Tag guifg=#F92672 gui=italic 91 | hi Title guifg=#ef5939 92 | hi Todo guifg=#FFFFFF guibg=bg gui=bold 93 | 94 | hi Typedef guifg=#66D9EF 95 | hi Type guifg=#66D9EF gui=bold 96 | hi Underlined guifg=#808080 gui=underline 97 | 98 | hi VertSplit guifg=#808080 guibg=#080808 gui=bold 99 | hi VisualNOS guibg=#403D3D 100 | hi Visual guibg=#403D3D 101 | hi WarningMsg guifg=#FFFFFF guibg=#333333 gui=bold 102 | hi WildMenu guifg=#66D9EF guibg=#000000 103 | 104 | hi TabLineFill guifg=#1B1D1E guibg=#1B1D1E 105 | hi TabLine guibg=#1B1D1E guifg=#808080 gui=none 106 | 107 | 108 | hi Normal guifg=#F6F6F0 guibg=#000000 109 | hi Comment guifg=#7E8E91 110 | hi CursorLine guibg=#293739 111 | hi CursorLineNr guifg=#FD971F gui=none 112 | hi CursorColumn guibg=#293739 113 | hi ColorColumn guibg=#232526 114 | hi LineNr guifg=#465457 guibg=#232526 115 | hi NonText guifg=#465457 gui=bold 116 | hi SpecialKey guifg=#465457 117 | 118 | " 119 | " Support for 256-color terminal 120 | " 121 | if &t_Co > 255 122 | hi Normal ctermfg=252 ctermbg=233 123 | hi CursorLine ctermbg=234 cterm=none 124 | hi CursorLineNr ctermfg=208 cterm=none 125 | hi Boolean ctermfg=135 126 | hi Character ctermfg=144 127 | hi Number ctermfg=135 128 | hi String ctermfg=144 129 | hi Conditional ctermfg=161 cterm=bold 130 | hi Constant ctermfg=135 cterm=bold 131 | hi Cursor ctermfg=16 ctermbg=253 132 | hi Debug ctermfg=225 cterm=bold 133 | hi Define ctermfg=81 134 | hi Delimiter ctermfg=241 135 | 136 | hi DiffAdd ctermbg=24 137 | hi DiffChange ctermfg=181 ctermbg=239 138 | hi DiffDelete ctermfg=162 ctermbg=53 139 | hi DiffText ctermbg=102 cterm=bold 140 | 141 | hi Directory ctermfg=118 cterm=bold 142 | hi Error ctermfg=219 ctermbg=89 143 | hi ErrorMsg ctermfg=199 ctermbg=16 cterm=bold 144 | hi Exception ctermfg=118 cterm=bold 145 | hi Float ctermfg=135 146 | hi FoldColumn ctermfg=67 ctermbg=16 147 | hi Folded ctermfg=67 ctermbg=16 148 | hi Function ctermfg=118 149 | hi Identifier ctermfg=208 cterm=none 150 | hi Ignore ctermfg=244 ctermbg=232 151 | hi IncSearch ctermfg=193 ctermbg=16 152 | 153 | hi keyword ctermfg=161 cterm=bold 154 | hi Label ctermfg=229 cterm=none 155 | hi Macro ctermfg=193 156 | hi SpecialKey ctermfg=81 157 | 158 | hi MatchParen ctermfg=208 ctermbg=233 cterm=bold 159 | hi ModeMsg ctermfg=229 160 | hi MoreMsg ctermfg=229 161 | hi Operator ctermfg=161 162 | 163 | " complete menu 164 | hi Pmenu ctermfg=81 ctermbg=16 165 | hi PmenuSel ctermfg=81 ctermbg=244 166 | hi PmenuSbar ctermbg=232 167 | hi PmenuThumb ctermfg=81 168 | 169 | hi PreCondit ctermfg=118 cterm=bold 170 | hi PreProc ctermfg=118 171 | hi Question ctermfg=81 172 | hi Repeat ctermfg=161 cterm=bold 173 | hi Search ctermfg=253 ctermbg=66 174 | 175 | " marks column 176 | hi SignColumn ctermfg=118 ctermbg=235 177 | hi SpecialChar ctermfg=161 cterm=bold 178 | hi SpecialComment ctermfg=245 cterm=bold 179 | hi Special ctermfg=81 180 | if has("spell") 181 | hi SpellBad ctermbg=52 182 | hi SpellCap ctermbg=17 183 | hi SpellLocal ctermbg=17 184 | hi SpellRare ctermfg=none ctermbg=none cterm=reverse 185 | endif 186 | hi Statement ctermfg=161 cterm=bold 187 | hi StatusLine ctermfg=238 ctermbg=253 188 | hi StatusLineNC ctermfg=244 ctermbg=232 189 | hi StorageClass ctermfg=208 190 | hi Structure ctermfg=81 191 | hi Tag ctermfg=161 192 | hi Title ctermfg=166 193 | hi Todo ctermfg=231 ctermbg=232 cterm=bold 194 | 195 | hi Typedef ctermfg=81 196 | hi Type ctermfg=81 cterm=none 197 | hi Underlined ctermfg=244 cterm=underline 198 | 199 | hi VertSplit ctermfg=244 ctermbg=232 cterm=bold 200 | hi VisualNOS ctermbg=238 201 | hi Visual ctermbg=235 202 | hi WarningMsg ctermfg=231 ctermbg=238 cterm=bold 203 | hi WildMenu ctermfg=81 ctermbg=16 204 | 205 | hi Comment ctermfg=59 206 | hi CursorColumn ctermbg=236 207 | hi ColorColumn ctermbg=236 208 | hi LineNr ctermfg=250 ctermbg=236 209 | hi NonText ctermfg=59 210 | 211 | hi SpecialKey ctermfg=59 212 | 213 | if exists("g:rehash256") && g:rehash256 == 1 214 | hi Normal ctermfg=252 ctermbg=234 215 | hi CursorLine ctermbg=236 cterm=none 216 | hi CursorLineNr ctermfg=208 cterm=none 217 | 218 | hi Boolean ctermfg=141 219 | hi Character ctermfg=222 220 | hi Number ctermfg=141 221 | hi String ctermfg=222 222 | hi Conditional ctermfg=197 cterm=bold 223 | hi Constant ctermfg=141 cterm=bold 224 | 225 | hi DiffDelete ctermfg=125 ctermbg=233 226 | 227 | hi Directory ctermfg=154 cterm=bold 228 | hi Error ctermfg=222 ctermbg=233 229 | hi Exception ctermfg=154 cterm=bold 230 | hi Float ctermfg=141 231 | hi Function ctermfg=154 232 | hi Identifier ctermfg=208 233 | 234 | hi Keyword ctermfg=197 cterm=bold 235 | hi Operator ctermfg=197 236 | hi PreCondit ctermfg=154 cterm=bold 237 | hi PreProc ctermfg=154 238 | hi Repeat ctermfg=197 cterm=bold 239 | 240 | hi Statement ctermfg=197 cterm=bold 241 | hi Tag ctermfg=197 242 | hi Title ctermfg=203 243 | hi Visual ctermbg=238 244 | 245 | hi Comment ctermfg=244 246 | hi LineNr ctermfg=239 ctermbg=235 247 | hi NonText ctermfg=239 248 | hi SpecialKey ctermfg=239 249 | endif 250 | end 251 | -------------------------------------------------------------------------------- /env/default/.vim/syntax/groovy.vim: -------------------------------------------------------------------------------- 1 | " Vim syntax file 2 | " Language: Groovy 3 | " Maintainer: Alessio Pace 4 | " Version: 0.1.9b 5 | " URL: http://www.vim.org/scripts/script.php?script_id=945 6 | " Last Change: 6/4/2004 7 | 8 | " This is my very first vim script, I hope to have 9 | " done it the right way. 10 | " 11 | " I must directly or indirectly thank the author of java.vim and ruby.vim: 12 | " I copied from them most of the stuff :-) 13 | " 14 | " Relies on html.vim 15 | 16 | " For version 5.x: Clear all syntax items 17 | " For version 6.x: Quit when a syntax file was already loaded 18 | " 19 | " HOWTO USE IT (INSTALL): 20 | " [groovy is still not recognized by vim! :-( ] 21 | " 22 | " 1) copy the file in the (global or user's $HOME/.vim/syntax/) syntax folder 23 | " 24 | " 2) add this line to recognize groovy files by filename extension: 25 | " 26 | " au BufNewFile,BufRead *.groovy setf groovy 27 | " in the global vim filetype.vim file or inside $HOME/.vim/filetype.vim 28 | " 29 | " 3) add this part to recognize by content groovy script (no extension needed :-) 30 | " 31 | " if did_filetype() 32 | " finish 33 | " endif 34 | " if getline(1) =~ '^#!.*[/\\]groovy\>' 35 | " setf groovy 36 | " endif 37 | " 38 | " in the global scripts.vim file or in $HOME/.vim/scripts.vim 39 | " 40 | " 4) open/write a .groovy file or a groovy script :-) 41 | " 42 | " Let me know if you like it or send me patches, so that I can improve it 43 | " when I have time 44 | 45 | " Quit when a syntax file was already loaded 46 | if !exists("main_syntax") 47 | if version < 600 48 | syntax clear 49 | elseif exists("b:current_syntax") 50 | finish 51 | endif 52 | " we define it here so that included files can test for it 53 | let main_syntax='groovy' 54 | endif 55 | 56 | " don't use standard HiLink, it will not work with included syntax files 57 | if version < 508 58 | command! -nargs=+ GroovyHiLink hi link 59 | else 60 | command! -nargs=+ GroovyHiLink hi def link 61 | endif 62 | 63 | " ########################## 64 | " Java stuff taken from java.vim 65 | " some characters that cannot be in a groovy program (outside a string) 66 | " syn match groovyError "[\\@`]" 67 | "syn match groovyError "<<<\|\.\.\|=>\|<>\|||=\|&&=\|[^-]->\|\*\/" 68 | "syn match groovyOK "\.\.\." 69 | 70 | " keyword definitions 71 | syn keyword groovyExternal native package 72 | syn match groovyExternal "\\)\?" 73 | syn keyword groovyError goto const 74 | syn keyword groovyConditional if else switch 75 | syn keyword groovyRepeat while for do 76 | syn keyword groovyBoolean true false 77 | syn keyword groovyConstant null 78 | syn keyword groovyTypedef this super 79 | syn keyword groovyOperator new instanceof 80 | syn keyword groovyType boolean char byte short int long float double 81 | syn keyword groovyType void 82 | syn keyword groovyType Integer Double Date Boolean Float String Array Vector List 83 | syn keyword groovyStatement return 84 | syn keyword groovyStorageClass static synchronized transient volatile final strictfp serializable 85 | syn keyword groovyExceptions throw try catch finally 86 | syn keyword groovyAssert assert 87 | syn keyword groovyMethodDecl synchronized throws 88 | syn keyword groovyClassDecl extends implements interface 89 | " to differentiate the keyword class from MyClass.class we use a match here 90 | syn match groovyTypedef "\.\s*\"ms=s+1 91 | syn keyword groovyClassDecl enum 92 | syn match groovyClassDecl "^class\>" 93 | syn match groovyClassDecl "[^.]\s*\"ms=s+1 94 | syn keyword groovyBranch break continue nextgroup=groovyUserLabelRef skipwhite 95 | syn match groovyUserLabelRef "\k\+" contained 96 | syn keyword groovyScopeDecl public protected private abstract 97 | 98 | 99 | if exists("groovy_highlight_groovy_lang_ids") || exists("groovy_highlight_groovy_lang") || exists("groovy_highlight_all") 100 | " groovy.lang.* 101 | syn keyword groovyLangClass Closure MetaMethod GroovyObject 102 | 103 | syn match groovyJavaLangClass "\" 104 | syn keyword groovyJavaLangClass Cloneable Comparable Runnable Serializable Boolean Byte Class Object 105 | syn keyword groovyJavaLangClass Character CharSequence ClassLoader Compiler 106 | " syn keyword groovyJavaLangClass Integer Double Float Long 107 | syn keyword groovyJavaLangClass InheritableThreadLocal Math Number Object Package Process 108 | syn keyword groovyJavaLangClass Runtime RuntimePermission InheritableThreadLocal 109 | syn keyword groovyJavaLangClass SecurityManager Short StrictMath StackTraceElement 110 | syn keyword groovyJavaLangClass StringBuffer Thread ThreadGroup 111 | syn keyword groovyJavaLangClass ThreadLocal Throwable Void ArithmeticException 112 | syn keyword groovyJavaLangClass ArrayIndexOutOfBoundsException AssertionError 113 | syn keyword groovyJavaLangClass ArrayStoreException ClassCastException 114 | syn keyword groovyJavaLangClass ClassNotFoundException 115 | syn keyword groovyJavaLangClass CloneNotSupportedException Exception 116 | syn keyword groovyJavaLangClass IllegalAccessException 117 | syn keyword groovyJavaLangClass IllegalArgumentException 118 | syn keyword groovyJavaLangClass IllegalMonitorStateException 119 | syn keyword groovyJavaLangClass IllegalStateException 120 | syn keyword groovyJavaLangClass IllegalThreadStateException 121 | syn keyword groovyJavaLangClass IndexOutOfBoundsException 122 | syn keyword groovyJavaLangClass InstantiationException InterruptedException 123 | syn keyword groovyJavaLangClass NegativeArraySizeException NoSuchFieldException 124 | syn keyword groovyJavaLangClass NoSuchMethodException NullPointerException 125 | syn keyword groovyJavaLangClass NumberFormatException RuntimeException 126 | syn keyword groovyJavaLangClass SecurityException StringIndexOutOfBoundsException 127 | syn keyword groovyJavaLangClass UnsupportedOperationException 128 | syn keyword groovyJavaLangClass AbstractMethodError ClassCircularityError 129 | syn keyword groovyJavaLangClass ClassFormatError Error ExceptionInInitializerError 130 | syn keyword groovyJavaLangClass IllegalAccessError InstantiationError 131 | syn keyword groovyJavaLangClass IncompatibleClassChangeError InternalError 132 | syn keyword groovyJavaLangClass LinkageError NoClassDefFoundError 133 | syn keyword groovyJavaLangClass NoSuchFieldError NoSuchMethodError 134 | syn keyword groovyJavaLangClass OutOfMemoryError StackOverflowError 135 | syn keyword groovyJavaLangClass ThreadDeath UnknownError UnsatisfiedLinkError 136 | syn keyword groovyJavaLangClass UnsupportedClassVersionError VerifyError 137 | syn keyword groovyJavaLangClass VirtualMachineError 138 | 139 | syn keyword groovyJavaLangObject clone equals finalize getClass hashCode 140 | syn keyword groovyJavaLangObject notify notifyAll toString wait 141 | 142 | GroovyHiLink groovyLangClass groovyConstant 143 | GroovyHiLink groovyJavaLangClass groovyExternal 144 | GroovyHiLink groovyJavaLangObject groovyConstant 145 | syn cluster groovyTop add=groovyJavaLangObject,groovyJavaLangClass,groovyLangClass 146 | syn cluster groovyClasses add=groovyJavaLangClass,groovyLangClass 147 | endif 148 | 149 | 150 | " Groovy stuff 151 | syn match groovyOperator "\.\." 152 | syn match groovyOperator "<\{2,3}" 153 | syn match groovyOperator ">\{2,3}" 154 | syn match groovyOperator "->" 155 | syn match groovyExternal '^#!.*[/\\]groovy\>' 156 | syn match groovyExceptions "\\|\<[A-Z]\{1,}[a-zA-Z0-9]*Exception\>" 157 | 158 | " Groovy JDK stuff 159 | syn keyword groovyJDKBuiltin as def in 160 | syn keyword groovyJDKOperOverl div minus plus abs round power multiply 161 | syn keyword groovyJDKMethods each call inject sort print println 162 | syn keyword groovyJDKMethods getAt putAt size push pop toList getText writeLine eachLine readLines 163 | syn keyword groovyJDKMethods withReader withStream withWriter withPrintWriter write read leftShift 164 | syn keyword groovyJDKMethods withWriterAppend readBytes splitEachLine 165 | syn keyword groovyJDKMethods newInputStream newOutputStream newPrintWriter newReader newWriter 166 | syn keyword groovyJDKMethods compareTo next previous isCase 167 | syn keyword groovyJDKMethods times step toInteger upto any collect dump every find findAll grep 168 | syn keyword groovyJDKMethods inspect invokeMethods join 169 | syn keyword groovyJDKMethods getErr getIn getOut waitForOrKill 170 | syn keyword groovyJDKMethods count tokenize asList flatten immutable intersect reverse reverseEach 171 | syn keyword groovyJDKMethods subMap append asWritable eachByte eachLine eachFile 172 | syn cluster groovyTop add=groovyJDKBuiltin,groovyJDKOperOverl,groovyJDKMethods 173 | 174 | " no useful I think, so I comment it.. 175 | "if filereadable(expand(":p:h")."/groovyid.vim") 176 | " source :p:h/groovyid.vim 177 | "endif 178 | 179 | if exists("groovy_space_errors") 180 | if !exists("groovy_no_trail_space_error") 181 | syn match groovySpaceError "\s\+$" 182 | endif 183 | if !exists("groovy_no_tab_space_error") 184 | syn match groovySpaceError " \+\t"me=e-1 185 | endif 186 | endif 187 | 188 | " it is a better case construct than java.vim to match groovy syntax 189 | syn region groovyLabelRegion transparent matchgroup=groovyLabel start="\" matchgroup=NONE end=":\|$" contains=groovyNumber,groovyString,groovyLangClass,groovyJavaLangClass 190 | syn match groovyUserLabel "^\s*[_$a-zA-Z][_$a-zA-Z0-9_]*\s*:"he=e-1 contains=groovyLabel 191 | syn keyword groovyLabel default 192 | 193 | if !exists("groovy_allow_cpp_keywords") 194 | syn keyword groovyError auto delete extern friend inline redeclared 195 | syn keyword groovyError register signed sizeof struct template typedef union 196 | syn keyword groovyError unsigned operator 197 | endif 198 | 199 | " The following cluster contains all groovy groups except the contained ones 200 | syn cluster groovyTop add=groovyExternal,groovyError,groovyError,groovyBranch,groovyLabelRegion,groovyLabel,groovyConditional,groovyRepeat,groovyBoolean,groovyConstant,groovyTypedef,groovyOperator,groovyType,groovyType,groovyStatement,groovyStorageClass,groovyAssert,groovyExceptions,groovyMethodDecl,groovyClassDecl,groovyClassDecl,groovyClassDecl,groovyScopeDecl,groovyError,groovyError2,groovyUserLabel,groovyLangObject 201 | 202 | 203 | " Comments 204 | syn keyword groovyTodo contained TODO FIXME XXX 205 | if exists("groovy_comment_strings") 206 | syn region groovyCommentString contained start=+"+ end=+"+ end=+$+ end=+\*/+me=s-1,he=s-1 contains=groovySpecial,groovyCommentStar,groovySpecialChar,@Spell 207 | syn region groovyComment2String contained start=+"+ end=+$\|"+ contains=groovySpecial,groovySpecialChar,@Spell 208 | syn match groovyCommentCharacter contained "'\\[^']\{1,6\}'" contains=groovySpecialChar 209 | syn match groovyCommentCharacter contained "'\\''" contains=groovySpecialChar 210 | syn match groovyCommentCharacter contained "'[^\\]'" 211 | syn cluster groovyCommentSpecial add=groovyCommentString,groovyCommentCharacter,groovyNumber 212 | syn cluster groovyCommentSpecial2 add=groovyComment2String,groovyCommentCharacter,groovyNumber 213 | endif 214 | syn region groovyComment start="/\*" end="\*/" contains=@groovyCommentSpecial,groovyTodo,@Spell 215 | syn match groovyCommentStar contained "^\s*\*[^/]"me=e-1 216 | syn match groovyCommentStar contained "^\s*\*$" 217 | syn match groovyLineComment "//.*" contains=@groovyCommentSpecial2,groovyTodo,@Spell 218 | syn match groovyLineComment "#.*" contains=@groovyCommentSpecial2,groovyTodo,@Spell 219 | GroovyHiLink groovyCommentString groovyString 220 | GroovyHiLink groovyComment2String groovyString 221 | GroovyHiLink groovyCommentCharacter groovyCharacter 222 | 223 | syn cluster groovyTop add=groovyComment,groovyLineComment 224 | 225 | if !exists("groovy_ignore_groovydoc") && main_syntax != 'jsp' 226 | syntax case ignore 227 | " syntax coloring for groovydoc comments (HTML) 228 | " syntax include @groovyHtml :p:h/html.vim 229 | syntax include @groovyHtml runtime! syntax/html.vim 230 | unlet b:current_syntax 231 | syn region groovyDocComment start="/\*\*" end="\*/" keepend contains=groovyCommentTitle,@groovyHtml,groovyDocTags,groovyTodo,@Spell 232 | syn region groovyCommentTitle contained matchgroup=groovyDocComment start="/\*\*" matchgroup=groovyCommentTitle keepend end="\.$" end="\.[ \t\r<&]"me=e-1 end="[^{]@"me=s-2,he=s-1 end="\*/"me=s-1,he=s-1 contains=@groovyHtml,groovyCommentStar,groovyTodo,@Spell,groovyDocTags 233 | 234 | syn region groovyDocTags contained start="{@\(link\|linkplain\|inherit[Dd]oc\|doc[rR]oot\|value\)" end="}" 235 | syn match groovyDocTags contained "@\(see\|param\|exception\|throws\|since\)\s\+\S\+" contains=groovyDocParam 236 | syn match groovyDocParam contained "\s\S\+" 237 | syn match groovyDocTags contained "@\(version\|author\|return\|deprecated\|serial\|serialField\|serialData\)\>" 238 | syntax case match 239 | endif 240 | 241 | " match the special comment /**/ 242 | syn match groovyComment "/\*\*/" 243 | 244 | " Strings and constants 245 | syn match groovySpecialError contained "\\." 246 | syn match groovySpecialCharError contained "[^']" 247 | syn match groovySpecialChar contained "\\\([4-9]\d\|[0-3]\d\d\|[\"\\'ntbrf]\|u\x\{4\}\)" 248 | syn region groovyString start=+"+ end=+"+ end=+$+ contains=groovySpecialChar,groovySpecialError,@Spell,groovyELExpr 249 | syn region groovyString start=+'+ end=+'+ end=+$+ contains=groovySpecialChar,groovySpecialError,@Spell,groovyELExpr 250 | " syn region groovyELExpr start=+${+ end=+}+ keepend contained 251 | syn match groovyELExpr /\${.\{-}}/ contained 252 | GroovyHiLink groovyELExpr Identifier 253 | 254 | " TODO: better matching. I am waiting to understand how it really works in groovy 255 | " syn region groovyClosureParamsBraces start=+|+ end=+|+ contains=groovyClosureParams 256 | " syn match groovyClosureParams "[ a-zA-Z0-9_*]\+" contained 257 | " GroovyHiLink groovyClosureParams Identifier 258 | 259 | " next line disabled, it can cause a crash for a long line 260 | "syn match groovyStringError +"\([^"\\]\|\\.\)*$+ 261 | 262 | " disabled: in groovy strings or characters are written the same 263 | " syn match groovyCharacter "'[^']*'" contains=groovySpecialChar,groovySpecialCharError 264 | " syn match groovyCharacter "'\\''" contains=groovySpecialChar 265 | " syn match groovyCharacter "'[^\\]'" 266 | syn match groovyNumber "\<\(0[0-7]*\|0[xX]\x\+\|\d\+\)[lL]\=\>" 267 | syn match groovyNumber "\(\<\d\+\.\d*\|\.\d\+\)\([eE][-+]\=\d\+\)\=[fFdD]\=" 268 | syn match groovyNumber "\<\d\+[eE][-+]\=\d\+[fFdD]\=\>" 269 | syn match groovyNumber "\<\d\+\([eE][-+]\=\d\+\)\=[fFdD]\>" 270 | 271 | " unicode characters 272 | syn match groovySpecial "\\u\d\{4\}" 273 | 274 | syn cluster groovyTop add=groovyString,groovyCharacter,groovyNumber,groovySpecial,groovyStringError 275 | 276 | if exists("groovy_highlight_functions") 277 | if groovy_highlight_functions == "indent" 278 | syn match groovyFuncDef "^\(\t\| \{8\}\)[_$a-zA-Z][_$a-zA-Z0-9_. \[\]]*([^-+*/()]*)" contains=groovyScopeDecl,groovyType,groovyStorageClass,@groovyClasses 279 | syn region groovyFuncDef start=+^\(\t\| \{8\}\)[$_a-zA-Z][$_a-zA-Z0-9_. \[\]]*([^-+*/()]*,\s*+ end=+)+ contains=groovyScopeDecl,groovyType,groovyStorageClass,@groovyClasses 280 | syn match groovyFuncDef "^ [$_a-zA-Z][$_a-zA-Z0-9_. \[\]]*([^-+*/()]*)" contains=groovyScopeDecl,groovyType,groovyStorageClass,@groovyClasses 281 | syn region groovyFuncDef start=+^ [$_a-zA-Z][$_a-zA-Z0-9_. \[\]]*([^-+*/()]*,\s*+ end=+)+ contains=groovyScopeDecl,groovyType,groovyStorageClass,@groovyClasses 282 | else 283 | " This line catches method declarations at any indentation>0, but it assumes 284 | " two things: 285 | " 1. class names are always capitalized (ie: Button) 286 | " 2. method names are never capitalized (except constructors, of course) 287 | syn region groovyFuncDef start=+^\s\+\(\(public\|protected\|private\|static\|abstract\|final\|native\|synchronized\)\s\+\)*\(\(void\|boolean\|char\|byte\|short\|int\|long\|float\|double\|\([A-Za-z_][A-Za-z0-9_$]*\.\)*[A-Z][A-Za-z0-9_$]*\)\(<[^>]*>\)\=\(\[\]\)*\s\+[a-z][A-Za-z0-9_$]*\|[A-Z][A-Za-z0-9_$]*\)\s*([^0-9]+ end=+)+ contains=groovyScopeDecl,groovyType,groovyStorageClass,groovyComment,groovyLineComment,@groovyClasses 288 | endif 289 | syn match groovyBraces "[{}]" 290 | syn cluster groovyTop add=groovyFuncDef,groovyBraces 291 | endif 292 | 293 | if exists("groovy_highlight_debug") 294 | 295 | " Strings and constants 296 | syn match groovyDebugSpecial contained "\\\d\d\d\|\\." 297 | syn region groovyDebugString contained start=+"+ end=+"+ contains=groovyDebugSpecial 298 | syn match groovyDebugStringError +"\([^"\\]\|\\.\)*$+ 299 | syn match groovyDebugCharacter contained "'[^\\]'" 300 | syn match groovyDebugSpecialCharacter contained "'\\.'" 301 | syn match groovyDebugSpecialCharacter contained "'\\''" 302 | syn match groovyDebugNumber contained "\<\(0[0-7]*\|0[xX]\x\+\|\d\+\)[lL]\=\>" 303 | syn match groovyDebugNumber contained "\(\<\d\+\.\d*\|\.\d\+\)\([eE][-+]\=\d\+\)\=[fFdD]\=" 304 | syn match groovyDebugNumber contained "\<\d\+[eE][-+]\=\d\+[fFdD]\=\>" 305 | syn match groovyDebugNumber contained "\<\d\+\([eE][-+]\=\d\+\)\=[fFdD]\>" 306 | syn keyword groovyDebugBoolean contained true false 307 | syn keyword groovyDebugType contained null this super 308 | syn region groovyDebugParen start=+(+ end=+)+ contained contains=groovyDebug.*,groovyDebugParen 309 | 310 | " to make this work you must define the highlighting for these groups 311 | syn match groovyDebug "\= 508 || !exists("did_c_syn_inits") 319 | GroovyHiLink groovyDebug Debug 320 | GroovyHiLink groovyDebugString DebugString 321 | GroovyHiLink groovyDebugStringError groovyError 322 | GroovyHiLink groovyDebugType DebugType 323 | GroovyHiLink groovyDebugBoolean DebugBoolean 324 | GroovyHiLink groovyDebugNumber Debug 325 | GroovyHiLink groovyDebugSpecial DebugSpecial 326 | GroovyHiLink groovyDebugSpecialCharacter DebugSpecial 327 | GroovyHiLink groovyDebugCharacter DebugString 328 | GroovyHiLink groovyDebugParen Debug 329 | 330 | GroovyHiLink DebugString String 331 | GroovyHiLink DebugSpecial Special 332 | GroovyHiLink DebugBoolean Boolean 333 | GroovyHiLink DebugType Type 334 | endif 335 | endif 336 | 337 | " Match all Exception classes 338 | syn match groovyExceptions "\\|\<[A-Z]\{1,}[a-zA-Z0-9]*Exception\>" 339 | 340 | 341 | if !exists("groovy_minlines") 342 | let groovy_minlines = 10 343 | endif 344 | exec "syn sync ccomment groovyComment minlines=" . groovy_minlines 345 | 346 | 347 | " ################### 348 | " Groovy stuff 349 | " syn match groovyOperator "|[ ,a-zA-Z0-9_*]\+|" 350 | 351 | " All groovy valid tokens 352 | " syn match groovyTokens ";\|,\|<=>\|<>\|:\|:=\|>\|>=\|=\|==\|<\|<=\|!=\|/\|/=\|\.\.|\.\.\.\|\~=\|\~==" 353 | " syn match groovyTokens "\*=\|&\|&=\|\*\|->\|\~\|+\|-\|/\|?\|<<<\|>>>\|<<\|>>" 354 | 355 | " Must put explicit these ones because groovy.vim mark them as errors otherwise 356 | " syn match groovyTokens "<=>\|<>\|==\~" 357 | "syn cluster groovyTop add=groovyTokens 358 | 359 | " Mark these as operators 360 | 361 | " Hightlight brackets 362 | " syn match groovyBraces "[{}]" 363 | " syn match groovyBraces "[\[\]]" 364 | " syn match groovyBraces "[\|]" 365 | 366 | if exists("groovy_mark_braces_in_parens_as_errors") 367 | syn match groovyInParen contained "[{}]" 368 | GroovyHiLink groovyInParen groovyError 369 | syn cluster groovyTop add=groovyInParen 370 | endif 371 | 372 | " catch errors caused by wrong parenthesis 373 | syn region groovyParenT transparent matchgroup=groovyParen start="(" end=")" contains=@groovyTop,groovyParenT1 374 | syn region groovyParenT1 transparent matchgroup=groovyParen1 start="(" end=")" contains=@groovyTop,groovyParenT2 contained 375 | syn region groovyParenT2 transparent matchgroup=groovyParen2 start="(" end=")" contains=@groovyTop,groovyParenT contained 376 | syn match groovyParenError ")" 377 | GroovyHiLink groovyParenError groovyError 378 | 379 | " catch errors caused by wrong square parenthesis 380 | syn region groovyParenT transparent matchgroup=groovyParen start="\[" end="\]" contains=@groovyTop,groovyParenT1 381 | syn region groovyParenT1 transparent matchgroup=groovyParen1 start="\[" end="\]" contains=@groovyTop,groovyParenT2 contained 382 | syn region groovyParenT2 transparent matchgroup=groovyParen2 start="\[" end="\]" contains=@groovyTop,groovyParenT contained 383 | syn match groovyParenError "\]" 384 | 385 | " ############################### 386 | " java.vim default highlighting 387 | if version >= 508 || !exists("did_groovy_syn_inits") 388 | if version < 508 389 | let did_groovy_syn_inits = 1 390 | endif 391 | GroovyHiLink groovyFuncDef Function 392 | GroovyHiLink groovyBraces Function 393 | GroovyHiLink groovyBranch Conditional 394 | GroovyHiLink groovyUserLabelRef groovyUserLabel 395 | GroovyHiLink groovyLabel Label 396 | GroovyHiLink groovyUserLabel Label 397 | GroovyHiLink groovyConditional Conditional 398 | GroovyHiLink groovyRepeat Repeat 399 | GroovyHiLink groovyExceptions Exception 400 | GroovyHiLink groovyAssert Statement 401 | GroovyHiLink groovyStorageClass StorageClass 402 | GroovyHiLink groovyMethodDecl groovyStorageClass 403 | GroovyHiLink groovyClassDecl groovyStorageClass 404 | GroovyHiLink groovyScopeDecl groovyStorageClass 405 | GroovyHiLink groovyBoolean Boolean 406 | GroovyHiLink groovySpecial Special 407 | GroovyHiLink groovySpecialError Error 408 | GroovyHiLink groovySpecialCharError Error 409 | GroovyHiLink groovyString String 410 | GroovyHiLink groovyCharacter Character 411 | GroovyHiLink groovySpecialChar SpecialChar 412 | GroovyHiLink groovyNumber Number 413 | GroovyHiLink groovyError Error 414 | GroovyHiLink groovyStringError Error 415 | GroovyHiLink groovyStatement Statement 416 | GroovyHiLink groovyOperator Operator 417 | GroovyHiLink groovyComment Comment 418 | GroovyHiLink groovyDocComment Comment 419 | GroovyHiLink groovyLineComment Comment 420 | GroovyHiLink groovyConstant Constant 421 | GroovyHiLink groovyTypedef Typedef 422 | GroovyHiLink groovyTodo Todo 423 | 424 | GroovyHiLink groovyCommentTitle SpecialComment 425 | GroovyHiLink groovyDocTags Special 426 | GroovyHiLink groovyDocParam Function 427 | GroovyHiLink groovyCommentStar groovyComment 428 | 429 | GroovyHiLink groovyType Type 430 | GroovyHiLink groovyExternal Include 431 | 432 | GroovyHiLink htmlComment Special 433 | GroovyHiLink htmlCommentPart Special 434 | GroovyHiLink groovySpaceError Error 435 | GroovyHiLink groovyJDKBuiltin Special 436 | GroovyHiLink groovyJDKOperOverl Operator 437 | GroovyHiLink groovyJDKMethods Function 438 | endif 439 | 440 | delcommand GroovyHiLink 441 | 442 | 443 | let b:current_syntax = "groovy" 444 | if main_syntax == 'groovy' 445 | unlet main_syntax 446 | endif 447 | 448 | let b:spell_options="contained" 449 | 450 | " vim: ts=8 451 | -------------------------------------------------------------------------------- /env/env.sh: -------------------------------------------------------------------------------- 1 | GOLAND="rycus86/goland:latest" 2 | 3 | if [[ "${1}" == "mac" ]] 4 | then 5 | # mac environment variables 6 | DOCKER_SOCKET=/var/run/docker.sock 7 | MOUNT=~/.dev-env 8 | WORKSPACE=~/Development/workspace 9 | GO_WORKSPACE=~/Development/go-workspace 10 | SSH=~/.ssh 11 | SUDO="" 12 | X11_ERROR="DISPLAY environment not set, is X11 installed? See https://www.xquartz.org/releases/index.html for more information" 13 | XHOST="/opt/X11/bin/xhost" 14 | XQUARTZ_ERROR="Unable to locate xhost, please visit https://www.xquartz.org/ to install XQuartz" 15 | else 16 | # all other environments 17 | DOCKER_SOCKET=/var/run/docker.sock 18 | MOUNT=~/.dev-env 19 | WORKSPACE=~/workspace 20 | GO_WORKSPACE=~/go-workspace 21 | SSH=~/.ssh 22 | SUDO="sudo" 23 | X11_ERROR="Not supported" 24 | XQUARTZ_ERROR="Not supported" 25 | fi 26 | -------------------------------------------------------------------------------- /env/mac/.bashrc: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | export PS1='$(echo -e "'"\U1F645"'") \[\033[32m\]\u \[\033[33m\]\w($(git branch 2>/dev/null | sed -n "s/* \(.*\)/\1/p"))\[\033[00m\]$ ' 4 | export JAVA_HOME=$(dirname $(readlink -f $(which java)) | sed 's:/bin::') 5 | 6 | function load_ssh_key(){ 7 | if [ -z "$SSH_AUTH_SOCK" ] ; then 8 | eval `ssh-agent -s` >/dev/null 9 | ssh-add >/dev/null 2>/dev/null 10 | fi 11 | } 12 | 13 | function setup_aliases(){ 14 | alias l='ls -l' 15 | alias ll='ls -la' 16 | alias tmux='tmux -u' 17 | alias t='tmux -u' 18 | alias kc='kubectl' 19 | alias wkc='tmux split-window -h "kubectl get pods -w"; tmux split-window -v "kubectl get prowjobs -w"; tmux split-window -v "kubectl get pipelinerun -w"; jx logs -k' 20 | } 21 | 22 | function setup_hub(){ 23 | eval "$(hub alias -s)" 24 | } 25 | 26 | setup_aliases 27 | load_ssh_key 28 | setup_hub 29 | set -o vi 30 | -------------------------------------------------------------------------------- /env/mac/.tmux.conf.local: -------------------------------------------------------------------------------- 1 | set -g default-command bash 2 | bind \ split-window -h 3 | tmux_conf_theme_status_left=' ❐ #S | ↑#{?uptime_d, #{uptime_d}d,}#{?uptime_h, #{uptime_h}h,}#{?uptime_m, #{uptime_m}m,} ' 4 | tmux_conf_theme_status_right='#{prefix}#{pairing}#{synchronized} , #(if [ `jx env -b | grep -c "prod"` -gt 0 ]; then tmux set -g window-style 'fg=white,bg=red'; jx env -b; else tmux set -g window-style 'fg=default,bg=default'; jx env -b; fi), #(curl 'wttr.in?format=2') , load: #{loadavg} ,%d %b %R, #{hostname} ' 5 | -------------------------------------------------------------------------------- /env/mac/.vimrc: -------------------------------------------------------------------------------- 1 | " enable vim features instead of strict vi compatibility 2 | set nocompatible 3 | 4 | " do not wrap long lines; have them scroll off the side 5 | set nowrap 6 | 7 | " try to detect the filetype 8 | filetype on 9 | 10 | " enable syntax highlighting 11 | syntax on 12 | 13 | " enable loading the plugin file for specific file types 14 | filetype plugin on 15 | 16 | " enable loading the indent file for specific file types 17 | filetype indent on 18 | 19 | " tell vim it's OK to use 256 colors at the terminal 20 | set t_Co=256 21 | 22 | " show matching brackets and parens 23 | set showmatch 24 | 25 | " don't bother redrawing during macros and such 26 | "set lazyredraw 27 | 28 | " use pop-up menu for tab completion of filenames 29 | set wildmenu 30 | 31 | " sync syntax highlighting in a 5000-line window 32 | " syntax sync minlines=5000 33 | 34 | " sync syntax highlighting from the start of the file 35 | syntax sync fromstart 36 | 37 | " do not make backup~ files 38 | set nobackup 39 | set nowritebackup 40 | 41 | " set character encoding to UTF-8 42 | set encoding=utf-8 43 | 44 | " show 3 lines above or below cursor when scrolling 45 | set scrolloff=3 46 | 47 | " show insert, replace, or visual mode in last line 48 | set showmode 49 | 50 | " show command in last line 51 | set showcmd 52 | 53 | " highlight the line the cursor is on 54 | " set cursorline " leave off for now; ugly when listing hidden chars 55 | 56 | " turn on line numbers 57 | set number 58 | 59 | " flash screen on bell 60 | set visualbell 61 | 62 | " assumes fast connection 63 | set ttyfast 64 | 65 | " show line and column number 66 | set ruler 67 | 68 | " every window gets a status line 69 | set laststatus=2 70 | 71 | " switch off search pattern highlighting 72 | set nohlsearch 73 | 74 | " make command line one line high 75 | set ch=1 76 | 77 | " turn off mouse pointer when typing begins 78 | set mousehide 79 | 80 | " put mouse in command-line mode, so mouse clicks don't move cursor 81 | set mouse=c 82 | 83 | " set molokai_dark color scheme 84 | colorscheme molokai_dark 85 | 86 | " set leader to comma 87 | let mapleader = "," 88 | 89 | " local leader to backslash. (local leader is used for only specific file 90 | " types) 91 | let maplocalleader = "\\" 92 | 93 | " Searching 94 | " ------------ 95 | " Highlight matches in search 96 | set hlsearch 97 | 98 | " Turn off search highlight when done 99 | nnoremap :nohlsearch 100 | 101 | " Listing unprintable chars 102 | " ------------ 103 | " Change vertical split character from a bar to a space 104 | " (so note that trailing space here is significant) 105 | set fillchars+=vert:\ 106 | 107 | " Show spaces and tabs; to turn off for copying, use `:set nolist` 108 | set listchars=tab:→\ ,space:·,trail:·,nbsp:· 109 | 110 | " Default to listing hidden chars 111 | set list 112 | 113 | " Toggle listing hidden chars 114 | nnoremap :set list! 115 | 116 | " Status Line 117 | " ------------ 118 | " %< means truncate on the left if too long 119 | " %F is full path to the file we are editing 120 | set statusline=%<%F 121 | 122 | " %m shows [+] if the file is modified but not saved 123 | set statusline+=%m 124 | 125 | " %r shows [RO] if a file is read-only 126 | set statusline+=%r 127 | 128 | " %h shows [Help] if we are in a help buffer 129 | set statusline+=%h 130 | 131 | " %w shows [Preview] if we are in a preview window 132 | set statusline+=%w 133 | 134 | " separation point between the left and right items 135 | set statusline+=%= 136 | 137 | " prints the fileformat; that is, the kind of newline (one of unix, dos or mac) 138 | " (If you type `:set fileformat?`, vim will tell you the current file format) 139 | set statusline+=%{&fileformat} 140 | 141 | " a literal forward slash 142 | set statusline+=/ 143 | 144 | " %Y shows the filetype, such as VIM or HTML or GO 145 | set statusline+=%Y 146 | 147 | " %l shows the line number, and %8l uses 8 left-padded spaces to do so 148 | set statusline+=%8l 149 | 150 | " a literal comma 151 | set statusline+=, 152 | 153 | " %v shows the virtual column number; 154 | " instead of counting a tab as one char, it counts it as the number 155 | " of spaces it uses in the display 156 | " %-8v leaves 8 spaces to the right to do so 157 | set statusline+=%-8v 158 | 159 | " disable recording macros: I hit this key accidentally too often 160 | nnoremap q 161 | 162 | " Window Manipulation 163 | " ------------------- 164 | " Note to self: 165 | " :resize will resize a horizontal split, *and* you can give it 166 | " relative lines, like :resize +5 or :resize -5 167 | " :vertical resize can be used for vertical splits. 168 | 169 | " remap window switching to leader then navigation letter 170 | nnoremap j 171 | nnoremap k 172 | nnoremap l 173 | nnoremap h 174 | 175 | " remap window equal resizing to leader equals 176 | nnoremap = 177 | 178 | " when opening horizontal splits, place cursor in new split 179 | set splitbelow 180 | 181 | " when opening vertical splits, place cursor in new split 182 | set splitright 183 | 184 | function DestroyButKeepWindow() 185 | " get the number of the buffer we will close 186 | let l:current_bufnum = bufnr('%') 187 | " open a new empty buffer in this window 188 | enew 189 | " destroy the original buffer 190 | execute "bdelete " . l:current_bufnum 191 | endfunction 192 | 193 | " Make :Bd call the window closer 194 | command Bd call DestroyButKeepWindow() 195 | 196 | " Explore 197 | " ------- 198 | " Note to self: 199 | " :Explore brings up explorer 200 | " :Sexplore brings up explorer in a horizontal split 201 | " :Vexplore brings up explorer in a vertical split 202 | 203 | " Remove explorer banner 204 | let g:netrw_banner = 0 205 | 206 | " Ruby 207 | " ---- 208 | augroup filetype_ruby 209 | autocmd! 210 | autocmd FileType ruby setlocal shiftwidth=2 211 | autocmd FileType ruby setlocal softtabstop=2 212 | autocmd FileType ruby setlocal expandtab 213 | augroup END 214 | 215 | " Golang 216 | " ------ 217 | augroup filetype_golang 218 | " when we use :make, autosave file; used by vim-go 219 | set autowrite 220 | 221 | autocmd! 222 | autocmd FileType go setlocal shiftwidth=2 223 | autocmd FileType go setlocal tabstop=2 224 | autocmd FileType go setlocal softtabstop=0 225 | autocmd FileType go setlocal noexpandtab 226 | "autocmd FileType go nmap d (go-def-vertical) 227 | "autocmd FileType go nmap D (go-doc-vertical) 228 | "autocmd FileType go nmap b (go-doc-browser) 229 | "autocmd FileType go nmap i (go-implements) 230 | "autocmd FileType go nmap n (go-info) 231 | "autocmd FileType go nmap r (go-rename) 232 | augroup END 233 | let g:go_highlight_array_whitespace_error = 1 234 | let g:go_highlight_chan_whitespace_error = 1 235 | let g:go_highlight_space_tab_error = 1 236 | let g:go_highlight_trailing_whitespace_error = 1 237 | let g:go_highlight_format_strings = 1 238 | let g:go_highlight_types = 1 239 | let g:go_highlight_fields = 1 240 | let g:go_highlight_functions = 1 241 | let g:go_highlight_methods = 1 242 | let g:go_highlight_structs = 1 243 | let g:go_highlight_operators = 1 244 | let g:go_highlight_extra_types = 1 245 | let g:go_highlight_build_constraints = 1 246 | let g:go_highlight_generate_tags = 1 247 | let g:go_fmt_command = "goimports" 248 | let g:go_metalinter_enabled = ['vet', 'golint', 'errcheck'] 249 | "These next two were too invasive, so I disabled them. 250 | "let g:go_metalinter_autosave = 1 251 | "let g:go_metalinter_autosave_enabled = ['vet', 'golint', 'errcheck'] 252 | "This next one was too distracting (but cool!); just use :GoInfo 253 | "let g:go_auto_type_info = 1 254 | 255 | " Use j and k to navigate up and down autocomplete, 256 | " at the expense of not being able to type j and k 257 | inoremap j ((pumvisible())?("\"):("j")) 258 | inoremap k ((pumvisible())?("\"):("k")) 259 | 260 | au BufNewFile,BufRead Jenkinsfile* setf groovy 261 | au BufNewFile,BufRead *.groovy setf groovy 262 | -------------------------------------------------------------------------------- /jenkins-x.yml: -------------------------------------------------------------------------------- 1 | buildPack: none 2 | pipelineConfig: 3 | pipelines: 4 | pullRequest: 5 | pipeline: 6 | options: 7 | containerOptions: 8 | resources: 9 | limits: 10 | memory: 8Gi 11 | requests: 12 | memory: 4Gi 13 | agent: 14 | image: gcr.io/kaniko-project 15 | stages: 16 | - name: script check 17 | steps: 18 | - image: bash:5.0.11 19 | command: bash 20 | args: 21 | - -n 22 | - dev-env 23 | release: 24 | pipeline: 25 | agent: 26 | image: gcr.io/jenkinsxio/builder-jx:0.1.786 27 | stages: 28 | - name: release 29 | steps: 30 | - command: jx 31 | args: 32 | - step 33 | - changelog 34 | - --verbose 35 | - --version 36 | - ${VERSION} 37 | - --rev 38 | - ${PULL_BASE_SHA} 39 | --------------------------------------------------------------------------------