Skip to content
This repository has been archived by the owner on Apr 5, 2022. It is now read-only.

Commit

Permalink
Publish 0.1.0-201711272359
Browse files Browse the repository at this point in the history
  • Loading branch information
BoykoAlex committed Nov 28, 2017
1 parent c3e4561 commit 6fde0d3
Show file tree
Hide file tree
Showing 17 changed files with 49 additions and 215 deletions.
163 changes: 25 additions & 138 deletions README.md
@@ -1,171 +1,58 @@
# 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)
# 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 Bosh [Deployment Manifest](https://bosh.io/docs/deployment-manifest.html) and [Cloud Config](https://bosh.io/docs/cloud-config.html) Files.
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 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.
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

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:
(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? 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.
### Content Assist

There are two ways to set things up to make this work:
Having trouble remembering all the names of the attributes, and their spelling? Content assist to the
rescue:

#### Explicitly Configure the CLI:
![Content Assist Screenshot][ca]

From Atom, press `CTRL-SHIFT-P` and type `config`. Then enter or edit:
### Dynamic Cloud Foundry Content Assist

```
"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.
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.

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:
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.

First, create an alias for your environment:
Dynamic content assist also shows which Cloud target you are connected to.

```
$ 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
$
```
![Dynamic Cloud Foundry Content Assist Screenshot][dcfca]

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:
### Documentation Hovers

bosh cloud-config
(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.

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.
![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 `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/sts4/af715bad53bd6cf30a10a2dc6d34bfcc17968382/atom-extensions/atom-bosh/readme-imgs/linting.png

[ca1]:
https://raw.githubusercontent.com/spring-projects/sts4/af715bad53bd6cf30a10a2dc6d34bfcc17968382/atom-extensions/atom-bosh/readme-imgs/ca1.png

[ca2]:
https://raw.githubusercontent.com/spring-projects/sts4/af715bad53bd6cf30a10a2dc6d34bfcc17968382/atom-extensions/atom-bosh/readme-imgs/ca2.png
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

[hovers]:
https://raw.githubusercontent.com/spring-projects/sts4/af715bad53bd6cf30a10a2dc6d34bfcc17968382/atom-extensions/atom-bosh/readme-imgs/hovers.png
[linting]: https://raw.githubusercontent.com/spring-projects/sts4/af715bad53bd6cf30a10a2dc6d34bfcc17968382/atom-extensions/atom-cf-manifest-yaml/readme-imgs/linting.png
[ca]: https://raw.githubusercontent.com/spring-projects/sts4/af715bad53bd6cf30a10a2dc6d34bfcc17968382/atom-extensions/atom-cf-manifest-yaml/readme-imgs/content-assist.png
[dcfca]: https://raw.githubusercontent.com/spring-projects/sts4/af715bad53bd6cf30a10a2dc6d34bfcc17968382/atom-extensions/atom-cf-manifest-yaml/readme-imgs/cf-dynamic-content-assist.png
[hovers]: https://raw.githubusercontent.com/spring-projects/sts4/af715bad53bd6cf30a10a2dc6d34bfcc17968382/atom-extensions/atom-cf-manifest-yaml/readme-imgs/hovers.png

[outline_view]:
https://raw.githubusercontent.com/spring-projects/sts4/af715bad53bd6cf30a10a2dc6d34bfcc17968382/atom-extensions/atom-bosh/readme-imgs/outline_view.png
8 changes: 0 additions & 8 deletions grammars/bosh-cloud-config.cson

This file was deleted.

8 changes: 0 additions & 8 deletions grammars/bosh-deployment-manifest.cson

This file was deleted.

8 changes: 8 additions & 0 deletions grammars/cf-manifest-yaml.cson
@@ -0,0 +1,8 @@
'scopeName': 'source.cf-manifest-yaml'
'name': 'Manifest-YAML'
'fileTypes': [
'manifest.yml'
]
'patterns': [
{ 'include': 'source.yaml' }
]
28 changes: 10 additions & 18 deletions lib/main.js
Expand Up @@ -2,53 +2,45 @@ const path = require('path');
const { JavaProcessLanguageClient } = require('pivotal-atom-languageclient-commons');
const PROPERTIES = require('../properties.json');

class BoshYamlClient extends JavaProcessLanguageClient {
class ManifestYamlLanguageClient extends JavaProcessLanguageClient {

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)));
'cf-manifest-language-server.jar'
);
}

