diff --git a/.github/stale.yml b/.github/stale.yml
new file mode 100644
index 0000000..f951363
--- /dev/null
+++ b/.github/stale.yml
@@ -0,0 +1,19 @@
+# Number of days of inactivity before an issue becomes stale
+daysUntilStale: 60
+# Number of days of inactivity before a stale issue is closed
+daysUntilClose: 7
+# Issues with these labels will never be considered stale
+exemptLabels:
+ - high priority
+ - pending-publication
+ - add-language
+ - add-beautifier
+# Label to use when marking an issue as stale
+staleLabel: stale
+# Comment to post when marking an issue as stale. Set to `false` to disable
+markComment: >
+ This issue has been automatically marked as stale because it has not had
+ recent activity. If this is still an issue, please add a comment. It will be closed if no further activity occurs. Thank you
+ for your contributions.
+# Comment to post when closing a stale issue. Set to `false` to disable
+closeComment: false
diff --git a/.travis.yml b/.travis.yml
index 873af00..0b2e4ca 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -97,7 +97,7 @@ before_install:
- brew tap homebrew/versions
# Ruby language support
# - gem install ruby-beautify --verbose
- - gem install rubocop
+ # - gem install rubocop
- gem install htmlbeautifier
- gem install puppet-lint
# Sass language support
@@ -185,4 +185,10 @@ before_install:
pip install --user beautysh;
else
pip install beautysh;
- fi
\ No newline at end of file
+ fi
+ # terraform
+ - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
+ brew install terraform;
+ else
+ docker pull hashicorp/terraform;
+ fi
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ac1e0a9..5a0318d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,14 @@
# Next
+- ...
+
+# v0.30.6 (2017-10-30)
+- See [#645](https://github.com/Glavin001/atom-beautify/issues/645). Add support for Terraform fmt.
- See [#881](https://github.com/Glavin001/atom-beautify/issues/881). Update to Prettydiff version 2!
- Fix for [#1888](https://github.com/Glavin001/atom-beautify/issues/1888). Allow 0 for minor and patch versions of Docker
+- Add Atom-Beautify package settings menu item to Packages menu [#1869](https://github.com/Glavin001/atom-beautify/issues/1869)
+- Add `.ttslua` file extension to Lua language
+- Fix [#1638]. Update TypeScript Formatter dependency
+- Fix [#1833] `os.tmpDir` deprecation warning
- Add hindent and brittany beautifiers for haskell
# v0.30.5 (2017-08-11)
diff --git a/README-template.md b/README-template.md
index 5573201..911743d 100644
--- a/README-template.md
+++ b/README-template.md
@@ -1,4 +1,5 @@
# :lipstick: [{{package.name}}](https://github.com/Glavin001/atom-beautify)
+[![apm](https://img.shields.io/apm/dm/atom-beautify.svg)](https://atom.io/packages/atom-beautify)
[![Greenkeeper badge](https://badges.greenkeeper.io/Glavin001/atom-beautify.svg)](https://greenkeeper.io/)
[![GitHub issues](https://img.shields.io/github/issues/Glavin001/atom-beautify.svg?style=flat-square)](https://github.com/Glavin001/atom-beautify/issues)
[![GitHub stars](https://img.shields.io/github/stars/Glavin001/atom-beautify.svg?style=flat-square)](https://github.com/Glavin001/atom-beautify/stargazers)
@@ -45,7 +46,7 @@ Atom Package: https://atom.io/packages/atom-beautify
apm install atom-beautify
```
-Or Settings/Preferences ➔ Packages ➔ Search for `atom-beautify`
+Or Settings/Preferences ➔ Install ➔ Search for `atom-beautify`
### Important Notice: Analytics
@@ -203,6 +204,8 @@ See [`docs/troubleshooting.md`](docs/troubleshooting.md).
## Contributing
+See [`CONTRIBUTING.md`](CONTRIBUTING.md).
+
[See all contributors on GitHub](../../graphs/contributors).
Please update the [CHANGELOG.md](CHANGELOG.md),
diff --git a/README.md b/README.md
index 5b80850..015f53b 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,5 @@
# :lipstick: [atom-beautify](https://github.com/Glavin001/atom-beautify)
+[![apm](https://img.shields.io/apm/dm/atom-beautify.svg)](https://atom.io/packages/atom-beautify)
[![Greenkeeper badge](https://badges.greenkeeper.io/Glavin001/atom-beautify.svg)](https://greenkeeper.io/)
[![GitHub issues](https://img.shields.io/github/issues/Glavin001/atom-beautify.svg?style=flat-square)](https://github.com/Glavin001/atom-beautify/issues)
[![GitHub stars](https://img.shields.io/github/stars/Glavin001/atom-beautify.svg?style=flat-square)](https://github.com/Glavin001/atom-beautify/stargazers)
@@ -45,7 +46,7 @@ Atom Package: https://atom.io/packages/atom-beautify
apm install atom-beautify
```
-Or Settings/Preferences ➔ Packages ➔ Search for `atom-beautify`
+Or Settings/Preferences ➔ Install ➔ Search for `atom-beautify`
### Important Notice: Analytics
@@ -113,6 +114,7 @@ Some of the supported beautifiers are developed for Node.js and are automaticall
| SassConvert | :warning: 1 executable | :white_check_mark: :100:% of executables | :whale: With [Docker](https://www.docker.com/):
1. Install [SassConvert (`sass-convert`)](http://sass-lang.com/documentation/file.SASS_REFERENCE.html#syntax) with `docker pull unibeautify/sass-convert`
:bookmark_tabs: Manually:
1. Install [SassConvert (`sass-convert`)](http://sass-lang.com/documentation/file.SASS_REFERENCE.html#syntax) by following http://sass-lang.com/documentation/file.SASS_REFERENCE.html#syntax
|
| sqlformat | :warning: Manual installation | :construction: Not an executable | :page_facing_up: Go to https://github.com/andialbrecht/sqlparse and follow the instructions. |
| stylish-haskell | :warning: Manual installation | :construction: Not an executable | :page_facing_up: Go to https://github.com/jaspervdj/stylish-haskell and follow the instructions. |
+| terraformfmt | :warning: 1 executable | :white_check_mark: :100:% of executables | :whale: With [Docker](https://www.docker.com/):
1. Install [Terraform (`terraform`)](https://www.terraform.io) with `docker pull hashicorp/terraform`
:bookmark_tabs: Manually:
1. Install [Terraform (`terraform`)](https://www.terraform.io) by following https://www.terraform.io
|
| Tidy Markdown | :white_check_mark: | :ok_hand: Not necessary | :smiley: Nothing! |
| TypeScript Formatter | :white_check_mark: | :ok_hand: Not necessary | :smiley: Nothing! |
| Uncrustify | :warning: 1 executable | :white_check_mark: :100:% of executables | :whale: With [Docker](https://www.docker.com/):
1. Install [Uncrustify (`uncrustify`)](http://uncrustify.sourceforge.net/) with `docker pull unibeautify/uncrustify`
:bookmark_tabs: Manually:
1. Install [Uncrustify (`uncrustify`)](http://uncrustify.sourceforge.net/) by following https://github.com/uncrustify/uncrustify
|
@@ -180,6 +182,7 @@ See [all supported options in the documentation at `docs/options.md`](docs/opti
| SQL | `SQL (Rails)`, `SQL` |`.sql` | **[`sqlformat`](https://github.com/andialbrecht/sqlparse)** |
| SVG | `SVG` |`.svg` | **[`Pretty Diff`](https://github.com/prettydiff/prettydiff)** |
| Swig | `HTML (Swig)`, `SWIG` |`.swig` | **[`Pretty Diff`](https://github.com/prettydiff/prettydiff)** |
+| Terraform | `Terraform` |`.tf` | **[`terraformfmt`](https://www.terraform.io/docs/commands/fmt.html)** |
| TSS | `TSS` |`.tss` | **[`Pretty Diff`](https://github.com/prettydiff/prettydiff)** |
| Twig | `HTML (Twig)` |`.twig` | **[`Pretty Diff`](https://github.com/prettydiff/prettydiff)** |
| TypeScript | `TypeScript` |`.ts` | **[`TypeScript Formatter`](https://github.com/vvakame/typescript-formatter)** |
@@ -318,6 +321,8 @@ See [`docs/troubleshooting.md`](docs/troubleshooting.md).
## Contributing
+See [`CONTRIBUTING.md`](CONTRIBUTING.md).
+
[See all contributors on GitHub](../../graphs/contributors).
Please update the [CHANGELOG.md](CHANGELOG.md),
diff --git a/appveyor.yml b/appveyor.yml
index cbf5041..bf21dfb 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -98,6 +98,10 @@ install:
- cinst emacs -y
- where emacs
+ # terraform
+ - cinst terraform -y
+ - where terraform
+
# FIXME: Enable allowEmptyChecksums, until someone fixes the checksum issue of php
- choco feature enable -n allowEmptyChecksums
# PHP
diff --git a/docs/add-languages-and-beautifiers.md b/docs/add-languages-and-beautifiers.md
index b702f91..5d9e053 100644
--- a/docs/add-languages-and-beautifiers.md
+++ b/docs/add-languages-and-beautifiers.md
@@ -11,8 +11,6 @@ You can use [`codo`](https://github.com/coffeedoc/codo) to build your own docume
After you make a change to language or beautifier `options` you will need to update the `options.json` file that is created on install.
```bash
-# Update src/options.json file to have new/changed options
-npm run postinstall
# Update documentation to include information about those options
npm run docs
```
diff --git a/docs/options.md b/docs/options.md
index 1532ad5..f440b10 100644
--- a/docs/options.md
+++ b/docs/options.md
@@ -368,6 +368,23 @@ Options for SassConvert executable.
2. Go into *Packages* and search for "*Atom Beautify*" package.
3. Find the option "*SassConvert*" and change it to your desired configuration.
+##### [Terraform](#terraform)
+
+**Important**: This option is only configurable from within Atom Beautify's setting panel.
+
+**Type**: `object`
+
+**Description**:
+
+Options for Terraform executable.
+
+**How to Configure**
+
+1. You can open the [Settings View](https://github.com/atom/settings-view) by navigating to
+*Edit > Preferences (Linux)*, *Atom > Preferences (OS X)*, or *File > Preferences (Windows)*.
+2. Go into *Packages* and search for "*Atom Beautify*" package.
+3. Find the option "*Terraform*" and change it to your desired configuration.
+
##### [Uncrustify](#uncrustify)
**Important**: This option is only configurable from within Atom Beautify's setting panel.
@@ -12171,6 +12188,75 @@ Maximum characters per line (0 disables) (Supported by Pretty Diff)
}
```
+#### [Terraform](#terraform)
+
+**Supported Beautifiers**: [`terraformfmt`](#terraformfmt)
+
+| Option | terraformfmt |
+| --- | --- |
+| `disabled` | :white_check_mark: |
+| `default_beautifier` | :white_check_mark: |
+| `beautify_on_save` | :white_check_mark: |
+
+**Description**:
+
+Options for language Terraform
+
+##### [Disable Beautifying Language](#disable-beautifying-language)
+
+**Important**: This option is only configurable from within Atom Beautify's setting panel.
+
+**Type**: `boolean`
+
+**Description**:
+
+Disable Terraform Beautification
+
+**How to Configure**
+
+1. You can open the [Settings View](https://github.com/atom/settings-view) by navigating to
+*Edit > Preferences (Linux)*, *Atom > Preferences (OS X)*, or *File > Preferences (Windows)*.
+2. Go into *Packages* and search for "*Atom Beautify*" package.
+3. Find the option "*Disable Beautifying Language*" and change it to your desired configuration.
+
+##### [Default Beautifier](#default-beautifier)
+
+**Important**: This option is only configurable from within Atom Beautify's setting panel.
+
+**Default**: `terraformfmt`
+
+**Type**: `string`
+
+**Enum**: `terraformfmt`
+
+**Description**:
+
+Default Beautifier to be used for Terraform
+
+**How to Configure**
+
+1. You can open the [Settings View](https://github.com/atom/settings-view) by navigating to
+*Edit > Preferences (Linux)*, *Atom > Preferences (OS X)*, or *File > Preferences (Windows)*.
+2. Go into *Packages* and search for "*Atom Beautify*" package.
+3. Find the option "*Default Beautifier*" and change it to your desired configuration.
+
+##### [Beautify On Save](#beautify-on-save)
+
+**Important**: This option is only configurable from within Atom Beautify's setting panel.
+
+**Type**: `boolean`
+
+**Description**:
+
+Automatically beautify Terraform files on save
+
+**How to Configure**
+
+1. You can open the [Settings View](https://github.com/atom/settings-view) by navigating to
+*Edit > Preferences (Linux)*, *Atom > Preferences (OS X)*, or *File > Preferences (Windows)*.
+2. Go into *Packages* and search for "*Atom Beautify*" package.
+3. Find the option "*Beautify On Save*" and change it to your desired configuration.
+
#### [TSS](#tss)
**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff)
diff --git a/docs/troubleshooting.md b/docs/troubleshooting.md
index df99d73..b01f828 100644
--- a/docs/troubleshooting.md
+++ b/docs/troubleshooting.md
@@ -16,3 +16,9 @@ The debugging results will be copied to your clipboard.
3. Create a file in your new Gist called `debug.md`.
4. Paste your debugging results from Atom beautify into `debug.md` file in your Gist.
5. Add a link to your Gist in your new Issue.
+
+## Common Issues
+
+> I receive an error when I try to install or update Atom Beautify
+
+Run `apm clean` from your terminal, then retry
\ No newline at end of file
diff --git a/examples/simple-jsbeautifyrc/terraform/expected/test.tf b/examples/simple-jsbeautifyrc/terraform/expected/test.tf
new file mode 100644
index 0000000..5f855b3
--- /dev/null
+++ b/examples/simple-jsbeautifyrc/terraform/expected/test.tf
@@ -0,0 +1,18 @@
+resource "aws_db_instance" "wordpress" {
+ # worng spaces # to much spaces
+
+ allocated_storage = 10
+ storage_type = "gp2"
+ engine = "mariadb"
+ engine_version = "10.0.24"
+
+ instance_class = "db.t2.micro"
+ identifier = "db-${var.env}"
+ name = "wordpress"
+
+ username = "wordpress"
+ password = "${var.wordpress_db_pass}"
+ db_subnet_group_name = "${aws_db_subnet_group.default.name}"
+ vpc_security_group_ids = ["${aws_security_group.RuleWebServerIn.id}"]
+ apply_immediately = true
+}
diff --git a/examples/simple-jsbeautifyrc/terraform/original/test.tf b/examples/simple-jsbeautifyrc/terraform/original/test.tf
new file mode 100644
index 0000000..702bfe8
--- /dev/null
+++ b/examples/simple-jsbeautifyrc/terraform/original/test.tf
@@ -0,0 +1,21 @@
+resource "aws_db_instance" "wordpress" {
+ # worng spaces
+ # to much spaces
+
+ allocated_storage = 10
+ storage_type = "gp2"
+ engine = "mariadb"
+ engine_version = "10.0.24"
+
+instance_class = "db.t2.micro"
+ identifier = "db-${var.env}"
+ name = "wordpress"
+
+
+
+ username = "wordpress"
+ password = "${var.wordpress_db_pass}"
+ db_subnet_group_name = "${aws_db_subnet_group.default.name}"
+ vpc_security_group_ids = ["${aws_security_group.RuleWebServerIn.id}"]
+ apply_immediately = true
+}
diff --git a/menus/atom-beautify.cson b/menus/atom-beautify.cson
index fdfd781..a0d2d54 100644
--- a/menus/atom-beautify.cson
+++ b/menus/atom-beautify.cson
@@ -25,6 +25,10 @@
'label': 'Debug'
'command': 'atom-beautify:help-debug-editor'
}
+ {
+ 'label': 'Settings'
+ 'command': 'atom-beautify:open-settings'
+ }
]
]
}
diff --git a/package.json b/package.json
index c3b9b1d..aeda73b 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "atom-beautify",
"main": "./src/beautify",
- "version": "0.30.5",
+ "version": "0.30.6",
"private": true,
"description": "Beautify HTML, CSS, JavaScript, PHP, Python, Ruby, Java, C, C++, C#, Objective-C, CoffeeScript, TypeScript, Coldfusion, SQL, and more in Atom",
"repository": {
@@ -213,6 +213,7 @@
"atom-workspace": [
"atom-beautify:help-debug-editor",
"atom-beautify:beautify-editor",
+ "atom-beautify:open-settings",
"atom-beautify:migrate-settings",
"core:save",
"core:save-as",
@@ -280,7 +281,8 @@
"atom-beautify:beautify-language-visualforce",
"atom-beautify:beautify-language-xml",
"atom-beautify:beautify-language-xtemplate",
- "atom-beautify:beautify-language-yaml"
+ "atom-beautify:beautify-language-yaml",
+ "atom-beautify:beautify-language-terraform"
],
".tree-view .file .name": [
"atom-beautify:beautify-file"
@@ -415,7 +417,9 @@
"nginx beautify",
"golang template",
"align-yaml",
- "goimports"
+ "goimports",
+ "terraform",
+ "terraformfmt"
],
"devDependencies": {
"coffeelint": "1.16.0"
diff --git a/src/beautifiers/index.coffee b/src/beautifiers/index.coffee
index 816bcf4..62c7202 100644
--- a/src/beautifiers/index.coffee
+++ b/src/beautifiers/index.coffee
@@ -82,6 +82,7 @@ module.exports = class Beautifiers extends EventEmitter
'marko-beautifier'
'formatR'
'beautysh'
+ 'terraformfmt'
]
###
diff --git a/src/beautifiers/terraformfmt.coffee b/src/beautifiers/terraformfmt.coffee
new file mode 100644
index 0000000..f799898
--- /dev/null
+++ b/src/beautifiers/terraformfmt.coffee
@@ -0,0 +1,38 @@
+###
+Requires terraform installed
+###
+
+"use strict"
+Beautifier = require('./beautifier')
+
+module.exports = class Terraformfmt extends Beautifier
+ name: "terraformfmt"
+ link: "https://www.terraform.io/docs/commands/fmt.html"
+
+ options: {
+ Terraform: false
+ }
+
+ executables: [
+ {
+ name: "Terraform"
+ cmd: "terraform"
+ homepage: "https://www.terraform.io"
+ installation: "https://www.terraform.io"
+ version: {
+ parse: (text) -> text.match(/Terraform v(\d+\.\d+\.\d+)/)[1]
+ }
+ docker: {
+ image: "hashicorp/terraform"
+ }
+ }
+ ]
+
+ beautify: (text, language, options) ->
+ @exe("terraform").run([
+ "fmt"
+ tempFile = @tempFile("input", text)
+ ])
+ .then(=>
+ @readFile(tempFile)
+ )
diff --git a/src/beautify.coffee b/src/beautify.coffee
index 55f568f..3a850a4 100644
--- a/src/beautify.coffee
+++ b/src/beautify.coffee
@@ -556,6 +556,9 @@ handleSaveEvent = ->
)
plugin.subscriptions.add disposable
+openSettings = ->
+ atom.workspace.open('atom://config/packages/atom-beautify')
+
getUnsupportedOptions = ->
settings = atom.config.get('atom-beautify')
schema = atom.config.getSchema('atom-beautify')
@@ -622,6 +625,7 @@ plugin.activate = ->
@subscriptions.add handleSaveEvent()
@subscriptions.add atom.commands.add "atom-workspace", "atom-beautify:beautify-editor", beautify
@subscriptions.add atom.commands.add "atom-workspace", "atom-beautify:help-debug-editor", debug
+ @subscriptions.add atom.commands.add "atom-workspace", "atom-beautify:open-settings", openSettings
@subscriptions.add atom.commands.add ".tree-view .file .name", "atom-beautify:beautify-file", beautifyFile
@subscriptions.add atom.commands.add ".tree-view .directory .name", "atom-beautify:beautify-directory", beautifyDirectory
@subscriptions.add atom.commands.add "atom-workspace", "atom-beautify:migrate-settings", plugin.migrateSettings
diff --git a/src/languages/index.coffee b/src/languages/index.coffee
index 9ea2e36..7cc1e5c 100644
--- a/src/languages/index.coffee
+++ b/src/languages/index.coffee
@@ -77,6 +77,7 @@ module.exports = class Languages
"xml"
"xtemplate"
"yaml"
+ "terraform"
]
###
diff --git a/src/languages/terraform.coffee b/src/languages/terraform.coffee
new file mode 100644
index 0000000..16ad848
--- /dev/null
+++ b/src/languages/terraform.coffee
@@ -0,0 +1,20 @@
+module.exports = {
+
+ name: "Terraform"
+ namespace: "terraform"
+ fallback: ['js']
+
+ ###
+ Supported Grammars
+ ###
+ grammars: [
+ "Terraform"
+ ]
+
+ ###
+ Supported extensions
+ ###
+ extensions: [
+ "tf"
+ ]
+}
diff --git a/src/options.json b/src/options.json
index 28d587d..a68b359 100644
--- a/src/options.json
+++ b/src/options.json
@@ -9132,6 +9132,47 @@
}
}
},
+ "terraform": {
+ "title": "Terraform",
+ "type": "object",
+ "description": "Options for language Terraform",
+ "collapsed": true,
+ "beautifiers": [
+ "terraformfmt"
+ ],
+ "grammars": [
+ "Terraform"
+ ],
+ "extensions": [
+ "tf"
+ ],
+ "properties": {
+ "disabled": {
+ "title": "Disable Beautifying Language",
+ "order": -3,
+ "type": "boolean",
+ "default": false,
+ "description": "Disable Terraform Beautification"
+ },
+ "default_beautifier": {
+ "title": "Default Beautifier",
+ "order": -2,
+ "type": "string",
+ "default": "terraformfmt",
+ "description": "Default Beautifier to be used for Terraform",
+ "enum": [
+ "terraformfmt"
+ ]
+ },
+ "beautify_on_save": {
+ "title": "Beautify On Save",
+ "order": -1,
+ "type": "boolean",
+ "default": false,
+ "description": "Automatically beautify Terraform files on save"
+ }
+ }
+ },
"executables": {
"title": "Executables",
"type": "object",
@@ -9378,6 +9419,22 @@
"description": "Absolute path to the \"beautysh\" executable's binary/script."
}
}
+ },
+ "terraform": {
+ "key": "terraform",
+ "title": "Terraform",
+ "type": "object",
+ "collapsed": true,
+ "description": "Options for Terraform executable.",
+ "properties": {
+ "path": {
+ "key": "path",
+ "title": "Binary/Script Path",
+ "type": "string",
+ "default": "",
+ "description": "Absolute path to the \"terraform\" executable's binary/script."
+ }
+ }
}
}
}