Some major changes:

- Enhance the error report system
- The SDK now allows to create sub-directory when building and releasing
This commit is contained in:
Xuan Sang LE 2020-05-22 18:31:06 +02:00
parent 0abb49dadc
commit 9f184fc19b
17 changed files with 253 additions and 180 deletions

View File

@ -128,16 +128,15 @@ package:
pkgar:
read -r -p "Enter package name: " PKG;\
echo $$PKG | make package &&\
test -f $(BUILDDIR)/packages/$$PKG/main.js && uglifyjs $(BUILDDIR)/packages/$$PKG/main.js --compress --mangle --output $(BUILDDIR)/packages/$$PKG/main.js;\
test -f $(BUILDDIR)/packages/$$PKG/main.js && terser $(BUILDDIR)/packages/$$PKG/main.js --compress --mangle --output $(BUILDDIR)/packages/$$PKG/main.js;\
test -f $(BUILDDIR)/packages/$$PKG/main.css && uglifycss --output $(BUILDDIR)/packages/$$PKG/main.css $(BUILDDIR)/packages/$$PKG/main.css;\
cd $(BUILDDIR)/packages/$$PKG && zip -r "$$PKG.zip" ./ ; \
cd ../../ && (test -d repo/$$PKG || mkdir repo/$$PKG) && mv packages/$$PKG/"$$PKG.zip" repo/$$PKG && touch repo/$$PKG/$$PKG.md && rm -r packages/$$PKG
uglify:
# uglify antos.js
# npm install uglify-es -g
# npm install uglify-js -g
uglifyjs $(BUILDDIR)/scripts/antos.js --compress --mangle --output $(BUILDDIR)/scripts/antos.js
# sudo npm install terser -g
#
terser $(BUILDDIR)/scripts/antos.js --compress --mangle --output $(BUILDDIR)/scripts/antos.js
# uglify tags
# npm install uglifycss -g
# uglify the css
@ -148,7 +147,7 @@ uglify:
for d in $(packages); do\
echo "Uglifying $$d";\
test -f $(BUILDDIR)/packages/$$d/main.js && uglifyjs $(BUILDDIR)/packages/$$d/main.js --compress --mangle --output $(BUILDDIR)/packages/$$d/main.js;\
test -f $(BUILDDIR)/packages/$$d/main.js && terser $(BUILDDIR)/packages/$$d/main.js --compress --mangle --output $(BUILDDIR)/packages/$$d/main.js;\
test -f $(BUILDDIR)/packages/$$d/main.css && uglifycss --output $(BUILDDIR)/packages/$$d/main.css $(BUILDDIR)/packages/$$d/main.css;\
done

View File

@ -63,7 +63,7 @@ class BaseApplication extends this.OS.GUI.BaseModel
resolve()
.catch (e) =>
@_api.loaded q, @name, "FAIL"
reject e
reject __e e
bindKey: (k, f) ->
arr = k.split "-"

View File

@ -415,7 +415,7 @@ class FileDialog extends BasicDialog
.then (d) ->
return reject d if d.error
resolve d.result
.catch (e) -> reject e
.catch (e) -> reject __e e
setroot = (path) =>
path.asFileHandle().read().then (d) =>
if(d.error)

View File

