Merge branch 'master' of git://github.com/jney/atom-beautify into jney-master
Conflicts: lib/langs/ruby-beautify.coffee lib/language-options.coffee
This commit is contained in:
commit
38b760ee6a
|
@ -28,7 +28,8 @@ before_install:
|
||||||
- brew tap homebrew/dupes
|
- brew tap homebrew/dupes
|
||||||
- brew tap homebrew/versions
|
- brew tap homebrew/versions
|
||||||
# Ruby language support
|
# Ruby language support
|
||||||
- gem install ruby-beautify --verbose
|
# - gem install ruby-beautify --verbose
|
||||||
|
- gem install rubocop
|
||||||
# Python language support
|
# Python language support
|
||||||
- brew install python
|
- brew install python
|
||||||
- pip install --upgrade autopep8
|
- pip install --upgrade autopep8
|
||||||
|
|
|
@ -1,25 +1,24 @@
|
||||||
#!/usr/bin/env ruby
|
#!/usr/bin/env ruby
|
||||||
|
|
||||||
conn_hash = { :hosts => [
|
conn_hash = { hosts: [
|
||||||
|
|
||||||
{:login => login, :passcode => passcode, :host => host, :port => port},
|
{ login: login, passcode: passcode, host: host, port: port }
|
||||||
],
|
],
|
||||||
:reliable => false, # Override default
|
reliable: false, # Override default
|
||||||
:connect_headers => conn_hdrs,
|
connect_headers: conn_hdrs
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hash = { hosts: [
|
||||||
hash = { :hosts => [
|
|
||||||
|
{ login: user, passcode: password, host: 'noonehome', port: 2525 },
|
||||||
{:login => user, :passcode => password, :host => 'noonehome', :port => 2525},
|
|
||||||
|
{ login: user, passcode: password, host: host, port: port }
|
||||||
{:login => user, :passcode => password, :host => host, :port => port},
|
|
||||||
|
],
|
||||||
],
|
|
||||||
|
logger: mylog, # This enables callback logging!
|
||||||
:logger => mylog, # This enables callback logging!
|
|
||||||
|
max_reconnect_attempts: 5
|
||||||
:max_reconnect_attempts => 5,
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,10 +40,9 @@ module.exports = class Beautifier
|
||||||
|
|
||||||
###
|
###
|
||||||
Show deprecation warning to user.
|
Show deprecation warning to user.
|
||||||
|
|
||||||
TODO: implement this
|
|
||||||
###
|
###
|
||||||
deprecate: (warning) ->
|
deprecate: (warning) ->
|
||||||
|
atom.notifications?.addWarning(warning)
|
||||||
|
|
||||||
###
|
###
|
||||||
Create temporary file
|
Create temporary file
|
||||||
|
@ -158,14 +157,15 @@ module.exports = class Beautifier
|
||||||
cmd.stderr.on('data', (data) -> stderr += data )
|
cmd.stderr.on('data', (data) -> stderr += data )
|
||||||
# when the spawn child process exits, check if there were any errors and close the writeable stream
|
# when the spawn child process exits, check if there were any errors and close the writeable stream
|
||||||
cmd.on('exit', (code) ->
|
cmd.on('exit', (code) ->
|
||||||
# console.log('spawn done', code, stderr, stdout)
|
console.log('spawn done', code, stderr, stdout)
|
||||||
# If return code is not 0 then error occured
|
# If return code is not 0 then error occured
|
||||||
if code isnt 0
|
# if code isnt 0
|
||||||
reject(stderr)
|
# reject(stderr)
|
||||||
else
|
# else
|
||||||
resolve(stdout)
|
resolve(stdout)
|
||||||
)
|
)
|
||||||
cmd.on('error', (err) ->
|
cmd.on('error', (err) ->
|
||||||
|
console.log('error', err)
|
||||||
reject(err)
|
reject(err)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
|
@ -39,6 +39,7 @@ module.exports = class Beautifiers
|
||||||
'perltidy'
|
'perltidy'
|
||||||
'php-cs-fixer'
|
'php-cs-fixer'
|
||||||
'prettydiff'
|
'prettydiff'
|
||||||
|
'rubocop'
|
||||||
'ruby-beautify'
|
'ruby-beautify'
|
||||||
'sqlformat'
|
'sqlformat'
|
||||||
'tidy-markdown'
|
'tidy-markdown'
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
###
|
||||||
|
Requires https://github.com/bbatsov/rubocop
|
||||||
|
###
|
||||||
|
|
||||||
|
"use strict"
|
||||||
|
Beautifier = require('./beautifier')
|
||||||
|
|
||||||
|
module.exports = class Rubocop extends Beautifier
|
||||||
|
name: "Rubocop"
|
||||||
|
|
||||||
|
options: {
|
||||||
|
Ruby: true
|
||||||
|
}
|
||||||
|
|
||||||
|
beautify: (text, language, options) ->
|
||||||
|
@run("rubocop", [
|
||||||
|
"--auto-correct"
|
||||||
|
tempFile = @tempFile("temp", text)
|
||||||
|
])
|
||||||
|
.then(=>
|
||||||
|
console.log('rubocop', arguments, tempFile)
|
||||||
|
@readFile(tempFile)
|
||||||
|
)
|
|
@ -13,6 +13,7 @@ module.exports = class RubyBeautify extends Beautifier
|
||||||
}
|
}
|
||||||
|
|
||||||
beautify: (text, language, options) ->
|
beautify: (text, language, options) ->
|
||||||
|
@deprecate("Ruby-Beautify has been deprecated in favour of Rubocop beautifier.")
|
||||||
@run("rbeautify", [
|
@run("rbeautify", [
|
||||||
@tempFile("input", text)
|
@tempFile("input", text)
|
||||||
])
|
])
|
||||||
|
|
Loading…
Reference in New Issue