From c1efcd482d7880c61fe8debe53ac71afa2b3d616 Mon Sep 17 00:00:00 2001 From: Sameer Rahmani Date: Tue, 19 Mar 2019 21:06:04 +0000 Subject: [PATCH] Godot extension has been added --- john_titor/debug.js | 9 ++ john_titor/src/john_titor/commands.cljs | 6 +- .../src/john_titor/commands/github.cljs | 6 +- john_titor/src/john_titor/github.cljs | 1 + john_titor/src/john_titor/github/core.cljs | 6 +- john_titor/src/john_titor/utils.cljs | 11 +- john_titor/target/main.js | 104 +++++++++++++++++- lib/extensions/godot.el | 23 ++++ lib/extensions/godot/init.el | 17 +++ lib/extensions/john_titor/init.el | 3 +- lib/john_titor.el | 28 ++++- 11 files changed, 191 insertions(+), 23 deletions(-) create mode 100644 john_titor/debug.js create mode 100644 lib/extensions/godot.el create mode 100644 lib/extensions/godot/init.el diff --git a/john_titor/debug.js b/john_titor/debug.js new file mode 100644 index 0000000..204de32 --- /dev/null +++ b/john_titor/debug.js @@ -0,0 +1,9 @@ +var epc = require("elrpc"); +var Promise = require('bluebird'); + +epc.startServer().then(function(server) { + server.defineMethod("github-notifications", function(args) { + return Promise.resolve(args + "22222"); + }); + server.wait(); +}); diff --git a/john_titor/src/john_titor/commands.cljs b/john_titor/src/john_titor/commands.cljs index e0f7366..cbad86e 100644 --- a/john_titor/src/john_titor/commands.cljs +++ b/john_titor/src/john_titor/commands.cljs @@ -1,8 +1,10 @@ (ns john-titor.commands (:require [john-titor.commands.protocols :as impl] - [john-titor.commands.echo :as echo])) + [john-titor.commands.echo :as echo] + [john-titor.commands.github :as github])) (defn router [server] - (impl/init (echo/->EchoCommand) server)) + (impl/init (echo/->EchoCommand) server) + (impl/init (github/->GithubCommandRouter) server)) diff --git a/john_titor/src/john_titor/commands/github.cljs b/john_titor/src/john_titor/commands/github.cljs index c858d92..b8c054e 100644 --- a/john_titor/src/john_titor/commands/github.cljs +++ b/john_titor/src/john_titor/commands/github.cljs @@ -9,8 +9,8 @@ (init [_ server] (defcommand server "github-notifications" - #(u/on-value (github/notification-command %))))) + (fn [& args] + (u/wait-for (github/notification-command args)))))) (comment - (u/on-value (github/notification-command []) - #(println %))) + (u/wait-for (github/notification-command []))) diff --git a/john_titor/src/john_titor/github.cljs b/john_titor/src/john_titor/github.cljs index 19459f1..dcd29d7 100644 --- a/john_titor/src/john_titor/github.cljs +++ b/john_titor/src/john_titor/github.cljs @@ -1,4 +1,5 @@ (ns john-titor.github + (:require-macros [cljs.core.async.macros :refer [go]]) (:require [john-titor.github.core :as g])) diff --git a/john_titor/src/john_titor/github/core.cljs b/john_titor/src/john_titor/github/core.cljs index 2168a83..f921ebd 100644 --- a/john_titor/src/john_titor/github/core.cljs +++ b/john_titor/src/john_titor/github/core.cljs @@ -31,18 +31,18 @@ ([url] (api-get url {})) ([url opts] - (api-call http/get url options))) + (api-call http/get url opts))) (defn api-post [url opts] - (api-call http/post url options)) + (api-call http/post url opts)) (defn notifications ([] (notifications {})) ([opts] (api-get "/notifications" {}) - (go `(message "hello")))) + (go {:same "asd"}))) (comment (notifications) diff --git a/john_titor/src/john_titor/utils.cljs b/john_titor/src/john_titor/utils.cljs index 31b97a2..60555cc 100644 --- a/john_titor/src/john_titor/utils.cljs +++ b/john_titor/src/john_titor/utils.cljs @@ -1,7 +1,12 @@ (ns john-titor.utils (:require - [clojure.core.async :refer [take! js value))))))) diff --git a/john_titor/target/main.js b/john_titor/target/main.js index 39e8c98..de323ab 100644 --- a/john_titor/target/main.js +++ b/john_titor/target/main.js @@ -2,17 +2,13 @@ (function(){ var SHADOW_IMPORT_PATH = __dirname + '/../.shadow-cljs/builds/app/dev/out/cljs-runtime'; -if (__dirname == '.') { SHADOW_IMPORT_PATH = "/Users/sameer.rahmani/.fg42/john_titor/.shadow-cljs/builds/app/dev/out/cljs-runtime"; } +if (__dirname == '.') { SHADOW_IMPORT_PATH = "/home/lxsameer/.fg42/john_titor/.shadow-cljs/builds/app/dev/out/cljs-runtime"; } global.$CLJS = global; try {require('source-map-support').install();} catch (e) {console.warn('no "source-map-support" (run "npm install source-map-support --save-dev" to get it)');} global.CLOSURE_NO_DEPS = true; -<<<<<<< Updated upstream -global.CLOSURE_DEFINES = {"shadow.cljs.devtools.client.env.repl_pprint":false,"shadow.cljs.devtools.client.env.devtools_url":"","shadow.cljs.devtools.client.env.autoload":false,"shadow.cljs.devtools.client.env.proc_id":"e01e0e97-fd19-4247-a69e-568995e2aeb7","goog.ENABLE_DEBUG_LOADER":false,"shadow.cljs.devtools.client.env.server_port":9630,"shadow.cljs.devtools.client.env.use_document_host":true,"shadow.cljs.devtools.client.env.module_format":"goog","goog.LOCALE":"en","shadow.cljs.devtools.client.env.build_id":"app","shadow.cljs.devtools.client.env.ignore_warnings":false,"goog.DEBUG":true,"cljs.core._STAR_target_STAR_":"nodejs","shadow.cljs.devtools.client.env.ssl":false,"shadow.cljs.devtools.client.env.enabled":true,"shadow.cljs.devtools.client.env.server_host":"localhost","goog.TRANSPILE":"never"}; -======= -global.CLOSURE_DEFINES = {"shadow.cljs.devtools.client.env.repl_pprint":false,"shadow.cljs.devtools.client.env.devtools_url":"","shadow.cljs.devtools.client.env.autoload":false,"shadow.cljs.devtools.client.env.proc_id":"06073e1c-1014-4dc0-a8ca-c2d800ea57c5","goog.ENABLE_DEBUG_LOADER":false,"shadow.cljs.devtools.client.env.server_port":9630,"shadow.cljs.devtools.client.env.use_document_host":true,"shadow.cljs.devtools.client.env.module_format":"goog","goog.LOCALE":"en","shadow.cljs.devtools.client.env.build_id":"app","shadow.cljs.devtools.client.env.ignore_warnings":false,"goog.DEBUG":true,"cljs.core._STAR_target_STAR_":"nodejs","shadow.cljs.devtools.client.env.ssl":false,"shadow.cljs.devtools.client.env.enabled":true,"shadow.cljs.devtools.client.env.server_host":"localhost","goog.TRANSPILE":"never"}; ->>>>>>> Stashed changes +global.CLOSURE_DEFINES = {"shadow.cljs.devtools.client.env.repl_pprint":false,"shadow.cljs.devtools.client.env.devtools_url":"","shadow.cljs.devtools.client.env.autoload":false,"shadow.cljs.devtools.client.env.proc_id":"0893bd36-0953-4220-b00e-ea1a689dfb58","goog.ENABLE_DEBUG_LOADER":false,"shadow.cljs.devtools.client.env.server_port":9630,"shadow.cljs.devtools.client.env.use_document_host":true,"shadow.cljs.devtools.client.env.module_format":"goog","goog.LOCALE":"en","shadow.cljs.devtools.client.env.build_id":"app","shadow.cljs.devtools.client.env.ignore_warnings":false,"goog.DEBUG":true,"cljs.core._STAR_target_STAR_":"nodejs","shadow.cljs.devtools.client.env.ssl":false,"shadow.cljs.devtools.client.env.enabled":true,"shadow.cljs.devtools.client.env.server_host":"localhost","goog.TRANSPILE":"never"}; var goog = global.goog = {}; @@ -3047,6 +3043,102 @@ SHADOW_IMPORT("shadow.js.shim.module$xhr2.js"); SHADOW_IMPORT("shadow.js.shim.module$elrpc.js"); SHADOW_IMPORT("john_titor.commands.protocols.js"); SHADOW_IMPORT("john_titor.commands.echo.js"); +SHADOW_IMPORT("goog.net.eventtype.js"); +SHADOW_IMPORT("goog.net.errorcode.js"); +SHADOW_IMPORT("goog.promise.thenable.js"); +SHADOW_IMPORT("goog.async.freelist.js"); +SHADOW_IMPORT("goog.async.workqueue.js"); +SHADOW_IMPORT("goog.debug.entrypointregistry.js"); +SHADOW_IMPORT("goog.dom.htmlelement.js"); +SHADOW_IMPORT("goog.dom.tagname.js"); +SHADOW_IMPORT("goog.labs.useragent.util.js"); +SHADOW_IMPORT("goog.labs.useragent.browser.js"); +SHADOW_IMPORT("goog.labs.useragent.engine.js"); +SHADOW_IMPORT("goog.async.nexttick.js"); +SHADOW_IMPORT("goog.async.run.js"); +SHADOW_IMPORT("goog.promise.resolver.js"); +SHADOW_IMPORT("goog.promise.promise.js"); +SHADOW_IMPORT("goog.disposable.idisposable.js"); +SHADOW_IMPORT("goog.disposable.disposable.js"); +SHADOW_IMPORT("goog.labs.useragent.platform.js"); +SHADOW_IMPORT("goog.useragent.useragent.js"); +SHADOW_IMPORT("goog.events.browserfeature.js"); +SHADOW_IMPORT("goog.events.eventid.js"); +SHADOW_IMPORT("goog.events.event.js"); +SHADOW_IMPORT("goog.events.eventtype.js"); +SHADOW_IMPORT("goog.events.browserevent.js"); +SHADOW_IMPORT("goog.events.listenable.js"); +SHADOW_IMPORT("goog.events.listener.js"); +SHADOW_IMPORT("goog.events.listenermap.js"); +SHADOW_IMPORT("goog.events.events.js"); +SHADOW_IMPORT("goog.events.eventtarget.js"); +SHADOW_IMPORT("goog.timer.timer.js"); +SHADOW_IMPORT("goog.json.json.js"); +SHADOW_IMPORT("goog.json.hybrid.js"); +SHADOW_IMPORT("goog.debug.errorcontext.js"); +SHADOW_IMPORT("goog.debug.debug.js"); +SHADOW_IMPORT("goog.debug.logrecord.js"); +SHADOW_IMPORT("goog.debug.logbuffer.js"); +SHADOW_IMPORT("goog.debug.logger.js"); +SHADOW_IMPORT("goog.log.log.js"); +SHADOW_IMPORT("goog.net.httpstatus.js"); +SHADOW_IMPORT("goog.net.xhrlike.js"); +SHADOW_IMPORT("goog.net.xmlhttpfactory.js"); +SHADOW_IMPORT("goog.net.wrapperxmlhttpfactory.js"); +SHADOW_IMPORT("goog.net.xmlhttp.js"); +SHADOW_IMPORT("goog.net.xhrio.js"); +SHADOW_IMPORT("goog.dom.tags.js"); +SHADOW_IMPORT("goog.string.typedstring.js"); +SHADOW_IMPORT("goog.string.const.js"); +SHADOW_IMPORT("goog.html.safescript.js"); +SHADOW_IMPORT("goog.fs.url.js"); +SHADOW_IMPORT("goog.i18n.bidi.js"); +SHADOW_IMPORT("goog.html.trustedresourceurl.js"); +SHADOW_IMPORT("goog.html.safeurl.js"); +SHADOW_IMPORT("goog.html.safestyle.js"); +SHADOW_IMPORT("goog.html.safestylesheet.js"); +SHADOW_IMPORT("goog.html.safehtml.js"); +SHADOW_IMPORT("goog.html.legacyconversions.js"); +SHADOW_IMPORT("goog.mochikit.async.deferred.js"); +SHADOW_IMPORT("goog.dom.browserfeature.js"); +SHADOW_IMPORT("goog.dom.asserts.js"); +SHADOW_IMPORT("goog.dom.safe.js"); +SHADOW_IMPORT("goog.html.uncheckedconversions.js"); +SHADOW_IMPORT("goog.math.coordinate.js"); +SHADOW_IMPORT("goog.math.size.js"); +SHADOW_IMPORT("goog.dom.dom.js"); +SHADOW_IMPORT("goog.net.jsloader.js"); +SHADOW_IMPORT("goog.net.jsonp.js"); +SHADOW_IMPORT("com.cognitect.transit.util.js"); +SHADOW_IMPORT("com.cognitect.transit.delimiters.js"); +SHADOW_IMPORT("com.cognitect.transit.caching.js"); +SHADOW_IMPORT("com.cognitect.transit.eq.js"); +SHADOW_IMPORT("com.cognitect.transit.types.js"); +SHADOW_IMPORT("com.cognitect.transit.impl.decoder.js"); +SHADOW_IMPORT("com.cognitect.transit.impl.reader.js"); +SHADOW_IMPORT("com.cognitect.transit.handlers.js"); +SHADOW_IMPORT("com.cognitect.transit.impl.writer.js"); +SHADOW_IMPORT("com.cognitect.transit.js"); +SHADOW_IMPORT("cognitect.transit.js"); +SHADOW_IMPORT("goog.crypt.crypt.js"); +SHADOW_IMPORT("goog.useragent.product.js"); +SHADOW_IMPORT("goog.crypt.base64.js"); +SHADOW_IMPORT("no.en.core.js"); +SHADOW_IMPORT("cljs_http.util.js"); +SHADOW_IMPORT("cljs.core.async.impl.protocols.js"); +SHADOW_IMPORT("cljs.core.async.impl.buffers.js"); +SHADOW_IMPORT("cljs.core.async.impl.dispatch.js"); +SHADOW_IMPORT("cljs.core.async.impl.channels.js"); +SHADOW_IMPORT("cljs.core.async.impl.timers.js"); +SHADOW_IMPORT("cljs.core.async.impl.ioc_helpers.js"); +SHADOW_IMPORT("cljs.core.async.js"); +SHADOW_IMPORT("cljs_http.core.js"); +SHADOW_IMPORT("cljs_http.client.js"); +SHADOW_IMPORT("john_titor.github.core.js"); +SHADOW_IMPORT("john_titor.github.js"); +SHADOW_IMPORT("shadow.js.shim.module$bluebird.js"); +SHADOW_IMPORT("john_titor.utils.js"); +SHADOW_IMPORT("john_titor.commands.github.js"); SHADOW_IMPORT("john_titor.commands.js"); SHADOW_IMPORT("john_titor.core.js"); SHADOW_IMPORT("shadow.module.main.append.js"); diff --git a/lib/extensions/godot.el b/lib/extensions/godot.el new file mode 100644 index 0000000..a3b60a2 --- /dev/null +++ b/lib/extensions/godot.el @@ -0,0 +1,23 @@ +;;; GodotExtension --- Godot Game engine development in FG42. +;;; Commentary: +;;; Code: +(require 'fpkg) +(require 'fg42/extension) +(require 'extensions/godot/init) + +;; Dependencies ---------------------------------- +(depends-on 'gdscript-mode) + + +(defun godot-doc () + "TBD" + "TBD") + +;; Extension ------------------------------------- +(extension godot + :version "2.32" + :on-initialize extensions/godot-initialize + :docs "lib/extensions/godot/readme.org") + +(provide 'extensions/godot) +;;; irc.el ends here diff --git a/lib/extensions/godot/init.el b/lib/extensions/godot/init.el new file mode 100644 index 0000000..df08de6 --- /dev/null +++ b/lib/extensions/godot/init.el @@ -0,0 +1,17 @@ +;;; IRCExtension --- Enables irc client on FG42 +;;; Commentary: +;;; Code: + +(defun setup-gdscript() + (setq-default indent-tabs-mode nil) + (setq tab-width 4) + (setq gdscript-tabs-mode t) + (setq gdscript-tab-width 4)) + +;;;###autoload +(defun extensions/godot-initialize () + (add-hook 'gdscript-mode-hook 'setup-gdscript) + (message "Godot Engine extension has been loaded.")) + +(provide 'extensions/godot/init) +;;; init.el ends here diff --git a/lib/extensions/john_titor/init.el b/lib/extensions/john_titor/init.el index d71c91a..087497f 100644 --- a/lib/extensions/john_titor/init.el +++ b/lib/extensions/john_titor/init.el @@ -1,6 +1,8 @@ ;;; john_title --- Enables RPC for john titor client ;;; Commentary: ;;; Code: +(require 'john_titor) + (defun john-titor-connect () "Connect to john titor via RPC." (interactive) @@ -12,7 +14,6 @@ (interactive) (john_titor/disconnect)) - ;;;###autoload (defun extensions/john-titor-initialize () "Initialize the john_titor extention." diff --git a/lib/john_titor.el b/lib/john_titor.el index 19c6898..87d4e2d 100644 --- a/lib/john_titor.el +++ b/lib/john_titor.el @@ -10,24 +10,42 @@ "Connect to john titor via RPC." (setq epc-connection (if debug-on-error - (epc:start-epc "node" '("../../../john_titor/target/main.js")) - (epc:start-epc "node" '("../../../john_titor/app.js"))))) + (epc:start-epc "node" (list (concat + (getenv "HOME") + "/.fg42/john_titor/target/main.js"))) + (epc:start-epc "node" (list (concat + (getenv "HOME") + "/.fg42/john_titor/app.js")))))) (defun john_titor/call-sync (command args) "Call the given COMMAND with the given ARGS via john titor epc." - (epc:call-sync command args)) + (epc:call-sync epc-connection command args)) +(defun eval-string (str) + "Evaluate the given STR." + (message str) + (eval (car (read-from-string (format "(progn %s)" str))))) (defun john_titor/call (command args f) "Call the COMMAND with the given ARGS in async fashion and call F as callback." (deferred:$ (epc:call-deferred epc-connection command args) - (deferred:nextc it f))) + (deferred:nextc it + (lambda (x) + (funcall f x))) + (deferred:error it + (lambda (err) + (message "ERROR: %s" err))))) (defun john_titor/disconnect () "Disconnect from the john titor client." - (epc:stop-epc epc-connection)) + (epc:stop-epc epc-connection) + (setq epc-connection nil)) +(defun john_titor/restart () + "Restart the epc server." + (john_titor/disconnect) + (john_titor/connect)) (provide 'john_titor) ;;; john_titor.el ends here