@ -163,6 +163,13 @@ Date.prototype.toString = () ->
Date.prototype.timestamp = () ->
return @getTime() / 1000 | 0
# chaning error
Ant.__e = (e) ->
reason = new Error(e.toString())
reason.stack += "\nCaused By:\n" + e.stack
return reason
Ant.OS.API =
# the handle object could be a any remote or local handle to
# fetch user data, used by the API to make requests
@ -196,7 +203,7 @@ Ant.OS.API =
.fail (j, s, e) ->
Ant.OS.API.loaded q, p, "FAIL"
if e
reject e
reject __e e
else
reject(Ant.OS.API.throwe s)
@ -242,7 +249,7 @@ Ant.OS.API =
.fail (j, s, e) ->
Ant.OS.API.loaded q, p, "FAIL"
if e
reject e
reject __e e
else
reject(Ant.OS.API.throwe s)
o.remove()
@ -281,7 +288,7 @@ Ant.OS.API =
.fail (j, s, e) ->
Ant.OS.API.loaded q, p, "FAIL"
if e
reject e
reject __e e
else
reject(Ant.OS.API.throwe s)
@ -313,7 +320,7 @@ Ant.OS.API =
console.log "Loaded :", l
Ant.OS.announcer.trigger "sharedlibraryloaded", l
resolve undefined
.catch (e) -> reject e
.catch (e) -> reject __e e
when "js"
Ant.OS.API.script libfp.getlink()
.then (data) ->
@ -322,7 +329,7 @@ Ant.OS.API =
Ant.OS.announcer.trigger "sharedlibraryloaded", l
resolve(data)
.catch (e) ->
reject e
reject __e e
else
reject Ant.OS.API.throwe __("Invalid library: {0}", l)
else
@ -336,10 +343,10 @@ Ant.OS.API =
Ant.OS.announcer.observable.one "sharedlibraryloaded", (l) ->
libs.splice 0, 1
Ant.OS.API.require libs
.catch (e) -> reject e
.catch (e) -> reject __e e
.then (r) -> resolve(r)
Ant.OS.API.requires libs[0]
.catch (e) -> reject e
.catch (e) -> reject __e e
packages:
fetch: () ->
@ -381,7 +388,7 @@ Ant.OS.API =
Ant.OS.announcer.trigger "systemlocalechange", name
resolve d
.catch (e) ->
reject e
reject __e e
throwe: (n) ->
err = undefined
@ -405,7 +412,7 @@ Ant.OS.API =
return resolve $el.val() unless navigator.clipboard
navigator.clipboard.readText().then (d) ->
resolve d
.catch (e) -> reject e
.catch (e) -> reject __e e
# utilities functioncs

View File

@ -64,7 +64,7 @@ Ant.OS or=
.then () ->
resolve f()
.catch (e) ->
reject e
reject __e e
else
resolve f()
appByPid: (pid) ->

View File

@ -60,12 +60,12 @@ Ant.OS.GUI =
.then (d) ->
Ant.OS.GUI.pushServices srvs
.then () -> resolve()
.catch (e) -> reject e
.catch (e) -> reject __e e
.catch (e) ->
Ant.OS.announcer.osfail __("Unable to load: {0}", srv), e
Ant.OS.GUI.pushServices srvs
.then () -> resolve()
.catch (e) -> reject e
.catch (e) -> reject __e e
openDialog: (d, data) ->
new Promise (resolve, reject) ->
@ -91,7 +91,7 @@ Ant.OS.GUI =
if Ant.OS.APP[srv]
Ant.OS.PM.createProcess srv, Ant.OS.APP[srv]
.then (d) -> resolve d
.catch (e) -> reject e
.catch (e) -> reject __e e
else
Ant.OS.GUI.loadApp app
.then (a) ->
@ -99,8 +99,8 @@ Ant.OS.GUI =
return reject Ant.OS.API.throwe __("Service not found: {0}", ph)
Ant.OS.PM.createProcess srv, Ant.OS.APP[srv]
.then (d) -> resolve d
.catch (e) -> reject e
.catch (e) -> reject e
.catch (e) -> reject __e e
.catch (e) -> reject __e e
appsByMime: (mime) ->
metas = ( v for k, v of Ant.OS.setting.system.packages when v and v.app )
@ -173,9 +173,9 @@ Ant.OS.GUI =
Ant.OS.APP[app].style = el[0] if Ant.OS.APP[app]
resolve app
.catch (e) -> resolve app
.catch (e) -> reject e
.catch (e) -> reject __e e
#ok app
.catch (e) -> reject e
.catch (e) -> reject __e e
launch: (app, args) ->
if not Ant.OS.APP[app]
# first load it
@ -358,7 +358,8 @@ Ant.OS.GUI =
name = file.basename
file.parent().asFileHandle().mk(name).then (r) ->
ex = Ant.OS.API.throwe "OS.VFS"
if r.error then Ant.OS.announcer.osfail d.error, ex, d.error else fn()
.catch (e) ->
Ant.OS.announcer.osfail e.toString(), e
desktop[0].ready = (e) ->
e.observable = Ant.OS.announcer

View File

@ -79,7 +79,7 @@ Ant.OS.API.handle =
socket = new WebSocket proto + path
resolve(socket)
catch e
reject e
reject __e e
else
path = "#{Ant.OS.API.REST}/system/apigateway?ws=0"
Ant.OS.API.post path, d

View File

