replit-archive / jsrepl

Multilingual sandboxed REPL engine in JavaScript.
http://replit.github.com/jsrepl/
405 stars 100 forks source link

Error on `cake bake` #93

Open WizzieP opened 9 years ago

WizzieP commented 9 years ago
Baking worker.
   minifying tmp/sandbox.js using java -Xmx4g -jar ./tools/closure-compiler/trunk/build/compiler.jar --compilation_level SIMPLE_OPTIMIZATIONS --js 
Baking languages.
Baking the ruby interpreter.
Compiling langs/ruby/jsrepl_ruby.coffee.
/home/andrzej/projects/programuj/jsrepl/Cakefile:63
      if (!path.existsSync(current_path)) {
                ^
TypeError: undefined is not a function
  at ensurePathExists (/home/andrzej/projects/programuj/jsrepl/Cakefile:63:17)
  at buildEngine (/home/andrzej/projects/programuj/jsrepl/Cakefile:76:5)
  at buildNextLang (/home/andrzej/projects/programuj/jsrepl/Cakefile:227:22)
  at /home/andrzej/projects/programuj/jsrepl/Cakefile:232:18
  at /home/andrzej/projects/programuj/jsrepl/Cakefile:160:16
  at ChildProcess.exithandler (child_process.js:742:7)
  at ChildProcess.emit (events.js:110:17)
  at maybeClose (child_process.js:1015:16)
  at Process.ChildProcess._handle.onexit (child_process.js:1087:5)

Node v0.12

Both Win8.1 and Linux

elvongray commented 9 years ago

@WizzieP: This occurs because existsSync has been depreciated. You can use these changes to get the build to work.

 #function to check if the path exist
fileExists = (filePath)->
  try
    fs.lstatSync filePath
    true
  catch err
    if err.code is 'ENOENT'
      false

# Creates any elements of the dirname of the given path that do not exist.
ensurePathExists = (the_path) ->
  parts = the_path.split('/').slice 0, -1
  current_path = '.'
  for part in parts
    current_path += '/' + part
    fs.mkdirSync(current_path, 0o755) if not fileExists current_path