       rubocop_path: true
   }
 
-  createTempFile: (originalFile) ->
-    new @Promise((resolve, reject) =>
-      tempOptions = {
-        prefix: "_beautify",
-        suffix: path.basename(originalFile),
-        dir: path.dirname(originalFile)}
-      temp.open(tempOptions, (err, info) =>
-        return reject(err) if err?
-        @debug('rubocopTempFile', info.path)
-        resolve(info.path)
-      )
-    ).disposer((filename) =>
-      if fs.existsSync(filename)
-        @debug("unlinking rubocop temp file", filename)
-        fs.unlink(filename)
-    )
-
   beautify: (text, language, options) ->
     editor = atom?.workspace?.getActiveTextEditor()
     if editor?
       fullPath = editor.getPath()
-      projectPath = atom.project.relativizePath(fullPath)[0]
+      [projectPath, relativePath] = atom.project.relativizePath(fullPath)
     else
       throw new Error("No active editor found!")
 

"use strict"
Beautifier = require('./beautifier')
path = require('path')
fs = require('fs')
temp = require('temp').track()

module.exports = class Rubocop extends Beautifier
  name: "Rubocop"

      }
      tempConfig = @tempFile("rubocop-config", yaml.safeDump(config))

    rubocopArguments = [
      "--auto-correct"
      "--force-exclusion"
      "--stdin", relativePath
    ]
    rubocopArguments.push("--config", tempConfig) if tempConfig?
    @debug("rubocop arguments", rubocopArguments)

    @run(rubocopPath, rubocopArguments, {
      ignoreReturnCode: true,
      cwd: projectPath,
      onStdin: (stdin) -> stdin.end text
    }).then((stdout) =>
      @debug("rubocop output", stdout)
      result = stdout.split("====================\n")
      result[result.length - 1]
    )
