 
       callback? err
 
-
-  # runApp:(nodeView, callback)->
-
-  #   folder = nodeView.getData()
-  #   folder.emit "fs.job.started"
-  #   kodingAppsController = KD.getSingleton 'kodingAppsController'
-
-  #   manifest = KodingAppsController.getManifestFromPath folder.path
-
-  #   KD.getSingleton("appManager").open manifest.name, =>
-  #     folder.emit "fs.job.finished"
-  #     callback?()
+  publishApp:(nodeView)->
+
+    folder = nodeView.getData()
+    folder.emit "fs.job.started"
+
+    KodingAppsController.createJApp path: folder.path, (err, app)->
+      folder.emit "fs.job.finished"
+
+      if err or not app
+        warn err
+        return new KDNotificationView
+          title : "Failed to publish"
+
+      new KDNotificationView
+        title: "Published successfully!"
+
+      KD.singletons
+        .router.handleRoute "/Apps/#{app.manifest.authorNick}/#{app.name}"
+
 
   cloneRepo: (nodeView) ->
     folder   = nodeView.getData()

  cmOpenFile:      (nodeView, contextMenuItem)-> @openFile nodeView
  cmPreviewFile:   (nodeView, contextMenuItem)-> @previewFile nodeView
  # cmMakeNewApp:    (nodeView, contextMenuItem)-> @makeNewApp nodeView
  # cmPublish:       (nodeView, contextMenuItem)-> @publishApp nodeView
  cmCompile:       (nodeView, contextMenuItem)-> @compileApp nodeView
  cmOpenFileWithApp: (nodeView, contextMenuItem)-> @openFileWithApp  nodeView, contextMenuItem
  cmCloneRepo:     (nodeView, contextMenuItem)-> @cloneRepo nodeView
  cmDropboxChooser:(nodeView, contextMenuItem)-> @chooseFromDropbox nodeView

      vmName : folder.vmName
      path   : folder.path
    modal.on "RepoClonedSuccessfully", => @notify "Repo cloned successfully.", "success"

  # makeNewApp:(nodeView)->
  #   KD.getSingleton('kodingAppsController').makeNewApp()
