Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Terraform support #1882

Merged
merged 18 commits into from
Oct 29, 2017
Merged

Terraform support #1882

merged 18 commits into from
Oct 29, 2017

Conversation

derBroBro
Copy link
Contributor

@derBroBro derBroBro commented Oct 9, 2017

What does this implement/fix? Explain your changes.

This adds support for terraform fmt.

Does this close any currently open issues?

Yes - #645

Any other comments?

Hope all fits.

npm run postinstall

Did not work.
As I am no fulltime dev it would be great if you can guide me what else I have to deliver.

Checklist

Check all those that are applicable and complete.

  • Merged with latest master branch
  • Regenerate documentation with npm run docs
  • Add change details to CHANGELOG.md under "Next" section
  • Added examples for testing to examples/ directory
  • Travis CI passes (Mac support)
  • AppVeyor passes (Windows support)

@derBroBro
Copy link
Contributor Author

Travis failed because:

/usr/local/Homebrew/Library/Homebrew/brew.rb:12:in `<main>': Homebrew must be run under Ruby 2.3! (RuntimeError)

Have I to fix something or is this a pipeline thing?

Copy link
Owner

@Glavin001 Glavin001 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good start! Some small changes. We also need to see new examples for this language and ensure Travis CI and AppVeyor are passing. Thanks!

CHANGELOG.md Outdated
@@ -1,4 +1,5 @@
# Next
- See [](). Add support for Terraform fmt.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix the link:

See [#645](https://github.com/Glavin001/atom-beautify/issues/645). Add support for Terraform fmt.

module.exports = class Terraformfmt extends Beautifier
name: "terraformfmt"
link: "https://www.terraform.io/docs/commands/fmt.html"
isPreInstalled: false
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New beautifiers should use executables feature: #1687

Here's one Pull Request for example: https://github.com/Glavin001/atom-beautify/pull/1726/files#diff-4bf70ccc1cd2e9c4d2706b85b61fb41c

Please let me know if you have any questions. The Executables feature needs more documentation, so currently all we have are existing beautifiers are examples. See https://github.com/Glavin001/atom-beautify#beautifiers

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I change this, the exec is not found anymore. Testing with where (on windows) works.
Any Idea?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Glavin001 now everything should be fixed.

}

beautify: (text, language, options) ->
@run("terraform", [
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use Executables feature.

# Before
@run("terraform", [

# After
@exe("terraform").run([

isPreInstalled: false

options: {
Terraform: true
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be false indicating Language is supported with no/zero support for options.

src/options.json Outdated
"tf"
],
"properties": {
"indent_size": {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to fix Terraform: true above and rerun generate docs.

@Glavin001
Copy link
Owner

npm run postinstall
Did not work.

I don't think there is a postinstall command: https://github.com/Glavin001/atom-beautify/blob/master/package.json#L412-L419

I think you meant npm run docs. What was the error?

@derBroBro
Copy link
Contributor Author

For the question regarding postinstall I used this: https://github.com/Glavin001/atom-beautify/blob/master/docs/add-languages-and-beautifiers.md

@Glavin001
Copy link
Owner

Oh thanks for letting me know! Looks like the docs are out of date. postinstall has been renamed to build-options and is run automatically with npm run docs:

    "build-options": "node script/build-options.js",
    "docs": "npm run build-options && coffee docs/",

Would you be able to change those docs in your Pull Request, too, please? Thanks!

@derBroBro
Copy link
Contributor Author

I am not sure what I have to change to fix the issues. Can you support here ?

@stevenzeck
Copy link
Contributor

stevenzeck commented Oct 11, 2017

Hi @derBroBro you need to have Terraform installed on both the AppVeyor (WIndows) and Travis CI (Linux and MacOS) build files for the tests to pass. .travis.yml for Travis and appveyor.yml for AppVeyor.

For Travis, you can use uncrustify as an example, as it looks like there is a Homebrew formula for Terraform: http://formulae.brew.sh/formula/terraform. Basically if the OS is OSX, brew install terraform otherwise docker pull <docker image here>.

@derBroBro
Copy link
Contributor Author

Thank you, now appveyor looks ok, travis throws /usr/local/Homebrew/Library/Homebrew/brew.rb:12:in `<main>': Homebrew must be run under Ruby 2.3! (RuntimeError)

@stevenzeck
Copy link
Contributor

There's an issue with Homebrew on Travis, uncomment line 95: https://github.com/Glavin001/atom-beautify/blob/master/.travis.yml#L95 and push it again.

@derBroBro
Copy link
Contributor Author

Worked, I think with this the I changed everything.
The changes requested should be also fulfilled (not sure why not detected)

@derBroBro
Copy link
Contributor Author

@Glavin001 anything I can to finish the PR?

@derBroBro
Copy link
Contributor Author

Hello, any updates here?

@stevenzeck
Copy link
Contributor

Looks good to me, I requested another review from Glavin.

@Glavin001
Copy link
Owner

Reviewing now. I apologize, I have been unavailable to review Pull Requests lately. Let's see about getting this merged 😄 .

Copy link
Owner

@Glavin001 Glavin001 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking great! Awesome work.

Last part is removing old isPreinstalled property from the beautifier and running npm run docs to make sure the docs are up-to-date -- I think they are, best to be sure.

Let's try to get this merged and into the next release! 😃

module.exports = class Terraformfmt extends Beautifier
name: "terraformfmt"
link: "https://www.terraform.io/docs/commands/fmt.html"
isPreInstalled: false
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isPreInstalled should be removed. See

isPreInstalled: () ->
@executables.length is 0

@Glavin001
Copy link
Owner

Looks like merge conflicts now, too. Once resolved, should be good to go!

@Glavin001 Glavin001 merged commit 9b9c1e5 into Glavin001:master Oct 29, 2017
@Glavin001
Copy link
Owner

Awesome! Thank you for contributing!

@Glavin001 Glavin001 added this to the v0.35.6 milestone Oct 30, 2017
@Glavin001
Copy link
Owner

Published to v0.30.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants