diff --git a/atom-extensions/atom-boot-java/lib/main.js b/atom-extensions/atom-boot-java/lib/main.js index bc9d76b18..dded7498c 100644 --- a/atom-extensions/atom-boot-java/lib/main.js +++ b/atom-extensions/atom-boot-java/lib/main.js @@ -26,10 +26,9 @@ class BootJavaLanguageClient extends JarLanguageClient { } activate() { - // replace the example argument 'linter-ruby' with the name of this Atom package - require('atom-package-deps').install('boot-java').then(function() { - console.log('All dependencies installed, good to go') - }); + require('atom-package-deps') + .install('boot-java') + .then(() => console.debug('All dependencies installed, good to go')); super.activate(); } diff --git a/atom-extensions/atom-boot-java/package.json b/atom-extensions/atom-boot-java/package.json index 73420e03f..b713a11f6 100644 --- a/atom-extensions/atom-boot-java/package.json +++ b/atom-extensions/atom-boot-java/package.json @@ -17,7 +17,7 @@ "dependencies": { "atom-package-deps": "^4.6.0", "download": "^6.2.5", - "pivotal-atom-languageclient-commons": "0.0.7" + "pivotal-atom-languageclient-commons": "0.0.8" }, "devDependencies": { "coffeelint": "^1.10.1" @@ -67,10 +67,5 @@ "0.0.0": "provideOutlines" } } - }, - "bundledDependencies": [ - "atom-package-deps", - "download", - "pivotal-atom-languageclient-commons" - ] + } } diff --git a/atom-extensions/atom-bosh/.gitignore b/atom-extensions/atom-bosh/.gitignore new file mode 100644 index 000000000..51786ff67 --- /dev/null +++ b/atom-extensions/atom-bosh/.gitignore @@ -0,0 +1,6 @@ +/.idea +/node_modules +/server +*.tgz +*.iml +*.log \ No newline at end of file diff --git a/atom-extensions/atom-bosh/README.MD b/atom-extensions/atom-bosh/README.MD new file mode 100644 index 000000000..7a0c09f18 --- /dev/null +++ b/atom-extensions/atom-bosh/README.MD @@ -0,0 +1,171 @@ +# Bosh Deployment Manifest Editor for Atom +[![macOS Build Status](https://travis-ci.org/spring-projects/atom-bosh.svg?branch=master)](https://travis-ci.org/spring-projects/atom-bosh) [![Windows Build Status](https://ci.appveyor.com/api/projects/status/1jvknxt9jhykgrxo?svg=true)](https://ci.appveyor.com/project/spring-projects/atom-bosh/branch/master) [![Dependency Status](https://david-dm.org/spring-projects/atom-bosh.svg)](https://david-dm.org/spring-projects/atom-bosh) + +This extension provides basic validation, content assist and hover infos +for editing Bosh [Deployment Manifest](https://bosh.io/docs/deployment-manifest.html) and [Cloud Config](https://bosh.io/docs/cloud-config.html) Files. + +It is recommended to use this extension package when `atom-ide-ui` atom extension package is installed. Thus, reconciling (error/warning markers) and hover support is fully functional. + +## Usage + +The Bosh editor automatically activates when the name of the file you are editing is `deployment.yml`or `cloud-config.yml`. Alternately, you can select the grammar for your file by doing these steps: + +- Open the file, and it will most likely open with the default Atom YAML editor. +- In the bottom-right of the editor, click on YAML. +- This opens the Grammar Selection dialogue. Search and select `Bosh-Deployment-Manifest` for deployment files, or `Bosh-Cloud-Config` for Cloud Config files. + +## Functionality + +This extension provides validation, content assist and documentation hovers +for editing [Bosh](https://bosh.io/) Deployment Manifest files and +Cloud Configs. + +### Validation + +As you type the text is parsed and checked for basic syntactic and structural correctness. Hover over +an error marker to see an explanation: + +![Linting Screenshot][linting] + +### Content assist + +Having trouble remembering all the names of the attributes, and their spelling? Or can't remember +the exact name/version of the stemcell you just uploaded to your bosh environment? Content assist +to the rescue: + +![Content Assist Screenshot][ca1] + +![Content Assist Screenshot][ca2] + +### Documentation Hovers + +Having trouble remembering exactly what the meaning of each attribute is? Hover over an attribute and +read its detailed documentation: + +![Hover Docs Screenshot][hovers] + +### Navigate to Symbol in File + +Is your deployment manifest file getting larger and it is becoming harder to find a particular Instance Group, Release, or Stemcell definition? The Atom Outline View (View -> Toggle Outline View) helps you quickly jump to a specific definition. + +![Outline View][outline_view] + +### V2 versus V1 Schema + +The editor is intended primarily to support editing manifests in the [V2 schema](https://bosh.io/docs/manifest-v2.html). +When you use attributes from the V1 schema the editor will detect this however and switch to 'V1 tolerance' mode. + +In this mode, V1 properties are accepted but marked with deprecation warnings and V2 properties are marked as (unknown property) +errors. + +### Targetting a specific Director + +Some of the Validations and Content Assist depend on information dymanically retrieved from an active Bosh director. +The editor retreives information by executing commands using the Bosh CLI. For this to work the CLI (V2 +CLI is required) and editor have to be installed and configured correctly. + +There are two ways to set things up to make this work: + +#### Explicitly Configure the CLI: + +From Atom, press `CTRL-SHIFT-P` and type `config`. Then enter or edit: + +``` + "bosh-yaml": + bosh: + cli: + # Path to an executable to launch the bosh cli V2. A V2 cli is required! + # Set this to null to completely disable all editor features that require access to the bosh director + command: "bosh" + # Specifies the director/environment to target when executing bosh cli commands. + # I.e. this value is passed to the CLI via `-e` parameter. + target: "mytarget" + # Number of seconds before CLI commands are terminated with a timeout + timeout: 3 +``` +The Bosh CLI is configured by specifying these keys as shown above: `command`, `target`, and `timeout`. The comments in the example above describe what +each key does. + +Note that these key settings do not allow you to provide credentials to connect to the director. +The editor assumes that you are providing the credentials implicitly by using the `bosh login` command from a terminal. +The Bosh CLI will persist the credentials in `~/.bosh/config` and read them from there. A typical sequence of commands to store the credentials would be something like the following: + +First, create an alias for your environment: + +``` +$ bosh alias-env my-env -e 10.194.4.35 --ca-cert <(bosh int ./creds.yml --path /director_ssl/ca) +Using environment '10.194.4.35' as anonymous user +... +Succeeded +$ +``` + +Second, obtain username/password for your director. For example: + +``` +$ bosh int ./creds.yml --path /admin_password +very-secret-admin-password + +Succeeded +``` + +Now use `bosh login` to establish a session and store the credentials: + +``` +$ bosh login -e my-env +Username (): admin +Password (): very-secret-admin-password + +Using environment '10.194.4.35' as client 'admin' + +Logged in to '10.194.4.35' + +Succeeded +``` + +You can verify that CLI is setup correctly by executing a command like: + +``` +$ bosh -e my-env cloud-config +... +Succeeded +``` + +#### Implictly Configure the CLI: + +If the Bosh CLI is not explicitly configured, the editor will, by default, try to execute commands like `bosh cloud-config --json` +and `bosh stemcells --json` without an explicit `-e ...` argument. This works only if you ensure that the editor +process executes with a proper set of OS environment variables: + +- `PATH`: must be set so that `bosh` cli executable can be found and refers to the V2 CLI. +- `BOSH_ENVIRONMENT`: must be set to point to the bosh director you want to target. + +If you start Atom from a terminal, you can verify that things are setup correctly by executing command: + + bosh cloud-config + +If that command executes without any errors and returns the cloud-config you expected, then things are setup correctly. +If you subsequently launch Atom from that same terminal the dynamic CA and linting should work correctly. + +## Dev environment setup: +**Prerequisite**: Node 6.x.x or higher is installed, Atom 1.17 or higher is installed +1. Clone the repository +2. Run `npm install` +3. Execute `apm link .` from the folder above +5. Perform `Reload Window` in Atom (Cmd-Shift-P opens commands palette, search for `reload`, select, press `Return`) +6. Open any `pipeline.yml` or `task.yml` file in Atom observe reconciling, content assist and other IDE features + +[linting]: +https://raw.githubusercontent.com/spring-projects/atom-bosh/834092c04448412dee44d007e8648c5bcaa2cabb/readme-imgs/linting.png + +[ca1]: +https://raw.githubusercontent.com/spring-projects/atom-bosh/834092c04448412dee44d007e8648c5bcaa2cabb/readme-imgs/ca1.png + +[ca2]: +https://raw.githubusercontent.com/spring-projects/atom-bosh/bf39b6263a49ea7c51b74f0a566d297d59ef61d9/readme-imgs/ca2.png + +[hovers]: +https://raw.githubusercontent.com/spring-projects/atom-bosh/834092c04448412dee44d007e8648c5bcaa2cabb/readme-imgs/hovers.png + +[outline_view]: +https://raw.githubusercontent.com/spring-projects/atom-bosh/834092c04448412dee44d007e8648c5bcaa2cabb/readme-imgs/outline_view.png \ No newline at end of file diff --git a/atom-extensions/atom-bosh/coffeelint.json b/atom-extensions/atom-bosh/coffeelint.json new file mode 100644 index 000000000..d6c3236aa --- /dev/null +++ b/atom-extensions/atom-bosh/coffeelint.json @@ -0,0 +1,37 @@ +{ + "max_line_length": { + "level": "ignore" + }, + "no_empty_param_list": { + "level": "error" + }, + "arrow_spacing": { + "level": "error" + }, + "no_interpolation_in_single_quotes": { + "level": "error" + }, + "no_debugger": { + "level": "error" + }, + "prefer_english_operator": { + "level": "error" + }, + "colon_assignment_spacing": { + "spacing": { + "left": 0, + "right": 1 + }, + "level": "error" + }, + "braces_spacing": { + "spaces": 0, + "level": "error" + }, + "spacing_after_comma": { + "level": "error" + }, + "no_stand_alone_at": { + "level": "error" + } +} \ No newline at end of file diff --git a/atom-extensions/atom-bosh/grammars/bosh-cloud-config.cson b/atom-extensions/atom-bosh/grammars/bosh-cloud-config.cson new file mode 100644 index 000000000..6ef328390 --- /dev/null +++ b/atom-extensions/atom-bosh/grammars/bosh-cloud-config.cson @@ -0,0 +1,8 @@ +'scopeName': 'source.bosh-cloud-config' +'name': 'Bosh-Cloud-Config' +'fileTypes': [ + 'cloud-config.yml' +] +'patterns': [ + { 'include': 'source.yaml' } +] diff --git a/atom-extensions/atom-bosh/grammars/bosh-deployment-manifest.cson b/atom-extensions/atom-bosh/grammars/bosh-deployment-manifest.cson new file mode 100644 index 000000000..fabf48aef --- /dev/null +++ b/atom-extensions/atom-bosh/grammars/bosh-deployment-manifest.cson @@ -0,0 +1,8 @@ +'scopeName': 'source.bosh-deployment-manifest' +'name': 'Bosh-Deployment-Manifest' +'fileTypes': [ + 'deployment.yml' +] +'patterns': [ + { 'include': 'source.yaml' } +] diff --git a/atom-extensions/atom-bosh/icon.png b/atom-extensions/atom-bosh/icon.png new file mode 100644 index 000000000..394072044 Binary files /dev/null and b/atom-extensions/atom-bosh/icon.png differ diff --git a/atom-extensions/atom-bosh/lib/main.js b/atom-extensions/atom-bosh/lib/main.js new file mode 100644 index 000000000..c5908d594 --- /dev/null +++ b/atom-extensions/atom-bosh/lib/main.js @@ -0,0 +1,54 @@ +const path = require('path'); +const { JarLanguageClient } = require('pivotal-atom-languageclient-commons'); +const PROPERTIES = require('../properties.json'); + +class BoshYamlClient extends JarLanguageClient { + + constructor() { + //noinspection JSAnnotator + super( + PROPERTIES.jarUrl, + path.join(__dirname, '..', 'server'), + 'bosh-language-server.jar' + ); + } + + postInitialization(server) { + this.sendConfig(server); + this._disposable.add(atom.config.observe('bosh-yaml', () => this.sendConfig(server))); + } + + getGrammarScopes() { + return ['source.bosh-deployment-manifest', 'source.bosh-cloud-config']; + } + + getLanguageName() { + return 'Bosh-YAML'; + } + + getServerName() { + return 'Bosh-YAML'; + } + + activate() { + require('atom-package-deps') + .install('bosh-yaml') + .then(() => console.debug('All dependencies installed, good to go')); + super.activate(); + } + + launchVmArgs(version) { + return [ + '-Dorg.slf4j.simpleLogger.logFile=bosh-yaml.log', + '-Dorg.slf4j.simpleLogger.defaultLogLevel=debug', + ]; + + } + + sendConfig(server) { + server.connection.didChangeConfiguration({ settings: atom.config.get('bosh-yaml') }); + } + +} + +module.exports = new BoshYamlClient(); diff --git a/atom-extensions/atom-bosh/package.json b/atom-extensions/atom-bosh/package.json new file mode 100644 index 000000000..993ce897a --- /dev/null +++ b/atom-extensions/atom-bosh/package.json @@ -0,0 +1,102 @@ +{ + "name": "bosh-yaml", + "main": "./lib/main", + "version": "0.0.9", + "description": "Provides validation and content assist for various Bosh configuration files", + "repository": "https://github.com/spring-projects/atom-bosh", + "icon": "icon.png", + "license": "MIT", + "engines": { + "atom": ">=1.17.0" + }, + "files": [ + "grammars/", + "settings/", + "lib/", + "server/", + "properties.json" + ], + "dependencies": { + "atom-package-deps": "^4.6.0", + "download": "^6.2.5", + "pivotal-atom-languageclient-commons": "0.0.8" + }, + "configSchema": { + "bosh": { + "type": "object", + "title": "Bosh CLI Configuration", + "properties": { + "cli.command": { + "type": [ + "string", + "null" + ], + "default": "bosh", + "description": "Path to an executable to launch the bosh cli V2. A V2 cli is required! Set this to null to completely disable all editor features that require access to the bosh director" + }, + "cli.target": { + "type": [ + "string", + "null" + ], + "default": null, + "description": "Specifies the director/environment to target when executing bosh cli commands. I.e. this value is passed to the CLI via `-e` parameter." + }, + "cli.timeout": { + "type": "integer", + "default": 3, + "description": "Number of seconds before CLI commands are terminated with a timeout" + } + } + } + }, + "devDependencies": { + "coffeelint": "^1.10.1" + }, + "scripts": { + "clean": "rm -fr node_modules", + "postinstall": "node script.js" + }, + "package-deps": [ + "atom-ide-ui" + ], + "consumedServices": { + "linter-indie": { + "versions": { + "2.0.0": "consumeLinterV2" + } + }, + "nuclide-datatip.provider": { + "versions": { + "0.0.0": "consumeDatatip" + } + } + }, + "providedServices": { + "autocomplete.provider": { + "versions": { + "2.0.0": "provideAutocomplete" + } + }, + "nuclide-code-format.provider": { + "versions": { + "0.0.0": "provideCodeFormat" + } + }, + "nuclide-definition-provider": { + "versions": { + "0.0.0": "provideDefinitions" + } + }, + "nuclide-find-references.provider": { + "versions": { + "0.0.0": "provideFindReferences" + } + }, + "nuclide-outline-view": { + "versions": { + "0.0.0": "provideOutlines" + } + } + } +} diff --git a/atom-extensions/atom-bosh/properties.json b/atom-extensions/atom-bosh/properties.json new file mode 100644 index 000000000..7273ae32f --- /dev/null +++ b/atom-extensions/atom-bosh/properties.json @@ -0,0 +1,3 @@ +{ + "jarUrl": "https://s3.amazonaws.com/dist.springsource.com/release/STS4/fatjars/bosh-language-server-0.0.9-201708181059.jar" +} diff --git a/atom-extensions/atom-bosh/readme-imgs/ca1.png b/atom-extensions/atom-bosh/readme-imgs/ca1.png new file mode 100644 index 000000000..ca2632f89 Binary files /dev/null and b/atom-extensions/atom-bosh/readme-imgs/ca1.png differ diff --git a/atom-extensions/atom-bosh/readme-imgs/ca2.png b/atom-extensions/atom-bosh/readme-imgs/ca2.png new file mode 100644 index 000000000..eb29adf0a Binary files /dev/null and b/atom-extensions/atom-bosh/readme-imgs/ca2.png differ diff --git a/atom-extensions/atom-bosh/readme-imgs/hovers.png b/atom-extensions/atom-bosh/readme-imgs/hovers.png new file mode 100644 index 000000000..3a12eba9e Binary files /dev/null and b/atom-extensions/atom-bosh/readme-imgs/hovers.png differ diff --git a/atom-extensions/atom-bosh/readme-imgs/linting.png b/atom-extensions/atom-bosh/readme-imgs/linting.png new file mode 100644 index 000000000..91db40e6d Binary files /dev/null and b/atom-extensions/atom-bosh/readme-imgs/linting.png differ diff --git a/atom-extensions/atom-bosh/readme-imgs/outline_view.png b/atom-extensions/atom-bosh/readme-imgs/outline_view.png new file mode 100644 index 000000000..954a7af7e Binary files /dev/null and b/atom-extensions/atom-bosh/readme-imgs/outline_view.png differ diff --git a/atom-extensions/atom-bosh/script.js b/atom-extensions/atom-bosh/script.js new file mode 100644 index 000000000..56d7e39d9 --- /dev/null +++ b/atom-extensions/atom-bosh/script.js @@ -0,0 +1,34 @@ +const fs = require('fs'); +const path = require('path'); +const download = require('download'); +const PROPERTIES = require('./properties.json'); + +let fileExists = function(path) { + return new Promise((resolve, reject) => { + fs.access(path, fs.R_OK, error => { + resolve(!error || error.code !== 'ENOENT'); + }) + }); +}; + +const serverDownloadUrl = PROPERTIES.jarUrl; + +const serverHome = path.join(__dirname, 'server'); + +const localFileName = path.join(serverHome, 'bosh-language-server.jar'); + +fileExists(localFileName).then(exists => { + if (!exists) { + console.log(`Downloading ${serverDownloadUrl} to ${localFileName}`); + fileExists(serverHome) + .then(doesExist => { if (!doesExist) fs.mkdir(serverHome) }) + .then(() => download(serverDownloadUrl)) + .then(data => fs.writeFileSync(localFileName, data)) + .then(() => fileExists(localFileName)) + .then(doesExist => { if (!doesExist) throw Error(`Failed to install the ${this.getServerName()} language server`) }) + .then(() => console.log(`Successfully downloaded ${serverDownloadUrl}`)); + } +}); + + + diff --git a/atom-extensions/atom-bosh/settings/language-bosh-cloud-config.cson b/atom-extensions/atom-bosh/settings/language-bosh-cloud-config.cson new file mode 100644 index 000000000..8b7503234 --- /dev/null +++ b/atom-extensions/atom-bosh/settings/language-bosh-cloud-config.cson @@ -0,0 +1,8 @@ +'.source.bosh-cloud-config': + 'editor': + 'autoIndentOnPaste': false + 'commentStart': '# ' + 'foldEndPattern': '^\\s*$|^\\s*\\}|^\\s*\\]|^\\s*\\)' + 'increaseIndentPattern': '^\\s*.*(:|-) ?(&\\w+)?(\\{[^}"\']*|\\([^)"\']*)?$' + 'decreaseIndentPattern': '^\\s+\\}$' +'tabType': 'soft' \ No newline at end of file diff --git a/atom-extensions/atom-bosh/settings/language-bosh-deployment-manifest.cson b/atom-extensions/atom-bosh/settings/language-bosh-deployment-manifest.cson new file mode 100644 index 000000000..394eb7add --- /dev/null +++ b/atom-extensions/atom-bosh/settings/language-bosh-deployment-manifest.cson @@ -0,0 +1,8 @@ +'.source.bosh-deployment-manifest': + 'editor': + 'autoIndentOnPaste': false + 'commentStart': '# ' + 'foldEndPattern': '^\\s*$|^\\s*\\}|^\\s*\\]|^\\s*\\)' + 'increaseIndentPattern': '^\\s*.*(:|-) ?(&\\w+)?(\\{[^}"\']*|\\([^)"\']*)?$' + 'decreaseIndentPattern': '^\\s+\\}$' +'tabType': 'soft' \ No newline at end of file diff --git a/atom-extensions/atom-cf-manifest-yaml/.gitignore b/atom-extensions/atom-cf-manifest-yaml/.gitignore new file mode 100644 index 000000000..51786ff67 --- /dev/null +++ b/atom-extensions/atom-cf-manifest-yaml/.gitignore @@ -0,0 +1,6 @@ +/.idea +/node_modules +/server +*.tgz +*.iml +*.log \ No newline at end of file diff --git a/atom-extensions/atom-cf-manifest-yaml/README.MD b/atom-extensions/atom-cf-manifest-yaml/README.MD new file mode 100644 index 000000000..4dcdb3f98 --- /dev/null +++ b/atom-extensions/atom-cf-manifest-yaml/README.MD @@ -0,0 +1,58 @@ +# Cloud Foundry Manifest YAML Editor for Atom +[![macOS Build Status](https://travis-ci.org/spring-projects/atom-cf-manifest-yaml.svg?branch=master)](https://travis-ci.org/spring-projects/atom-cf-manifest-yaml) [![Windows Build Status](https://ci.appveyor.com/api/projects/status/1jvknxt9jhykgrxo?svg=true)](https://ci.appveyor.com/project/spring-projects/atom-cf-manifest-yaml/branch/master) [![Dependency Status](https://david-dm.org/spring-projects/atom-cf-manifest-yaml.svg)](https://david-dm.org/spring-projects/atom-cf-manifest-yaml) + +This extension provides basic validation, content assist and hover infos +for editing Cloud Foundry [Manifest](https://docs.cloudfoundry.org/devguide/deploy-apps/manifest.html) Files. + +It is recommended to use this extension package when `atom-ide-ui` atom extension package is installed. Thus, reconciling (error/warning markers) and hover support is fully functional. + +## Usage + +The CF manifest editor automatically activates when the name of the file you are editing is `manifest.yml` or editor grammar is set to `Manifest-YAML` + +## Functionality + +### Validation + +(Requires `atom-ide-ui` package) As you type the manifest is parsed and checked for basic syntactic and structural correctness. Hover over +an error marker to see an explanation. + +![Linting Screenshot][linting] + +### Content Assist + +Having trouble remembering all the names of the attributes, and their spelling? Content assist to the +rescue: + +![Content Assist Screenshot][ca] + +### Dynamic Cloud Foundry Content Assist + +Would you like to see actual Cloud Foundry values for attributes like `services`, `buildpack`, `domain`, and `stack`? If you have [cf CLI](https://docs.cloudfoundry.org/cf-cli/) installed and connected to a Cloud target, the extension will automatically display values for certain manifest attributes. + +For example, if you are connected to a Cloud target that has services, and you invoke content assist in an entry under `services`, you will see the available service instances. In addition, service instances that do not exist in the Cloud target, like `redisserv` in the example below, are highlighted with a warning. + +Dynamic content assist also shows which Cloud target you are connected to. + +![Dynamic Cloud Foundry Content Assist Screenshot][dcfca] + +### Documentation Hovers + +(Requires `atom-ide-ui` package) Having trouble remembering exactly what the meaning of each attribute is? Hover over any attribute and +read its detailed documentation. + +![Hover Docs Screenshot][hovers] + +## Dev environment setup: +**Prerequisite**: Node 6.x.x or higher is installed, Atom 1.17 or higher is installed +1. Clone the repository +2. Run `npm install` +3. Execute `apm link .` from the folder above +5. Perform `Reload Window` in Atom (Cmd-Shift-P opens commands palette, search for `reaload`, select, press `Return`) +6. Open any `manifest.yml` file in Atom observe reconciling, content assist and other IDE features + +[linting]: https://raw.githubusercontent.com/spring-projects/atom-cf-manifest-yaml/3e485d98ca1f5fb5ca3d780ffd85cd8e4e9e96be/readme-imgs/linting.png +[ca]: https://raw.githubusercontent.com/spring-projects/atom-cf-manifest-yaml/3e485d98ca1f5fb5ca3d780ffd85cd8e4e9e96be/readme-imgs/content-assist.png +[dcfca]: https://raw.githubusercontent.com/spring-projects/atom-cf-manifest-yaml/0d86220a88f44000f4a2ae0dd11b211aec319fb2/readme-imgs/cf-dynamic-content-assist.png +[hovers]: https://raw.githubusercontent.com/spring-projects/atom-cf-manifest-yaml/3e485d98ca1f5fb5ca3d780ffd85cd8e4e9e96be/readme-imgs/hovers.png + diff --git a/atom-extensions/atom-cf-manifest-yaml/coffeelint.json b/atom-extensions/atom-cf-manifest-yaml/coffeelint.json new file mode 100644 index 000000000..d6c3236aa --- /dev/null +++ b/atom-extensions/atom-cf-manifest-yaml/coffeelint.json @@ -0,0 +1,37 @@ +{ + "max_line_length": { + "level": "ignore" + }, + "no_empty_param_list": { + "level": "error" + }, + "arrow_spacing": { + "level": "error" + }, + "no_interpolation_in_single_quotes": { + "level": "error" + }, + "no_debugger": { + "level": "error" + }, + "prefer_english_operator": { + "level": "error" + }, + "colon_assignment_spacing": { + "spacing": { + "left": 0, + "right": 1 + }, + "level": "error" + }, + "braces_spacing": { + "spaces": 0, + "level": "error" + }, + "spacing_after_comma": { + "level": "error" + }, + "no_stand_alone_at": { + "level": "error" + } +} \ No newline at end of file diff --git a/atom-extensions/atom-cf-manifest-yaml/grammars/cf-manifest-yaml.cson b/atom-extensions/atom-cf-manifest-yaml/grammars/cf-manifest-yaml.cson new file mode 100644 index 000000000..ca7d226ee --- /dev/null +++ b/atom-extensions/atom-cf-manifest-yaml/grammars/cf-manifest-yaml.cson @@ -0,0 +1,8 @@ +'scopeName': 'source.cf-manifest-yaml' +'name': 'Manifest-YAML' +'fileTypes': [ + 'manifest.yml' +] +'patterns': [ + { 'include': 'source.yaml' } +] diff --git a/atom-extensions/atom-cf-manifest-yaml/icon.png b/atom-extensions/atom-cf-manifest-yaml/icon.png new file mode 100644 index 000000000..394072044 Binary files /dev/null and b/atom-extensions/atom-cf-manifest-yaml/icon.png differ diff --git a/atom-extensions/atom-cf-manifest-yaml/lib/main.js b/atom-extensions/atom-cf-manifest-yaml/lib/main.js new file mode 100644 index 000000000..0019d4dd5 --- /dev/null +++ b/atom-extensions/atom-cf-manifest-yaml/lib/main.js @@ -0,0 +1,46 @@ +const path = require('path'); +const { JarLanguageClient } = require('pivotal-atom-languageclient-commons'); +const PROPERTIES = require('../properties.json'); + +class ManifestYamlLanguageClient extends JarLanguageClient { + + constructor() { + //noinspection JSAnnotator + super( + PROPERTIES.jarUrl, + path.join(__dirname, '..', 'server'), + 'cf-manifest-language-server.jar' + ); + } + + getGrammarScopes() { + return ['source.cf-manifest-yaml'] + } + + getLanguageName() { + return 'Manifest-YAML' + } + + getServerName() { + return 'CF Manifest YAML' + } + + activate() { + // replace the example argument 'linter-ruby' with the name of this Atom package + require('atom-package-deps') + .install('cf-manifest-yaml') + .then(() => console.debug('All dependencies installed, good to go')); + super.activate(); + } + + launchVmArgs(version) { + return [ + '-Dorg.slf4j.simpleLogger.logFile=manifest-yaml.log', + '-Dorg.slf4j.simpleLogger.defaultLogLevel=debug', + ]; + + } + +} + +module.exports = new ManifestYamlLanguageClient(); diff --git a/atom-extensions/atom-cf-manifest-yaml/package.json b/atom-extensions/atom-cf-manifest-yaml/package.json new file mode 100644 index 000000000..71016234a --- /dev/null +++ b/atom-extensions/atom-cf-manifest-yaml/package.json @@ -0,0 +1,73 @@ +{ + "name": "cf-manifest-yaml", + "main": "./lib/main", + "version": "0.0.9", + "description": "Cloud Foundry Deployment Manifest YAML support for Atom", + "repository": "https://github.com/spring-projects/atom-cf-manifest-yaml", + "icon": "icon.png", + "license": "MIT", + "engines": { + "atom": ">=1.17.0" + }, + "files": [ + "grammars/", + "settings/", + "lib/", + "server/", + "properties.json" + ], + "dependencies": { + "atom-package-deps": "^4.6.0", + "download": "^6.2.5", + "pivotal-atom-languageclient-commons": "0.0.8" + }, + "devDependencies": { + "coffeelint": "^1.10.1" + }, + "scripts": { + "clean": "rm -fr node_modules", + "postinstall": "node script.js" + }, + "package-deps": [ + "atom-ide-ui" + ], + "consumedServices": { + "linter-indie": { + "versions": { + "2.0.0": "consumeLinterV2" + } + }, + "nuclide-datatip.provider": { + "versions": { + "0.0.0": "consumeDatatip" + } + } + }, + "providedServices": { + "autocomplete.provider": { + "versions": { + "2.0.0": "provideAutocomplete" + } + }, + "nuclide-code-format.provider": { + "versions": { + "0.0.0": "provideCodeFormat" + } + }, + "nuclide-definition-provider": { + "versions": { + "0.0.0": "provideDefinitions" + } + }, + "nuclide-find-references.provider": { + "versions": { + "0.0.0": "provideFindReferences" + } + }, + "nuclide-outline-view": { + "versions": { + "0.0.0": "provideOutlines" + } + } + } +} diff --git a/atom-extensions/atom-cf-manifest-yaml/properties.json b/atom-extensions/atom-cf-manifest-yaml/properties.json new file mode 100644 index 000000000..a1f280f1a --- /dev/null +++ b/atom-extensions/atom-cf-manifest-yaml/properties.json @@ -0,0 +1,3 @@ +{ + "jarUrl": "https://s3.amazonaws.com/dist.springsource.com/release/STS4/fatjars/manifest-yaml-language-server-0.0.9-201708181059.jar" +} diff --git a/atom-extensions/atom-cf-manifest-yaml/readme-imgs/cf-dynamic-content-assist.png b/atom-extensions/atom-cf-manifest-yaml/readme-imgs/cf-dynamic-content-assist.png new file mode 100644 index 000000000..28f32eaca Binary files /dev/null and b/atom-extensions/atom-cf-manifest-yaml/readme-imgs/cf-dynamic-content-assist.png differ diff --git a/atom-extensions/atom-cf-manifest-yaml/readme-imgs/content-assist.png b/atom-extensions/atom-cf-manifest-yaml/readme-imgs/content-assist.png new file mode 100644 index 000000000..5ba5fadc3 Binary files /dev/null and b/atom-extensions/atom-cf-manifest-yaml/readme-imgs/content-assist.png differ diff --git a/atom-extensions/atom-cf-manifest-yaml/readme-imgs/hovers.png b/atom-extensions/atom-cf-manifest-yaml/readme-imgs/hovers.png new file mode 100644 index 000000000..79be0e4d2 Binary files /dev/null and b/atom-extensions/atom-cf-manifest-yaml/readme-imgs/hovers.png differ diff --git a/atom-extensions/atom-cf-manifest-yaml/readme-imgs/linting.png b/atom-extensions/atom-cf-manifest-yaml/readme-imgs/linting.png new file mode 100644 index 000000000..98afff8bc Binary files /dev/null and b/atom-extensions/atom-cf-manifest-yaml/readme-imgs/linting.png differ diff --git a/atom-extensions/atom-cf-manifest-yaml/script.js b/atom-extensions/atom-cf-manifest-yaml/script.js new file mode 100644 index 000000000..d7b1bd357 --- /dev/null +++ b/atom-extensions/atom-cf-manifest-yaml/script.js @@ -0,0 +1,34 @@ +const fs = require('fs'); +const path = require('path'); +const download = require('download'); +const PROPERTIES = require('./properties.json'); + +let fileExists = function(path) { + return new Promise((resolve, reject) => { + fs.access(path, fs.R_OK, error => { + resolve(!error || error.code !== 'ENOENT'); + }) + }); +}; + +const serverDownloadUrl = PROPERTIES.jarUrl; + +const serverHome = path.join(__dirname, 'server'); + +const localFileName = path.join(serverHome, 'cf-manifest-language-server.jar'); + +fileExists(localFileName).then(exists => { + if (!exists) { + console.log(`Downloading ${serverDownloadUrl} to ${localFileName}`); + fileExists(serverHome) + .then(doesExist => { if (!doesExist) fs.mkdir(serverHome) }) + .then(() => download(serverDownloadUrl)) + .then(data => fs.writeFileSync(localFileName, data)) + .then(() => fileExists(localFileName)) + .then(doesExist => { if (!doesExist) throw Error(`Failed to install the ${this.getServerName()} language server`) }) + .then(() => console.log(`Successfully downloaded ${serverDownloadUrl}`)); + } +}); + + + diff --git a/atom-extensions/atom-cf-manifest-yaml/settings/language-cf-manifest-yaml.cson b/atom-extensions/atom-cf-manifest-yaml/settings/language-cf-manifest-yaml.cson new file mode 100644 index 000000000..7f92594ae --- /dev/null +++ b/atom-extensions/atom-cf-manifest-yaml/settings/language-cf-manifest-yaml.cson @@ -0,0 +1,8 @@ +'.source.cf-manifest-yaml': + 'editor': + 'autoIndentOnPaste': false + 'commentStart': '# ' + 'foldEndPattern': '^\\s*$|^\\s*\\}|^\\s*\\]|^\\s*\\)' + 'increaseIndentPattern': '^\\s*.*(:|-) ?(&\\w+)?(\\{[^}"\']*|\\([^)"\']*)?$' + 'decreaseIndentPattern': '^\\s+\\}$' +'tabType': 'soft' \ No newline at end of file diff --git a/atom-extensions/atom-concourse/.gitignore b/atom-extensions/atom-concourse/.gitignore new file mode 100644 index 000000000..0dd84018c --- /dev/null +++ b/atom-extensions/atom-concourse/.gitignore @@ -0,0 +1,6 @@ +/.idea +/node_modules +/server +*.tgz +*iml +*.log \ No newline at end of file diff --git a/atom-extensions/atom-concourse/README.MD b/atom-extensions/atom-concourse/README.MD new file mode 100644 index 000000000..ebbe0b13d --- /dev/null +++ b/atom-extensions/atom-concourse/README.MD @@ -0,0 +1,72 @@ +# Concourse CI YAML Editor for Atom +[![macOS Build Status](https://travis-ci.org/spring-projects/atom-concourse.svg?branch=master)](https://travis-ci.org/spring-projects/atom-concourse) [![Windows Build Status](https://ci.appveyor.com/api/projects/status/1jvknxt9jhykgrxo?svg=true)](https://ci.appveyor.com/project/spring-projects/atom-concourse/branch/master) [![Dependency Status](https://david-dm.org/spring-projects/atom-concourse.svg)](https://david-dm.org/spring-projects/atom-concourse) + +This extension provides basic validation, content assist and hover infos +for editing Concourse [Pipeline](https://concourse.ci/pipelines.html) and [Task Configuration](https://concourse.ci/running-tasks.html) Files. + +It is recommended to use this extension package when `atom-ide-ui` atom extension package is installed. Thus, reconciling (error/warning markers) and hover support is fully functional. + +## Usage + +The Concourse editor automatically activates when the name of the file you are editing is `pipeline.yml` or `task.yml`. Alternately, you can select the grammar for your file by doing these steps: + +- Open the file, and it will most likely open with the default Atom YAML editor. +- In the bottom-right of the editor, click on YAML. +- This opens the Grammar Selection dialogue. Search and select `Concourse-Pipeline-YAML` for pipeline files, or `Concourse-Task-YAML` for task files. + +## Functionality + +### Validation + +(Requires `atom-ide-ui` package) As you type the file is parsed and checked for basic syntactic and structural correctness. Hover over an error marker to see an explanation. + +![Linting Screenshot][linting] + +### Content Assist + +Having trouble remembering all the names of the attributes, and their spelling? Or can't remember +which resource properties to set in the `get` task params versus its `source` attributes? Or +don't remember what 'special' values are acceptable for a certain property? Content assist +to the rescue: + +![Content Assist Screenshot][ca1] + +![Content Assist Screenshot][ca2] + +### Documentation Hovers + +(Requires `atom-ide-ui` package) Having trouble remembering exactly what the meaning of each attribute is? Hover over any attribute and +read its detailed documentation. + +![Hover Docs Screenshot][hovers] + +### Navigate to Symbol in File + +Is your Pipeline yaml file getting larger and it is becoming harder to find a particular Job, Resource or +Resource Type declaration? The Atom Outline View (View -> Toggle Outline View) helps you quickly jump to a specific definition. + +![Outline View][outline_view] + +## Dev environment setup: +**Prerequisite**: Node 6.x.x or higher is installed, Atom 1.17 or higher is installed +1. Clone the repository +2. Run `npm install` +3. Execute `apm link .` from the folder above +5. Perform `Reload Window` in Atom (Cmd-Shift-P opens commands palette, search for `reload`, select, press `Return`) +6. Open any `pipeline.yml` or `task.yml` file in Atom observe reconciling, content assist and other IDE features + +[linting]: +https://raw.githubusercontent.com/spring-projects/atom-concourse/f56788acb499bea1282c69bc42a269f7c2c92e32/readme-imgs/linting.png + +[ca1]: +https://raw.githubusercontent.com/spring-projects/atom-concourse/f56788acb499bea1282c69bc42a269f7c2c92e32/readme-imgs/ca1.png + +[ca2]: +https://raw.githubusercontent.com/spring-projects/atom-concourse/f56788acb499bea1282c69bc42a269f7c2c92e32/readme-imgs/ca2.png + +[hovers]: +https://raw.githubusercontent.com/spring-projects/atom-concourse/f56788acb499bea1282c69bc42a269f7c2c92e32/readme-imgs/hovers.png + +[outline_view]: +https://raw.githubusercontent.com/spring-projects/atom-concourse/f56788acb499bea1282c69bc42a269f7c2c92e32/readme-imgs/outline_view.png + diff --git a/atom-extensions/atom-concourse/coffeelint.json b/atom-extensions/atom-concourse/coffeelint.json new file mode 100644 index 000000000..d6c3236aa --- /dev/null +++ b/atom-extensions/atom-concourse/coffeelint.json @@ -0,0 +1,37 @@ +{ + "max_line_length": { + "level": "ignore" + }, + "no_empty_param_list": { + "level": "error" + }, + "arrow_spacing": { + "level": "error" + }, + "no_interpolation_in_single_quotes": { + "level": "error" + }, + "no_debugger": { + "level": "error" + }, + "prefer_english_operator": { + "level": "error" + }, + "colon_assignment_spacing": { + "spacing": { + "left": 0, + "right": 1 + }, + "level": "error" + }, + "braces_spacing": { + "spaces": 0, + "level": "error" + }, + "spacing_after_comma": { + "level": "error" + }, + "no_stand_alone_at": { + "level": "error" + } +} \ No newline at end of file diff --git a/atom-extensions/atom-concourse/grammars/concourse-pipeline-yaml.cson b/atom-extensions/atom-concourse/grammars/concourse-pipeline-yaml.cson new file mode 100644 index 000000000..df787d6c8 --- /dev/null +++ b/atom-extensions/atom-concourse/grammars/concourse-pipeline-yaml.cson @@ -0,0 +1,8 @@ +'scopeName': 'source.concourse-pipeline-yaml' +'name': 'Concourse-Pipeline-YAML' +'fileTypes': [ + 'pipeline.yml' +] +'patterns': [ + { 'include': 'source.yaml' } +] diff --git a/atom-extensions/atom-concourse/grammars/concourse-task-yaml.cson b/atom-extensions/atom-concourse/grammars/concourse-task-yaml.cson new file mode 100644 index 000000000..c39eae61a --- /dev/null +++ b/atom-extensions/atom-concourse/grammars/concourse-task-yaml.cson @@ -0,0 +1,8 @@ +'scopeName': 'source.concourse-task-yaml' +'name': 'Concourse-Task-YAML' +'fileTypes': [ + 'tasks.yml' +] +'patterns': [ + { 'include': 'source.yaml' } +] \ No newline at end of file diff --git a/atom-extensions/atom-concourse/icon.png b/atom-extensions/atom-concourse/icon.png new file mode 100644 index 000000000..394072044 Binary files /dev/null and b/atom-extensions/atom-concourse/icon.png differ diff --git a/atom-extensions/atom-concourse/lib/main.js b/atom-extensions/atom-concourse/lib/main.js new file mode 100644 index 000000000..c907c0f86 --- /dev/null +++ b/atom-extensions/atom-concourse/lib/main.js @@ -0,0 +1,46 @@ +const path = require('path'); +const { JarLanguageClient } = require('pivotal-atom-languageclient-commons'); +const PROPERTIES = require('../properties.json'); + +class ConcourseCiYamlClient extends JarLanguageClient { + + constructor() { + //noinspection JSAnnotator + super( + PROPERTIES.jarUrl, + path.join(__dirname, '..', 'server'), + 'concourse-language-server.jar' + ); + } + + getGrammarScopes() { + return ['source.concourse-pipeline-yaml','source.concourse-task-yaml']; + } + + getLanguageName() { + return 'Concourse-Pipeline-YAML'; + } + + getServerName() { + return 'Concourse-Pipeline-YAML'; + } + + activate() { + // replace the example argument 'linter-ruby' with the name of this Atom package + require('atom-package-deps') + .install('concourse-pipeline-yaml') + .then(() => console.debug('All dependencies installed, good to go')); + super.activate(); + } + + launchVmArgs(version) { + return [ + '-Dorg.slf4j.simpleLogger.logFile=concourse-ci-yaml.log', + '-Dorg.slf4j.simpleLogger.defaultLogLevel=debug', + ]; + + } + +} + +module.exports = new ConcourseCiYamlClient(); diff --git a/atom-extensions/atom-concourse/package.json b/atom-extensions/atom-concourse/package.json new file mode 100644 index 000000000..f786fd6f5 --- /dev/null +++ b/atom-extensions/atom-concourse/package.json @@ -0,0 +1,73 @@ +{ + "name": "concourse-pipeline-yaml", + "main": "./lib/main", + "version": "0.0.9", + "description": "Provides validation and content assist for Concourse CI pipeline and task configuration yml files", + "repository": "https://github.com/spring-projects/atom-concourse", + "icon": "icon.png", + "license": "MIT", + "engines": { + "atom": ">=1.17.0" + }, + "files": [ + "grammars/", + "settings/", + "lib/", + "server/", + "properties.json" + ], + "dependencies": { + "atom-package-deps": "^4.6.0", + "download": "^6.2.5", + "pivotal-atom-languageclient-commons": "0.0.8" + }, + "devDependencies": { + "coffeelint": "^1.10.1" + }, + "scripts": { + "clean": "rm -fr node_modules", + "postinstall": "node script.js" + }, + "package-deps": [ + "atom-ide-ui" + ], + "consumedServices": { + "linter-indie": { + "versions": { + "2.0.0": "consumeLinterV2" + } + }, + "nuclide-datatip.provider": { + "versions": { + "0.0.0": "consumeDatatip" + } + } + }, + "providedServices": { + "autocomplete.provider": { + "versions": { + "2.0.0": "provideAutocomplete" + } + }, + "nuclide-code-format.provider": { + "versions": { + "0.0.0": "provideCodeFormat" + } + }, + "nuclide-definition-provider": { + "versions": { + "0.0.0": "provideDefinitions" + } + }, + "nuclide-find-references.provider": { + "versions": { + "0.0.0": "provideFindReferences" + } + }, + "nuclide-outline-view": { + "versions": { + "0.0.0": "provideOutlines" + } + } + } +} diff --git a/atom-extensions/atom-concourse/properties.json b/atom-extensions/atom-concourse/properties.json new file mode 100644 index 000000000..f8b2a94fb --- /dev/null +++ b/atom-extensions/atom-concourse/properties.json @@ -0,0 +1,3 @@ +{ + "jarUrl": "https://s3.amazonaws.com/dist.springsource.com/release/STS4/fatjars/concourse-language-server-0.0.9-201708181059.jar" +} diff --git a/atom-extensions/atom-concourse/readme-imgs/ca1.png b/atom-extensions/atom-concourse/readme-imgs/ca1.png new file mode 100644 index 000000000..c559ba402 Binary files /dev/null and b/atom-extensions/atom-concourse/readme-imgs/ca1.png differ diff --git a/atom-extensions/atom-concourse/readme-imgs/ca2.png b/atom-extensions/atom-concourse/readme-imgs/ca2.png new file mode 100644 index 000000000..120a00ee3 Binary files /dev/null and b/atom-extensions/atom-concourse/readme-imgs/ca2.png differ diff --git a/atom-extensions/atom-concourse/readme-imgs/hovers.png b/atom-extensions/atom-concourse/readme-imgs/hovers.png new file mode 100644 index 000000000..1ef8c8f5d Binary files /dev/null and b/atom-extensions/atom-concourse/readme-imgs/hovers.png differ diff --git a/atom-extensions/atom-concourse/readme-imgs/linting.png b/atom-extensions/atom-concourse/readme-imgs/linting.png new file mode 100644 index 000000000..0f0cb3516 Binary files /dev/null and b/atom-extensions/atom-concourse/readme-imgs/linting.png differ diff --git a/atom-extensions/atom-concourse/readme-imgs/outline_view.png b/atom-extensions/atom-concourse/readme-imgs/outline_view.png new file mode 100644 index 000000000..dd5bea95d Binary files /dev/null and b/atom-extensions/atom-concourse/readme-imgs/outline_view.png differ diff --git a/atom-extensions/atom-concourse/script.js b/atom-extensions/atom-concourse/script.js new file mode 100644 index 000000000..060138648 --- /dev/null +++ b/atom-extensions/atom-concourse/script.js @@ -0,0 +1,34 @@ +const fs = require('fs'); +const path = require('path'); +const download = require('download'); +const PROPERTIES = require('./properties.json'); + +let fileExists = function(path) { + return new Promise((resolve, reject) => { + fs.access(path, fs.R_OK, error => { + resolve(!error || error.code !== 'ENOENT'); + }) + }); +}; + +const serverDownloadUrl = PROPERTIES.jarUrl; + +const serverHome = path.join(__dirname, 'server'); + +const localFileName = path.join(serverHome, 'concourse-language-server.jar'); + +fileExists(localFileName).then(exists => { + if (!exists) { + console.log(`Downloading ${serverDownloadUrl} to ${localFileName}`); + fileExists(serverHome) + .then(doesExist => { if (!doesExist) fs.mkdir(serverHome) }) + .then(() => download(serverDownloadUrl)) + .then(data => fs.writeFileSync(localFileName, data)) + .then(() => fileExists(localFileName)) + .then(doesExist => { if (!doesExist) throw Error(`Failed to install the ${this.getServerName()} language server`) }) + .then(() => console.log(`Successfully downloaded ${serverDownloadUrl}`)); + } +}); + + + diff --git a/atom-extensions/atom-concourse/settings/language-concourse-pipeline-yaml.cson b/atom-extensions/atom-concourse/settings/language-concourse-pipeline-yaml.cson new file mode 100644 index 000000000..267c16356 --- /dev/null +++ b/atom-extensions/atom-concourse/settings/language-concourse-pipeline-yaml.cson @@ -0,0 +1,8 @@ +'.source.concourse-pipeline-yaml': + 'editor': + 'autoIndentOnPaste': false + 'commentStart': '# ' + 'foldEndPattern': '^\\s*$|^\\s*\\}|^\\s*\\]|^\\s*\\)' + 'increaseIndentPattern': '^\\s*.*(:|-) ?(&\\w+)?(\\{[^}"\']*|\\([^)"\']*)?$' + 'decreaseIndentPattern': '^\\s+\\}$' +'tabType': 'soft' \ No newline at end of file diff --git a/atom-extensions/atom-concourse/settings/language-concourse-task-yaml.cson b/atom-extensions/atom-concourse/settings/language-concourse-task-yaml.cson new file mode 100644 index 000000000..983f9590e --- /dev/null +++ b/atom-extensions/atom-concourse/settings/language-concourse-task-yaml.cson @@ -0,0 +1,8 @@ +'.source.concourse-task-yaml': + 'editor': + 'autoIndentOnPaste': false + 'commentStart': '# ' + 'foldEndPattern': '^\\s*$|^\\s*\\}|^\\s*\\]|^\\s*\\)' + 'increaseIndentPattern': '^\\s*.*(:|-) ?(&\\w+)?(\\{[^}"\']*|\\([^)"\']*)?$' + 'decreaseIndentPattern': '^\\s+\\}$' +'tabType': 'soft' \ No newline at end of file