@ -185,7 +185,7 @@ class FileViewTag extends Ant.OS.GUI.BaseTag
return resolve undefined unless v.get("data").path
@get("fetch")(v.get("data").path)
.then (d) => resolve @getTreeData(d.sort @sortByType)
.catch (e) -> reject e
.catch (e) -> reject __e e
@refs.gridview.set "header", @header
@refs.treeview.set "dragndrop", true
@refs.listview.set "dragndrop", true

View File

@ -108,11 +108,11 @@ class BaseFileHandle
return resolve(@info) if @ready
@meta()
.then (d) =>
return reject Ant.OS.API.throwe d.error if d.errors
return reject Ant.OS.API.throwe __("{0}: {1}", d.error, @path) if d.errors
@info = d.result
@ready = true
resolve(d.result)
.catch (e) -> reject e
.catch (e) -> reject __e e
read: (t) ->
new Promise (resolve, reject) =>
@ -122,8 +122,8 @@ class BaseFileHandle
.then (d) ->
# Ant.OS.announcer.ostrigger "VFS", { m: "read", file: me }
resolve d
.catch (e) -> reject e
.catch (e) -> reject e
.catch (e) -> reject __e e
.catch (e) -> reject __e e
write: (t) ->
new Promise (resolve, reject) =>
@ -131,7 +131,7 @@ class BaseFileHandle
.then (r) =>
Ant.OS.announcer.ostrigger "VFS", { m: "write", file: @ }
resolve r
.catch (e) -> reject e
.catch (e) -> reject __e e
mk: (d) ->
new Promise (resolve, reject) =>
@ -141,8 +141,8 @@ class BaseFileHandle
.then (d) =>
Ant.OS.announcer.ostrigger "VFS", { m: "mk", file: @ }
resolve d
.catch (e) -> reject e
.catch (e) -> reject e
.catch (e) -> reject __e e
.catch (e) -> reject __e e
remove: () ->
new Promise (resolve, reject) =>
@ -152,8 +152,8 @@ class BaseFileHandle
.then (d) =>
Ant.OS.announcer.ostrigger "VFS", { m: "remove", file: @ }
resolve d
.catch (e) -> reject e
.catch (e) -> reject e
.catch (e) -> reject __e e
.catch (e) -> reject __e e
upload: () ->
new Promise (resolve, reject) =>
@ -163,8 +163,8 @@ class BaseFileHandle
.then (d) =>
Ant.OS.announcer.ostrigger "VFS", { m: "upload", file: @ }
resolve d
.catch (e) -> reject e
.catch (e) -> reject e
.catch (e) -> reject __e e
.catch (e) -> reject __e e
publish: () ->
new Promise (resolve, reject) =>
@ -174,8 +174,8 @@ class BaseFileHandle
.then (d) =>
Ant.OS.announcer.ostrigger "VFS", { m: "publish", file: @ }
resolve d
.catch (e) -> reject e
.catch (e) -> reject e
.catch (e) -> reject __e e
.catch (e) -> reject __e e
download: () ->
new Promise (resolve, reject) =>
@ -185,8 +185,8 @@ class BaseFileHandle
.then (d) =>
Ant.OS.announcer.ostrigger "VFS", { m: "download", file: @ }
resolve d
.catch (e) -> reject e
.catch (e) -> reject e
.catch (e) -> reject __e e
.catch (e) -> reject __e e
move: (d) ->
new Promise (resolve, reject) =>
@ -196,8 +196,8 @@ class BaseFileHandle
.then (data) =>
Ant.OS.announcer.ostrigger "VFS", { m: "move", file: d.asFileHandle() }
resolve data
.catch (e) -> reject e
.catch (e) -> reject e
.catch (e) -> reject __e e
.catch (e) -> reject __e e
execute: () ->
new Promise (resolve, reject) =>
@ -207,8 +207,8 @@ class BaseFileHandle
.then (d) =>
Ant.OS.announcer.ostrigger "VFS", { m: "execute", file: @ }
resolve d
.catch (e) -> reject e
.catch (e) -> reject e
.catch (e) -> reject __e e
.catch (e) -> reject __e e
getlink: () -> @path
@ -238,10 +238,10 @@ class RemoteFileHandle extends Ant.OS.API.VFS.BaseFileHandle
meta: () ->
new Promise (resolve, reject) =>
Ant.OS.API.handle.fileinfo @path
.then (d) ->
return reject Ant.OS.API.throwe d.error if d.error
.then (d) =>
return reject Ant.OS.API.throwe __("{0}: {1}", d.error, @path) if d.error
resolve d
.catch (e) -> reject e
.catch (e) -> reject __e e
getlink: () ->
@ -262,19 +262,21 @@ class RemoteFileHandle extends Ant.OS.API.VFS.BaseFileHandle
# t is base64 or undefined
new Promise (resolve, reject) =>
if t is "base64"
Ant.OS.API.handle.write(@path, @cache).then (d) ->
return reject Ant.OS.API.throwe d.error if d.error
Ant.OS.API.handle.write(@path, @cache).then (d) =>
return reject Ant.OS.API.throwe __("{0}: {1}", d.error, @path) if d.error
resolve d
.catch (e) -> reject e
.catch (e) -> reject __e e
else
@b64(t)
.then (r) =>
Ant.OS.API.handle.write @path, r
.then (result) ->
return reject Ant.OS.API.throwe result.error if result.error
.then (result) =>
if result.error
return reject Ant.OS.API.throwe __(
"{0}: {1}", result.error, @path)
resolve result
.catch (e) -> reject e
.catch (e) -> reject e
.catch (e) -> reject __e e
.catch (e) -> reject __e e
_mk: (d) ->
new Promise (resolve, reject) =>
@ -284,27 +286,27 @@ class RemoteFileHandle extends Ant.OS.API.VFS.BaseFileHandle
if @info.type is "file"
return reject Ant.OS.API.throwe __("{0} is not a directory", @path)
Ant.OS.API.handle.mkdir "#{@path}/#{d}"
.then (d) ->
return reject Ant.OS.API.throwe d.error if d.error
.then (d) =>
return reject Ant.OS.API.throwe __("{0}: {1}", d.error, @path) if d.error
resolve d
.catch (e) -> reject e
.catch (e) -> reject __e e
_rm: () ->
new Promise (resolve, reject) =>
Ant.OS.API.handle.delete @path
.then (d) ->
return reject Ant.OS.API.throwe d.error if d.error
.then (d) =>
return reject Ant.OS.API.throwe __("{0}: {1}", d.error, @path) if d.error
resolve d
.catch (e) -> reject e
.catch (e) -> reject __e e
_mv: (d) ->
new Promise (resolve, reject) =>
Ant.OS.API.handle.move @path, d
.then (d) ->
return reject Ant.OS.API.throwe d.error if d.error
.then (d) =>
return reject Ant.OS.API.throwe __("{0}: {1}", d.error, @path) if d.error
resolve d
.catch (e) -> reject e
.catch (e) -> reject __e e
_up: () ->
@ -312,10 +314,10 @@ class RemoteFileHandle extends Ant.OS.API.VFS.BaseFileHandle
if @info.type isnt "dir"
return reject Ant.OS.API.throwe __("{0} is not a file", @path)
Ant.OS.API.handle.upload @path
.then (d) ->
return reject Ant.OS.API.throwe d.error if d.error
.then (d) =>
return reject Ant.OS.API.throwe __("{0}: {1}", d.error, @path) if d.error
resolve d
.catch (e) -> reject e
.catch (e) -> reject __e e
_down: () ->
new Promise (resolve, reject) =>
@ -327,15 +329,15 @@ class RemoteFileHandle extends Ant.OS.API.VFS.BaseFileHandle
Ant.OS.API.saveblob @basename, blob
resolve()
.catch (e) ->
reject e
reject __e e
_pub: () ->
new Promise (resolve, reject) =>
Ant.OS.API.handle.sharefile @path, true
.then (d) ->
return reject Ant.OS.API.throwe d.error if d.error
.then (d) =>
return reject Ant.OS.API.throwe __("{0}: {1}", d.error, @path) if d.error
resolve d
.catch (e) -> reject e
.catch (e) -> reject __e e
Ant.OS.API.VFS.register "^(home|desktop|os|Untitled)$", RemoteFileHandle
@ -415,18 +417,18 @@ class SharedFileHandle extends Ant.OS.API.VFS.BaseFileHandle
_wr: (d, t) ->
new Promise (resolve, reject) =>
Ant.OS.API.handle.write @path, d
.then (d) ->
return reject Ant.OS.API.throwe d.error if d.error
.then (d) =>
return reject Ant.OS.API.throwe __("{0}: {1}", d.error, @path) if d.error
resolve d
.catch (e) -> reject e
.catch (e) -> reject __e e
_rm: () ->
new Promise (resolve, reject) =>
Ant.OS.API.handle.sharefile @basename, false
.then (d) ->
return reject Ant.OS.API.throwe d.error if d.error
.then (d) =>
return reject Ant.OS.API.throwe __("{0}: {1}", d.error, @path) if d.error
resolve d
.catch (e) -> reject e
.catch (e) -> reject __e e
_down: () ->
new Promise (resolve, reject) =>
@ -437,7 +439,7 @@ class SharedFileHandle extends Ant.OS.API.VFS.BaseFileHandle
blob = new Blob [data], { type: "octet/stream" }
Ant.OS.API.saveblob @basename, blob
resolve()
.catch (e) -> reject e
.catch (e) -> reject __e e
_pub: () ->
return new Promise (resolve, reject) => resolve { result: @basename }

