Switch Crystal beautifier to using Executables
This commit is contained in:
parent
738847c156
commit
349edae0fd
|
@ -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)
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue