Exemplo n.º 1
0
 def on_complete(self):
   self.animation_loader.on_complete()
   self.interval_animation.stop()
   if os.path.isfile(self.NODE_JS_BINARY_TARFILE_FULL_PATH) : 
     os.remove(self.NODE_JS_BINARY_TARFILE_FULL_PATH)
   node_js = NodeJS()
   npm = NPM()
   self.animation_loader = AnimationLoader(["[=     ]", "[ =    ]", "[   =  ]", "[    = ]", "[     =]", "[    = ]", "[   =  ]", "[ =    ]"], 0.067, "Installing npm dependencies ")
   self.interval_animation = RepeatedTimer(self.animation_loader.sec, self.animation_loader.animate)
   try :
     npm.getCurrentNPMVersion(True) 
   except Exception as e:
     if node_variables.NODE_JS_OS == "win" :
       sublime.error_message("Can't use \"npm\"! To use features that requires \"npm\", you must install it! Download it from https://nodejs.org site")
     print("Error: "+traceback.format_exc())
   try :
     npm.install_all() 
   except Exception as e :
     #print("Error: "+traceback.format_exc())
     pass
   self.animation_loader.on_complete()
   self.interval_animation.stop()
   if node_js.getCurrentNodeJSVersion(True) == self.NODE_JS_VERSION :
     sublime.active_window().status_message("Node.js "+self.NODE_JS_VERSION+" installed correctly! NPM version: "+npm.getCurrentNPMVersion(True))
   else :
     sublime.active_window().status_message("Can't install Node.js! Something went wrong during installation.")
Exemplo n.º 2
0
def checkUpgrade():
    updateNPMDependencies()
    try:
        response = urllib.request.urlopen(
            node_variables.NODE_JS_VERSION_URL_LIST_ONLINE)
        data = json.loads(response.read().decode("utf-8"))
        nodejs_latest_version = data[0]["version"]
        node_js = NodeJS()
        if node_js.getCurrentNodeJSVersion() != nodejs_latest_version:
            sublime.active_window().status_message(
                "There is a new version ( " + nodejs_latest_version +
                " ) of Node.js available! Change your settings to download this version."
            )
        else:
            try:
                npm = NPM()
                npm_version = npm.getCurrentNPMVersion()
                sublime.active_window().status_message(
                    "No need to update Node.js. Current version: " +
                    node_js.getCurrentNodeJSVersion() + ", npm: " +
                    npm_version)
            except Exception as e:
                sublime.active_window().status_message(
                    "No need to update Node.js. Current version: " +
                    node_js.getCurrentNodeJSVersion() + ", npm not installed!")

    except Exception as err:
        traceback.print_exc()
Exemplo n.º 3
0
 def on_complete(self):
     self.animation_loader.on_complete()
     self.interval_animation.stop()
     if os.path.isfile(self.NODE_JS_BINARY_TARFILE_FULL_PATH):
         os.remove(self.NODE_JS_BINARY_TARFILE_FULL_PATH)
     node_js = NodeJS()
     npm = NPM()
     self.animation_loader = AnimationLoader([
         "[=     ]", "[ =    ]", "[   =  ]", "[    = ]", "[     =]",
         "[    = ]", "[   =  ]", "[ =    ]"
     ], 0.067, "Installing npm dependencies ")
     self.interval_animation = RepeatedTimer(self.animation_loader.sec,
                                             self.animation_loader.animate)
     try:
         npm.getCurrentNPMVersion(True)
     except Exception as e:
         print("Error: " + traceback.format_exc())
     try:
         npm.install_all()
     except Exception as e:
         #print("Error: "+traceback.format_exc())
         pass
     self.animation_loader.on_complete()
     self.interval_animation.stop()
     if node_js.getCurrentNodeJSVersion(True) == self.NODE_JS_VERSION:
         sublime.active_window().status_message(
             "Node.js " + self.NODE_JS_VERSION +
             " installed correctly! NPM version: " +
             npm.getCurrentNPMVersion(True))
     else:
         sublime.active_window().status_message(
             "Can't install Node.js! Something went wrong during installation."
         )
Exemplo n.º 4
0
def updateNPMDependencies():
  npm = NPM()
  try :
    npm.getCurrentNPMVersion(True)
  except Exception as e:
    if node_variables.NODE_JS_OS == "win" :
      sublime.active_window().status_message("Can't use \"npm\"! To use features that requires \"npm\", you must install it! Download it from https://nodejs.org site")
    print("Error: "+traceback.format_exc())
    return
    
  animation_loader = AnimationLoader(["[=     ]", "[ =    ]", "[   =  ]", "[    = ]", "[     =]", "[    = ]", "[   =  ]", "[ =    ]"], 0.067, "Updating npm dependencies ")
  interval_animation = RepeatedTimer(animation_loader.sec, animation_loader.animate)
  try :
    npm.update_all(False) 
  except Exception as e:
    pass
  animation_loader.on_complete()
  interval_animation.stop()
