Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
technosophos committed May 5, 2017
0 parents commit 1747c52
Show file tree
Hide file tree
Showing 18 changed files with 1,333 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
out
node_modules
28 changes: 28 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// A launch configuration that compiles the extension and then opens it inside a new window
{
"version": "0.1.0",
"configurations": [
{
"name": "Launch Extension",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": ["--extensionDevelopmentPath=${workspaceRoot}" ],
"stopOnEntry": false,
"sourceMaps": true,
"outFiles": [ "${workspaceRoot}/out/src/**/*.js" ],
"preLaunchTask": "npm"
},
{
"name": "Launch Tests",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": ["--extensionDevelopmentPath=${workspaceRoot}", "--extensionTestsPath=${workspaceRoot}/out/test" ],
"stopOnEntry": false,
"sourceMaps": true,
"outFiles": [ "${workspaceRoot}/out/test/**/*.js" ],
"preLaunchTask": "npm"
}
]
}
9 changes: 9 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Place your settings in this file to overwrite default and user settings.
{
"files.exclude": {
"out": false // set this to true to hide the "out" folder with the compiled JS files
},
"search.exclude": {
"out": true // set this to false to include "out" folder in search results
}
}
30 changes: 30 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Available variables which can be used inside of strings.
// ${workspaceRoot}: the root folder of the team
// ${file}: the current opened file
// ${fileBasename}: the current opened file's basename
// ${fileDirname}: the current opened file's dirname
// ${fileExtname}: the current opened file's extension
// ${cwd}: the current working directory of the spawned process

// A task runner that calls a custom npm script that compiles the extension.
{
"version": "0.1.0",

// we want to run npm
"command": "npm",

// the command is a shell script
"isShellCommand": true,

// show the output window only if unrecognized errors occur.
"showOutput": "silent",

// we run the custom script "compile" as defined in package.json
"args": ["run", "compile", "--loglevel", "silent"],

// The tsc compiler is started in watching mode
"isBackground": true,

// use the standard tsc in watch mode problem matcher to find compile problems in the output.
"problemMatcher": "$tsc-watch"
}
9 changes: 9 additions & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.vscode/**
.vscode-test/**
out/test/**
test/**
src/**
**/*.map
.gitignore
tsconfig.json
vsc-extension-quickstart.md
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Change Log
All notable changes to the "vscode-helm" extension will be documented in this file.

Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file.

## [Unreleased]
- Initial release
65 changes: 65 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# vscode-helm README

This is the README for your extension "vscode-helm". After writing up a brief description, we recommend including the following sections.

## Features

Describe specific features of your extension including screenshots of your extension in action. Image paths are relative to this README file.

For example if there is an image subfolder under your extension project workspace:

\!\[feature X\]\(images/feature-x.png\)

> Tip: Many popular extensions utilize animations. This is an excellent way to show off your extension! We recommend short, focused animations that are easy to follow.
## Requirements

If you have any requirements or dependencies, add a section describing those and how to install and configure them.

## Extension Settings

Include if your extension adds any VS Code settings through the `contributes.configuration` extension point.

For example:

This extension contributes the following settings:

* `myExtension.enable`: enable/disable this extension
* `myExtension.thing`: set to `blah` to do something

## Known Issues

Calling out known issues can help limit users opening duplicate issues against your extension.

## Release Notes

Users appreciate release notes as you update your extension.

### 1.0.0

Initial release of ...

### 1.0.1

Fixed issue #.

### 1.1.0

Added features X, Y, and Z.

-----------------------------------------------------------------------------------------------------------

## Working with Markdown

**Note:** You can author your README using Visual Studio Code. Here are some useful editor keyboard shortcuts:

* Split the editor (`Cmd+\` on OSX or `Ctrl+\` on Windows and Linux)
* Toggle preview (`Shift+CMD+V` on OSX or `Shift+Ctrl+V` on Windows and Linux)
* Press `Ctrl+Space` (Windows, Linux) or `Cmd+Space` (OSX) to see a list of Markdown snippets

### For more information

* [Visual Studio Code's Markdown Support](http://code.visualstudio.com/docs/languages/markdown)
* [Markdown Syntax Reference](https://help.github.com/articles/markdown-basics/)

**Enjoy!**
24 changes: 24 additions & 0 deletions funcs.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package main

import (
"fmt"
"strings"

"github.com/Masterminds/sprig"
)

// main prints a regexp to match all of the functions in sprig.
//
// To use this, run it as `go run funcs.go`.
//
// This is a light utility for generating a list of all of the functions in the Sprig library.
// It is specific to the tmLanguage syntax for this project.
func main() {
list := []string{}
funcs := sprig.GenericFuncMap()
for k := range funcs {
list = append(list, k)
}

fmt.Printf("(%s)", strings.Join(list, "|"))
}
70 changes: 70 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{
"name": "vscode-helm",
"displayName": "vscode-helm",
"description": "Chart development tools for Kubernetes Helm",
"version": "0.0.1",
"publisher": "technosophos",
"engines": {
"vscode": "^1.11.0"
},
"categories": [
"Languages",
"Snippets",
"Other"
],
"activationEvents": [
"onCommand:extension.helmTemplate",
"onCommand:extension.helmLint",
"onCommand:extension.helmVersion"
],
"main": "./out/src/extension",
"contributes": {
"commands": [
{
"command": "extension.helmVersion",
"title": "Helm Version (Client)"
},
{
"command": "extension.helmLint",
"title": "Helm Lint"
},
{
"command": "extension.helmTemplate",
"title": "Helm Template"
}
],
"languages": [{
"id": "helm",
"aliases": ["helm-template", "helm"],
"extensions": [".yaml",".tpl"],
"configuration": "./language-configuration.json"
}],
"grammars": [{
"language": "helm",
"scopeName": "source.helm",
"path": "./syntaxes/helm.tmLanguage.json"
}],
"snippets": [
{
"language": "helm",
"path": "./snippets/helm.json"
}
]
},
"scripts": {
"vscode:prepublish": "tsc -p ./",
"compile": "tsc -watch -p ./",
"postinstall": "node ./node_modules/vscode/bin/install",
"test": "node ./node_modules/vscode/bin/test"
},
"devDependencies": {
"typescript": "^2.0.3",
"vscode": "^1.0.0",
"mocha": "^2.3.3",
"@types/node": "^6.0.40",
"@types/mocha": "^2.2.32"
},
"dependencies": {
"shelljs":"0.7.7"
}
}
23 changes: 23 additions & 0 deletions rawsnippets/pod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
apiVersion: v1
kind: Pod
metadata:
name: "{{.Release.Name}}-{{.Values.Name}}"
labels:
# The "heritage" label is used to track which tool deployed a given chart.
# It is useful for admins who want to see what releases a particular tool
# is responsible for.
heritage: {{.Release.Service | quote }}
# The "release" convention makes it easy to tie a release to all of the
# Kubernetes resources that were created as part of that release.
release: {{.Release.Name | quote }}
# This makes it easy to audit chart usage.
chart: "{{.Chart.Name}}-{{.Chart.Version}}"
spec:
# This shows how to use a simple value. This will look for a passed-in value
# called restartPolicy. If it is not found, it will use the default value.
# {{default "Never" .restartPolicy}} is a slightly optimized version of the
# more conventional syntax: {{.restartPolicy | default "Never"}}
restartPolicy: {{default "Never" .Values.restartPolicy}}
containers:
- name: main
image: "{{ default "alpine:3.3" .Values.image }}"
8 changes: 8 additions & 0 deletions rawsnippets/secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: v1
kind: Secret
metadata:
name: mysecret
type: Opaque
data:
# Example:
# password: {{ .Values.password | b64enc }}
57 changes: 57 additions & 0 deletions snippets.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package main

import(
"fmt"
"encoding/json"
"os"
"bufio"
"path/filepath"
)

type Snippet struct {
Prefix string `json:"prefix"`
Body []string `json:"body"`
Description string `json:"description"`
}

var snippets = map[string]Snippet{
"Secret": {
Prefix: "kindSecret",
Body: load("secret.yaml"),
Description: "Create a Secret manifest",
},
"Pod": {
Prefix: "kindPod",
Description: "Create a Pod manifest",
Body: load("pod.yaml"),
},
}

func load(loc string) []string {
loc = filepath.Join("rawsnippets", loc)
f, err := os.Open(loc)
if err != nil {
panic(err)
}
defer f.Close()

r := bufio.NewScanner(f)
lines := []string{}
for r.Scan() {
l := r.Text()
if err := r.Err(); err != nil {
panic(err)
}
lines = append(lines, l)
}

return lines
}

func main(){
out, err := json.MarshalIndent(snippets, "", " ")
if err != nil {
panic(err)
}
fmt.Printf("%s", out)
}
Loading

0 comments on commit 1747c52

Please sign in to comment.