Switch Crystal beautifier to using Executables

This commit is contained in:
Glavin Wiechert 2017-06-02 18:12:09 -03:00
parent 738847c156
commit 349edae0fd
1 changed files with 18 additions and 18 deletions

View File

@ -8,28 +8,28 @@ Beautifier = require('./beautifier')
module.exports = class Crystal extends Beautifier
name: "Crystal"
link: "http://crystal-lang.org"
isPreInstalled: false
executables: [
{
name: "Crystal"
cmd: "crystal"
homepage: "http://crystal-lang.org"
installation: "https://crystal-lang.org/docs/installation/"
version: {
parse: (text) -> text.match(/Crystal (\d+\.\d+\.\d+)/)[1]
}
}
]
options: {
Crystal: false
}
beautify: (text, language, options) ->
# Seems that Crystal dosen't have Windows support yet.
if @isWindows
@Promise.reject(@commandNotFoundError(
'crystal'
{
link: "http://crystal-lang.org"
program: "crystal"
})
@exe("crystal").run([
'tool',
'format',
tempFile = @tempFile("temp", text)
], {ignoreReturnCode: true})
.then(=>
@readFile(tempFile)
)
else
@run("crystal", [
'tool',
'format',
tempFile = @tempFile("temp", text)
], {ignoreReturnCode: true})
.then(=>
@readFile(tempFile)
)