Exemplo n.º 5
0
def checkUpgrade():
  updateNPMDependencies()
  try :
    response = urllib.request.urlopen(node_variables.NODE_JS_VERSION_URL_LIST_ONLINE)
    data = json.loads(response.read().decode("utf-8"))
    nodejs_latest_version = data[0]["version"]
    node_js = NodeJS()
    if node_js.getCurrentNodeJSVersion() != nodejs_latest_version :
      sublime.active_window().status_message("There is a new version ( "+nodejs_latest_version+" ) of Node.js available! Change your settings to download this version.")
    else :
      try :
        npm = NPM()
        npm_version = npm.getCurrentNPMVersion() 
        sublime.active_window().status_message("No need to update Node.js. Current version: "+node_js.getCurrentNodeJSVersion()+", npm: "+npm_version)
      except Exception as e:
        sublime.active_window().status_message("No need to update Node.js. Current version: "+node_js.getCurrentNodeJSVersion()+", npm not installed!")

      
  except Exception as err :
    traceback.print_exc()
Exemplo n.º 6
0
def updateNPMDependencies():
  npm = NPM()
  try :
    npm.getCurrentNPMVersion(True)
  except Exception as e:
    print("Error: "+traceback.format_exc())
    return
    
  #animation_loader = AnimationLoader(["[=     ]", "[ =    ]", "[   =  ]", "[    = ]", "[     =]", "[    = ]", "[   =  ]", "[ =    ]"], 0.067, "Updating npm dependencies ")
  #interval_animation = RepeatedTimer(animation_loader.sec, animation_loader.animate)
  try :
    npm.update_all(False) 
  except Exception as e:
    pass
Exemplo n.º 7
0
 def on_complete(self):
     self.animation_loader.on_complete()
     self.interval_animation.stop()
     if os.path.isfile(self.NODE_JS_BINARY_TARFILE_FULL_PATH):
         os.remove(self.NODE_JS_BINARY_TARFILE_FULL_PATH)
     node_js = NodeJS()
     npm = NPM()
     self.animation_loader = AnimationLoader([
         "[=     ]", "[ =    ]", "[   =  ]", "[    = ]", "[     =]",
         "[    = ]", "[   =  ]", "[ =    ]"
     ], 0.067, "Installing npm dependencies ")
     self.interval_animation = RepeatedTimer(self.animation_loader.sec,
                                             self.animation_loader.animate)
     try:
         npm.getCurrentNPMVersion()
     except Exception as e:
         if node_variables.NODE_JS_OS == "win":
             sublime.error_message(
                 "Can't use \"npm\"! To use features that requires \"npm\", you must install it! Download it from https://nodejs.org site"
             )
         print(e)
     try:
         npm.install_all()
     except Exception as e:
         pass
     self.animation_loader.on_complete()
     self.interval_animation.stop()
     if node_js.getCurrentNodeJSVersion() == self.NODE_JS_VERSION:
         sublime.active_window().status_message(
             "Node.js " + self.NODE_JS_VERSION +
             " installed correctly! NPM version: " +
             npm.getCurrentNPMVersion())
     else:
         sublime.active_window().status_message(
             "Can't install Node.js! Something went wrong during installation."
         )
Exemplo n.º 8
0
def updateNPMDependencies():
    npm = NPM()
    try:
        npm.getCurrentNPMVersion(True)
    except Exception as e:
        if node_variables.NODE_JS_OS == "win":
            sublime.active_window().status_message(
                "Can't use \"npm\"! To use features that requires \"npm\", you must install it! Download it from https://nodejs.org site"
            )
        print("Error: " + traceback.format_exc())
        return

    animation_loader = AnimationLoader([
        "[=     ]", "[ =    ]", "[   =  ]", "[    = ]", "[     =]", "[    = ]",
        "[   =  ]", "[ =    ]"
    ], 0.067, "Updating npm dependencies ")
    interval_animation = RepeatedTimer(animation_loader.sec,
                                       animation_loader.animate)
    try:
        npm.update_all(False)
    except Exception as e:
        pass
    animation_loader.on_complete()
    interval_animation.stop()