 {CompositeDisposable, BufferedProcess} = require 'atom'
 _    = require 'underscore-plus'
+fs   = require 'fs'
 path = require 'path'
-
-# scope2extname = require './scope2extname'
-
-expandPath = (str) ->
-  if str.substr(0, 2) == '~/'
-    str = (process.env.HOME or process.env.HOMEPATH or process.env.HOMEDIR or process.cwd()) + str.substr(1);
-  path.resolve str
+temp = null
 
 Config = {}
 

        @there text
        selection.clear()

    console.log text

  transformCoffee: (text) ->
    command = 'coffee -s'
    args = ['-s']
    stdout = (output) -> console.log(output)
    exit = (code) -> console.log("ps -ef exited with #{code}")
    process = new BufferedProcess({command, args, stdout, exit})
    "HOGE"

  there: (text) ->
    editor = @getEditor()

      line.replace /([^ ]+)/g, str+"$1"+str
    .join("\n")

  writeTempfile: (text, cb) ->
    temp ?= require('temp').track()
    dir      = temp.mkdirSync "transformer"
    filePath = path.join(dir, "tempfile")

    fs.writeFileSync filePath, text
    cb filePath

  transform: (where) ->
    return unless editor = @getEditor()
    text = editor.getSelectedText() or editor.getText()

    grammar = editor.getGrammar()
    if grammar.name is 'CoffeeScript'
      @transformCoffee text
      return
    else
      text = @surroundWord text, '"'