View File

@ -5,8 +5,8 @@ class CodePad.BaseExtension
preload: () ->
Ant.OS.API.require @dependencies()
import: (lib) ->
Ant.OS.API.requires lib
import: (libs) ->
Ant.OS.API.require libs
basedir: () ->
"#{@app.meta().path}/extensions"
@ -30,14 +30,34 @@ class CodePad.BaseExtension
data = data + "\n" + text
@cat list, data
.then (d) -> resolve d
.catch (e) -> reject e
.catch (e) -> reject e
.catch (e) -> reject __e e
.catch (e) -> reject __e e
copy: (files, to) ->
new Promise (resolve, reject) =>
return resolve() if files.length is 0
file = (files.splice 0, 1)[0].asFileHandle()
tof = "#{to}/#{file.basename}".asFileHandle()
file.onready().then (meta) =>
if meta.type is "dir"
# copy directory
desdir = to.asFileHandle()
desdir.mk(file.basename).then () =>
# read the dir content
file.read().then (data) =>
list = (v.path for v in data.result)
@copy list, "#{desdir.path}/#{file.basename}"
.then () =>
@copy files, to
.then () -> resolve()
.catch (e) -> reject __e e
.catch (e) ->
reject __e e
.catch (e) -> reject __e e
.catch (e) ->
reject __e e
else
# copy file
file.read("binary")
.then (data) =>
tof.setCache(new Blob [data], { type: file.info.mime })
@ -45,41 +65,61 @@ class CodePad.BaseExtension
.then (d) =>
@copy files, to
.then () -> resolve()
.catch (e) -> reject e
.catch (e) -> reject e
.catch (e) -> reject __e e
.catch (e) -> reject __e e
.catch (e) ->
reject __e e
aradd: (list, zip, base) ->
new Promise (resolve, reject) =>
return resolve(zip) if list.length is 0
path = (list.splice 0, 1)[0]
file = path.asFileHandle()
file.onready().then (meta) =>
if meta.type is "dir"
file.read().then (d) =>
l = (v.path for v in d.result)
@aradd l, zip, "#{base}#{file.basename}/"
.then () =>
@aradd list, zip, base
.then () -> resolve(zip)
.catch (e) -> reject __e e
.catch (e) -> reject __e e
.catch (e) -> reject __e e
else
file.read("binary").then (d) =>
zpath = "#{base}#{file.basename}".replace(/^\/+|\/+$/g, '')
zip.file zpath, d, { binary: true }
@aradd list, zip, base
.then () -> resolve(zip)
.catch (e) -> reject __e e
.catch (e) -> reject __e e
.catch (e) -> reject __e e
mkar: (src, dest) ->
@notify __("Preparing for release")
new Promise (resolve, reject) =>
new Promise (r, e) =>
@import("os://scripts/jszip.min.js").then () ->
@import(["os://scripts/jszip.min.js"]).then () ->
src.asFileHandle()
.read().then (d) ->
return e d.error if d.error
r d.result
.catch (ex) -> e ex
.catch (ex) -> e ex
.catch (ex) -> e __e ex
.catch (ex) -> e __e ex
.then (files) =>
new Promise (r, e) =>
zip = new JSZip()
fn = (list) =>
return r zip if list.length is 0
f = (list.splice 0, 1)[0].path.asFileHandle()
return fn list if f.type is "dir"
f.read("binary").then (d) =>
zip.file f.basename, d, { binary: true }
@notify __("add {0} to zip", f.basename)
fn list
.catch (ex) -> e ex
fn files
@aradd (v.path for v in files), zip, "/"
.then (z) -> r(z)
.catch (ex) -> e __e ex
.then (zip) =>
zip.generateAsync({ type: "base64" }).then (data) =>
dest.asFileHandle()
.setCache('data:application/zip;base64,' + data)
.write("base64").then (r) =>
@notify __("Package is generated in release folder")
.catch (e) -> reject e
.catch (e) -> reject e
@notify __("Archive is generated at: {0}", dest)
.catch (e) -> reject __e e
.catch (e) -> reject __e e
mkdirAll: (list) ->
new Promise (resolve, reject) =>
@ -90,8 +130,8 @@ class CodePad.BaseExtension
@app.trigger "filechange", { file: path.parent(), type: "dir" }
@mkdirAll list
.then () -> resolve()
.catch (e) -> reject e
.catch (e) -> reject e
.catch (e) -> reject __e e
.catch (e) -> reject __e e
mkfileAll: (list, path, name) ->
new Promise (resolve, reject) =>
@ -109,9 +149,9 @@ class CodePad.BaseExtension
@app.trigger "filechange", { file: file, type: "file" }
@mkfileAll list, path, name
.then () -> resolve()
.catch (e) -> reject e
.catch (e) -> reject e
.catch (e) -> reject e
.catch (e) -> reject __e e
.catch (e) -> reject __e e
.catch (e) -> reject __e e
metadata: (file) ->
new Promise (resolve, reject) =>