getGrammarScopes() {
return ['source.bosh-deployment-manifest', 'source.bosh-cloud-config'];
return ['source.cf-manifest-yaml']
}

getLanguageName() {
return 'Bosh-YAML';
return 'Manifest-YAML'
}

getServerName() {
return 'Bosh-YAML';
return 'CF Manifest YAML'
}

activate() {
// replace the example argument 'linter-ruby' with the name of this Atom package
require('atom-package-deps')
.install('bosh-yaml')
.install('cf-manifest-yaml')
.then(() => console.debug('All dependencies installed, good to go'));
super.activate();
}

launchVmArgs(version) {
return Promise.resolve([
'-Dorg.slf4j.simpleLogger.logFile=bosh-yaml.log',
'-Dorg.slf4j.simpleLogger.logFile=manifest-yaml.log',
'-Dorg.slf4j.simpleLogger.defaultLogLevel=debug',
]);

}

sendConfig(server) {
server.connection.didChangeConfiguration({ settings: atom.config.get('bosh-yaml') });
}

}

module.exports = new BoshYamlClient();
module.exports = new ManifestYamlLanguageClient();
35 changes: 3 additions & 32 deletions package.json
@@ -1,9 +1,9 @@
{
"name": "bosh-yaml",
"name": "cf-manifest-yaml",
"main": "./lib/main",
"version": "0.1.0",
"description": "Provides validation and content assist for various Bosh configuration files",
"repository": "https://github.com/spring-projects/atom-bosh",
"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": {
Expand All @@ -21,35 +21,6 @@
"download": "^6.2.5",
"pivotal-atom-languageclient-commons": "0.0.17"
},
"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"
},
Expand Down
2 changes: 1 addition & 1 deletion properties.json
@@ -1,3 +1,3 @@
{
"jarUrl": "https://s3.amazonaws.com/dist.springsource.com/release/STS4/fatjars/manifest-yaml-language-server-0.1.1-201711272304.jar"
"jarUrl": "https://s3-us-west-1.amazonaws.com/s3-test.spring.io/sts4/fatjars/snapshots/manifest-yaml-language-server-0.1.0-201711272359.jar"
}
Binary file removed readme-imgs/ca1.png
Binary file not shown.
Binary file removed readme-imgs/ca2.png
Binary file not shown.
Binary file added readme-imgs/cf-dynamic-content-assist.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added readme-imgs/content-assist.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified readme-imgs/hovers.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified readme-imgs/linting.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed readme-imgs/outline_view.png
Binary file not shown.
2 changes: 1 addition & 1 deletion script.js
Expand Up @@ -15,7 +15,7 @@ const serverDownloadUrl = PROPERTIES.jarUrl;

const serverHome = path.join(__dirname, 'server');

const localFileName = path.join(serverHome, 'bosh-language-server.jar');
const localFileName = path.join(serverHome, 'cf-manifest-language-server.jar');

fileExists(localFileName).then(exists => {
if (!exists) {
Expand Down
8 changes: 0 additions & 8 deletions settings/language-bosh-deployment-manifest.cson

This file was deleted.

@@ -1,4 +1,4 @@
'.source.bosh-cloud-config':
'.source.cf-manifest-yaml':
'editor':
'autoIndentOnPaste': false
'commentStart': '# '
Expand Down

0 comments on commit 6fde0d3

Please sign in to comment.