View File

@ -26,7 +26,7 @@ class App.extensions.AntOSDK extends App.BaseExtension
buildnrun: () ->
@metadata("project.json").then (meta) =>
@build(meta).then () =>
@build(meta, true).then () =>
@run(meta).catch (e) => @error __("Unable to run project"), e
.catch (e) =>
@error __("Unable to build project"), e
@ -34,7 +34,7 @@ class App.extensions.AntOSDK extends App.BaseExtension
release: () ->
@metadata("project.json").then (meta) =>
@build(meta).then () =>
@build(meta, false).then () =>
@mkar("#{meta.root}/build/debug", "#{meta.root}/build/release/#{meta.name}.zip")
.then () ->
.catch (e) => @error __("Unable to create package archive"), e
@ -80,25 +80,28 @@ class App.extensions.AntOSDK extends App.BaseExtension
CoffeeScript.nodes data
@verify list
.then () -> resolve()
.catch (e) -> reject e
.catch (e) -> reject __e e
catch ex
reject ex
.catch (e) -> reject e
reject __e ex
.catch (e) -> reject __e e
compile: (meta) ->
new Promise (resolve, reject) =>
@import("#{@basedir()}/coffeescript.js").then () =>
@import([
"#{@basedir()}/coffeescript.js",
"#{@basedir()}/terser.min.js"
]).then () =>
list = ("#{meta.root}/#{v}" for v in meta.coffees)
@verify((f for f in list)).then () =>
@cat(list).then (code) =>
jsrc = CoffeeScript.compile code
@notify __("Compiled successful")
resolve jsrc
.catch (e) -> reject e
.catch (e) -> reject e
.catch (e) -> reject e
.catch (e) -> reject __e e
.catch (e) -> reject __e e
.catch (e) -> reject __e e
build: (meta) ->
build: (meta, debug) ->
dirs = [
"#{meta.root}/build",
"#{meta.root}/build/debug",
@ -110,13 +113,32 @@ class App.extensions.AntOSDK extends App.BaseExtension
@cat ("#{meta.root}/#{v}" for v in meta.javascripts), src
.then (jsrc) ->
new Promise (r, e) ->
code = jsrc
if not debug
options = {
toplevel: true,
compress: {
passes: 3,
#pure_getters: true,
#unsafe: true,
},
mangle: true,
output: {
#beautify: true,
},
}
result = Terser.minify(jsrc, options)
if result.error
@notify __("Unable to minify code: {0}", result.error)
else
code = result.code
"#{meta.root}/build/debug/main.js"
.asFileHandle()
.setCache jsrc
.setCache code
.write("text/plain")
.then (d) ->
r()
.catch (ex) -> e ex
.catch (ex) -> e __e ex
.then () =>
new Promise (r, e) =>
@cat ("#{meta.root}/#{v}" for v in meta.css), ""
@ -128,13 +150,13 @@ class App.extensions.AntOSDK extends App.BaseExtension
.write("text/plain")
.then (d) ->
r()
.catch (ex) -> e ex
.catch (ex) -> e __e ex
.then () =>
@copy ("#{meta.root}/#{v}" for v in meta.copies), "#{meta.root}/build/debug"
.then () -> resolve()
.catch (e) -> reject e
.catch (e) -> reject e
.catch (e) -> reject e
.catch (e) -> reject __e e
.catch (e) -> reject __e e
.catch (e) -> reject __e e
run: (meta) ->
"#{meta.root}/build/debug/package.json"

View File

@ -78,23 +78,23 @@ class App.extensions.ExtensionMaker extends App.BaseExtension
CoffeeScript.nodes data
@verify list
.then () -> resolve()
.catch (e) -> reject e
.catch (e) -> reject __e e
catch ex
reject ex
.catch (e) -> reject e
reject __e ex
.catch (e) -> reject __e e
compile: (meta) ->
new Promise (resolve, reject) =>
@import("#{@basedir()}/coffeescript.js").then () =>
@import(["#{@basedir()}/coffeescript.js"]).then () =>
list = ("#{meta.root}/#{v}" for v in meta.coffees)
@verify((f for f in list)).then () =>
@cat(list).then (code) =>
jsrc = CoffeeScript.compile code
@notify __("Compiled successful")
resolve jsrc
.catch (e) -> reject e
.catch (e) -> reject e
.catch (e) -> reject e
.catch (e) -> reject __e e
.catch (e) -> reject __e e
.catch (e) -> reject __e e
build: (meta) ->
new Promise (resolve, reject) =>
@ -108,7 +108,7 @@ class App.extensions.ExtensionMaker extends App.BaseExtension
.write("text/plain")
.then (d) ->
r()
.catch (ex) -> e ex
.catch (ex) -> e __e ex
.then () ->
new Promise (r, e) ->
"#{meta.root}/build/debug/extension.json"
@ -117,12 +117,12 @@ class App.extensions.ExtensionMaker extends App.BaseExtension
.write("object")
.then (data) ->
r data
.catch (ex) -> e ex
.catch (ex) -> e __e ex
.then () =>
@copy ("#{meta.root}/#{v}" for v in meta.copies), "#{meta.root}/build/debug"
.then () -> resolve()
.catch (e) -> reject e
.catch (e) -> reject e
.catch (e) -> reject __e e
.catch (e) -> reject __e e
run: (meta) ->
new Promise (resolve, reject) =>
@ -142,7 +142,7 @@ class App.extensions.ExtensionMaker extends App.BaseExtension
@app.loadAndRunExtensionAction e.data.item.get "data"
@app.spotlight.run @app
resolve()
.catch (e) -> reject e
.catch (e) -> reject __e e
installExtension: (files, zip) ->
@ -155,8 +155,8 @@ class App.extensions.ExtensionMaker extends App.BaseExtension
meta = JSON.parse(new TextDecoder("utf-8").decode(d))
@installFiles files, zip, meta
.then () -> resolve()
.catch (e) -> reject e
.catch (e) -> reject e
.catch (e) -> reject __e e
.catch (e) -> reject __e e
installFiles: (files, zip, meta) ->
return @installMeta(meta) if files.length is 0
@ -170,9 +170,9 @@ class App.extensions.ExtensionMaker extends App.BaseExtension
return reject r.error if r.error
@installFiles files, zip, meta
.then () -> resolve()
.catch (e) -> reject e
.catch (e) -> reject e
.catch (e) -> reject e
.catch (e) -> reject __e e
.catch (e) -> reject __e e
.catch (e) -> reject __e e
installMeta: (meta) ->
new Promise (resolve, reject) =>
@ -185,12 +185,12 @@ class App.extensions.ExtensionMaker extends App.BaseExtension
file.setCache data
.write("object")
.then () -> resolve()
.catch (e) -> reject e
.catch (e) -> reject e
.catch (e) -> reject __e e
.catch (e) -> reject __e e
installZip: (path) ->
new Promise (resolve, reject) =>
@import("os://scripts/jszip.min.js").then () =>
@import(["os://scripts/jszip.min.js"]).then () =>
path.asFileHandle().read("binary").then (data) =>
JSZip.loadAsync(data).then (zip) =>
pth = @basedir()
@ -206,12 +206,12 @@ class App.extensions.ExtensionMaker extends App.BaseExtension
.then () =>
@installExtension files, zip
.then () -> resolve()
.catch(e) -> reject(e)
.catch (e) -> reject e
.catch(e) -> reject(__e e)
.catch (e) -> reject __e e
else
@installExtension files, zip
.then () -> resolve()
.catch (e) -> reject(e)
.catch (e) -> reject e
.catch (e) -> reject e
.catch (e) -> reject e
.catch (e) -> reject(__e e)
.catch (e) -> reject __e e
.catch (e) -> reject __e e
.catch (e) -> reject __e e

File diff suppressed because one or more lines are too long

View File

@ -27,7 +27,7 @@ class CodePad extends this.OS.GUI.BaseApplication
dir.read().then (d) ->
return reject d.error if d.error
resolve d.result
.catch (e) -> reject e
.catch (e) -> reject __e e
@setup()
setup: () ->

View File

@ -93,7 +93,7 @@ class Files extends this.OS.GUI.BaseApplication
@currdir = dir
($ @navinput).val dir.path
resolve d.result
.catch (e) -> reject e
.catch (e) -> reject __e e
@vfs_event_flag = true
@view.set "ondragndrop", (e) =>

View File

@ -211,8 +211,8 @@ class MarketPlace extends this.OS.GUI.BaseApplication
.then (data) =>
@install data, app
.then (n) -> resolve(n)
.catch (e) -> reject(e)
.catch (e) -> reject e
.catch (e) -> reject(__e e)
.catch (e) -> reject __e e
localInstall: () ->
new Promise (resolve, reject) =>
@ -230,9 +230,9 @@ class MarketPlace extends this.OS.GUI.BaseApplication
if idx >= 0
@applist.set "selected", idx
resolve(n)
.catch (e) -> reject(e)
.catch (e) -> reject e
.catch (e) -> reject e
.catch (e) -> reject(__e e)
.catch (e) -> reject __e e
.catch (e) -> reject __e e
install: (data, meta) ->
new Promise (resolve, reject) =>
@ -271,10 +271,10 @@ class MarketPlace extends this.OS.GUI.BaseApplication
@systemsetting.system.packages[v.app] = v
@appDetail app_meta
resolve(v.name)
.catch (e) -> reject e
.catch (e) -> reject e
.catch (err) -> reject err
.catch (e) -> reject e
.catch (e) -> reject __e e
.catch (e) -> reject __e e
.catch (err) -> reject __e err
.catch (e) -> reject __e e
uninstall: () ->
new Promise (resolve, reject) =>
@ -307,16 +307,16 @@ class MarketPlace extends this.OS.GUI.BaseApplication
@applist.remove el
($ @container).css "visibility", "hidden"
resolve()
.catch (e) -> reject e
.catch (e) -> reject e
.catch (e) -> reject __e e
.catch (e) -> reject __e e
updatePackage: () ->
new Promise (resolve, reject) =>
@uninstall().then () =>
@remoteInstall()
.then () -> resolve()
.catch (e) -> reject e
.catch (e) -> reject e
.catch (e) -> reject __e e
.catch (e) -> reject __e e
mkdirs: (list) ->
new Promise (resolve, reject) =>
@ -329,8 +329,8 @@ class MarketPlace extends this.OS.GUI.BaseApplication
return reject(@_api.throwe __("Cannot create {0}", "#{path}/#{dir}")) if r.error
@mkdirs list
.then () -> resolve()
.catch (e) -> reject e
.catch (e) -> reject e
.catch (e) -> reject __e e
.catch (e) -> reject __e e
installFile: (n, zip, files) ->
new Promise (resolve, reject) =>
@ -345,9 +345,9 @@ class MarketPlace extends this.OS.GUI.BaseApplication
return reject @_api.throwe(__("Cannot install {0}", path)) if r.error
@installFile n, zip, files
.then () -> resolve()
.catch (e) -> reject()
.catch (e) -> reject e
.catch (e) -> reject e
.catch (e) -> reject( __e e)
.catch (e) -> reject __e e
.catch (e) -> reject __e e
MarketPlace.dependencies = [
"os://scripts/jszip.min.js",

View File

@ -1,8 +1,8 @@
afx-resizer.vertical {
background-color: transparent;
border-top: 1px solid #868686;
border-top: 1px solid #cbcbcb;
}
afx-resizer.horizontal {
background-color: transparent;
border-left: 1px solid #868686;
border-left: 1px solid #cbcbcb;
}