mirror of
https://github.com/lxsang/antos-frontend.git
synced 2024-12-27 17:58:22 +01:00
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:
parent
0abb49dadc
commit
9f184fc19b
11
Makefile
11
Makefile
@ -128,16 +128,15 @@ package:
|
|||||||
pkgar:
|
pkgar:
|
||||||
read -r -p "Enter package name: " PKG;\
|
read -r -p "Enter package name: " PKG;\
|
||||||
echo $$PKG | make package &&\
|
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;\
|
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 $(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
|
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:
|
||||||
# uglify antos.js
|
# sudo npm install terser -g
|
||||||
# npm install uglify-es -g
|
#
|
||||||
# npm install uglify-js -g
|
terser $(BUILDDIR)/scripts/antos.js --compress --mangle --output $(BUILDDIR)/scripts/antos.js
|
||||||
uglifyjs $(BUILDDIR)/scripts/antos.js --compress --mangle --output $(BUILDDIR)/scripts/antos.js
|
|
||||||
# uglify tags
|
# uglify tags
|
||||||
# npm install uglifycss -g
|
# npm install uglifycss -g
|
||||||
# uglify the css
|
# uglify the css
|
||||||
@ -148,7 +147,7 @@ uglify:
|
|||||||
|
|
||||||
for d in $(packages); do\
|
for d in $(packages); do\
|
||||||
echo "Uglifying $$d";\
|
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;\
|
test -f $(BUILDDIR)/packages/$$d/main.css && uglifycss --output $(BUILDDIR)/packages/$$d/main.css $(BUILDDIR)/packages/$$d/main.css;\
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ class BaseApplication extends this.OS.GUI.BaseModel
|
|||||||
resolve()
|
resolve()
|
||||||
.catch (e) =>
|
.catch (e) =>
|
||||||
@_api.loaded q, @name, "FAIL"
|
@_api.loaded q, @name, "FAIL"
|
||||||
reject e
|
reject __e e
|
||||||
|
|
||||||
bindKey: (k, f) ->
|
bindKey: (k, f) ->
|
||||||
arr = k.split "-"
|
arr = k.split "-"
|
||||||
|
@ -415,7 +415,7 @@ class FileDialog extends BasicDialog
|
|||||||
.then (d) ->
|
.then (d) ->
|
||||||
return reject d if d.error
|
return reject d if d.error
|
||||||
resolve d.result
|
resolve d.result
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
setroot = (path) =>
|
setroot = (path) =>
|
||||||
path.asFileHandle().read().then (d) =>
|
path.asFileHandle().read().then (d) =>
|
||||||
if(d.error)
|
if(d.error)
|
||||||
|
@ -163,6 +163,13 @@ Date.prototype.toString = () ->
|
|||||||
Date.prototype.timestamp = () ->
|
Date.prototype.timestamp = () ->
|
||||||
return @getTime() / 1000 | 0
|
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 =
|
Ant.OS.API =
|
||||||
# the handle object could be a any remote or local handle to
|
# the handle object could be a any remote or local handle to
|
||||||
# fetch user data, used by the API to make requests
|
# fetch user data, used by the API to make requests
|
||||||
@ -196,7 +203,7 @@ Ant.OS.API =
|
|||||||
.fail (j, s, e) ->
|
.fail (j, s, e) ->
|
||||||
Ant.OS.API.loaded q, p, "FAIL"
|
Ant.OS.API.loaded q, p, "FAIL"
|
||||||
if e
|
if e
|
||||||
reject e
|
reject __e e
|
||||||
else
|
else
|
||||||
reject(Ant.OS.API.throwe s)
|
reject(Ant.OS.API.throwe s)
|
||||||
|
|
||||||
@ -242,7 +249,7 @@ Ant.OS.API =
|
|||||||
.fail (j, s, e) ->
|
.fail (j, s, e) ->
|
||||||
Ant.OS.API.loaded q, p, "FAIL"
|
Ant.OS.API.loaded q, p, "FAIL"
|
||||||
if e
|
if e
|
||||||
reject e
|
reject __e e
|
||||||
else
|
else
|
||||||
reject(Ant.OS.API.throwe s)
|
reject(Ant.OS.API.throwe s)
|
||||||
o.remove()
|
o.remove()
|
||||||
@ -281,7 +288,7 @@ Ant.OS.API =
|
|||||||
.fail (j, s, e) ->
|
.fail (j, s, e) ->
|
||||||
Ant.OS.API.loaded q, p, "FAIL"
|
Ant.OS.API.loaded q, p, "FAIL"
|
||||||
if e
|
if e
|
||||||
reject e
|
reject __e e
|
||||||
else
|
else
|
||||||
reject(Ant.OS.API.throwe s)
|
reject(Ant.OS.API.throwe s)
|
||||||
|
|
||||||
@ -313,7 +320,7 @@ Ant.OS.API =
|
|||||||
console.log "Loaded :", l
|
console.log "Loaded :", l
|
||||||
Ant.OS.announcer.trigger "sharedlibraryloaded", l
|
Ant.OS.announcer.trigger "sharedlibraryloaded", l
|
||||||
resolve undefined
|
resolve undefined
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
when "js"
|
when "js"
|
||||||
Ant.OS.API.script libfp.getlink()
|
Ant.OS.API.script libfp.getlink()
|
||||||
.then (data) ->
|
.then (data) ->
|
||||||
@ -322,7 +329,7 @@ Ant.OS.API =
|
|||||||
Ant.OS.announcer.trigger "sharedlibraryloaded", l
|
Ant.OS.announcer.trigger "sharedlibraryloaded", l
|
||||||
resolve(data)
|
resolve(data)
|
||||||
.catch (e) ->
|
.catch (e) ->
|
||||||
reject e
|
reject __e e
|
||||||
else
|
else
|
||||||
reject Ant.OS.API.throwe __("Invalid library: {0}", l)
|
reject Ant.OS.API.throwe __("Invalid library: {0}", l)
|
||||||
else
|
else
|
||||||
@ -336,10 +343,10 @@ Ant.OS.API =
|
|||||||
Ant.OS.announcer.observable.one "sharedlibraryloaded", (l) ->
|
Ant.OS.announcer.observable.one "sharedlibraryloaded", (l) ->
|
||||||
libs.splice 0, 1
|
libs.splice 0, 1
|
||||||
Ant.OS.API.require libs
|
Ant.OS.API.require libs
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
.then (r) -> resolve(r)
|
.then (r) -> resolve(r)
|
||||||
Ant.OS.API.requires libs[0]
|
Ant.OS.API.requires libs[0]
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
|
|
||||||
packages:
|
packages:
|
||||||
fetch: () ->
|
fetch: () ->
|
||||||
@ -381,7 +388,7 @@ Ant.OS.API =
|
|||||||
Ant.OS.announcer.trigger "systemlocalechange", name
|
Ant.OS.announcer.trigger "systemlocalechange", name
|
||||||
resolve d
|
resolve d
|
||||||
.catch (e) ->
|
.catch (e) ->
|
||||||
reject e
|
reject __e e
|
||||||
|
|
||||||
throwe: (n) ->
|
throwe: (n) ->
|
||||||
err = undefined
|
err = undefined
|
||||||
@ -405,7 +412,7 @@ Ant.OS.API =
|
|||||||
return resolve $el.val() unless navigator.clipboard
|
return resolve $el.val() unless navigator.clipboard
|
||||||
navigator.clipboard.readText().then (d) ->
|
navigator.clipboard.readText().then (d) ->
|
||||||
resolve d
|
resolve d
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
|
|
||||||
|
|
||||||
# utilities functioncs
|
# utilities functioncs
|
||||||
|
@ -64,7 +64,7 @@ Ant.OS or=
|
|||||||
.then () ->
|
.then () ->
|
||||||
resolve f()
|
resolve f()
|
||||||
.catch (e) ->
|
.catch (e) ->
|
||||||
reject e
|
reject __e e
|
||||||
else
|
else
|
||||||
resolve f()
|
resolve f()
|
||||||
appByPid: (pid) ->
|
appByPid: (pid) ->
|
||||||
|
@ -60,12 +60,12 @@ Ant.OS.GUI =
|
|||||||
.then (d) ->
|
.then (d) ->
|
||||||
Ant.OS.GUI.pushServices srvs
|
Ant.OS.GUI.pushServices srvs
|
||||||
.then () -> resolve()
|
.then () -> resolve()
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
.catch (e) ->
|
.catch (e) ->
|
||||||
Ant.OS.announcer.osfail __("Unable to load: {0}", srv), e
|
Ant.OS.announcer.osfail __("Unable to load: {0}", srv), e
|
||||||
Ant.OS.GUI.pushServices srvs
|
Ant.OS.GUI.pushServices srvs
|
||||||
.then () -> resolve()
|
.then () -> resolve()
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
|
|
||||||
openDialog: (d, data) ->
|
openDialog: (d, data) ->
|
||||||
new Promise (resolve, reject) ->
|
new Promise (resolve, reject) ->
|
||||||
@ -91,7 +91,7 @@ Ant.OS.GUI =
|
|||||||
if Ant.OS.APP[srv]
|
if Ant.OS.APP[srv]
|
||||||
Ant.OS.PM.createProcess srv, Ant.OS.APP[srv]
|
Ant.OS.PM.createProcess srv, Ant.OS.APP[srv]
|
||||||
.then (d) -> resolve d
|
.then (d) -> resolve d
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
else
|
else
|
||||||
Ant.OS.GUI.loadApp app
|
Ant.OS.GUI.loadApp app
|
||||||
.then (a) ->
|
.then (a) ->
|
||||||
@ -99,8 +99,8 @@ Ant.OS.GUI =
|
|||||||
return reject Ant.OS.API.throwe __("Service not found: {0}", ph)
|
return reject Ant.OS.API.throwe __("Service not found: {0}", ph)
|
||||||
Ant.OS.PM.createProcess srv, Ant.OS.APP[srv]
|
Ant.OS.PM.createProcess srv, Ant.OS.APP[srv]
|
||||||
.then (d) -> resolve d
|
.then (d) -> resolve d
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
|
|
||||||
appsByMime: (mime) ->
|
appsByMime: (mime) ->
|
||||||
metas = ( v for k, v of Ant.OS.setting.system.packages when v and v.app )
|
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]
|
Ant.OS.APP[app].style = el[0] if Ant.OS.APP[app]
|
||||||
resolve app
|
resolve app
|
||||||
.catch (e) -> resolve app
|
.catch (e) -> resolve app
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
#ok app
|
#ok app
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
launch: (app, args) ->
|
launch: (app, args) ->
|
||||||
if not Ant.OS.APP[app]
|
if not Ant.OS.APP[app]
|
||||||
# first load it
|
# first load it
|
||||||
@ -358,7 +358,8 @@ Ant.OS.GUI =
|
|||||||
name = file.basename
|
name = file.basename
|
||||||
file.parent().asFileHandle().mk(name).then (r) ->
|
file.parent().asFileHandle().mk(name).then (r) ->
|
||||||
ex = Ant.OS.API.throwe "OS.VFS"
|
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) ->
|
desktop[0].ready = (e) ->
|
||||||
e.observable = Ant.OS.announcer
|
e.observable = Ant.OS.announcer
|
||||||
|
@ -79,7 +79,7 @@ Ant.OS.API.handle =
|
|||||||
socket = new WebSocket proto + path
|
socket = new WebSocket proto + path
|
||||||
resolve(socket)
|
resolve(socket)
|
||||||
catch e
|
catch e
|
||||||
reject e
|
reject __e e
|
||||||
else
|
else
|
||||||
path = "#{Ant.OS.API.REST}/system/apigateway?ws=0"
|
path = "#{Ant.OS.API.REST}/system/apigateway?ws=0"
|
||||||
Ant.OS.API.post path, d
|
Ant.OS.API.post path, d
|
||||||
|
@ -185,7 +185,7 @@ class FileViewTag extends Ant.OS.GUI.BaseTag
|
|||||||
return resolve undefined unless v.get("data").path
|
return resolve undefined unless v.get("data").path
|
||||||
@get("fetch")(v.get("data").path)
|
@get("fetch")(v.get("data").path)
|
||||||
.then (d) => resolve @getTreeData(d.sort @sortByType)
|
.then (d) => resolve @getTreeData(d.sort @sortByType)
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
@refs.gridview.set "header", @header
|
@refs.gridview.set "header", @header
|
||||||
@refs.treeview.set "dragndrop", true
|
@refs.treeview.set "dragndrop", true
|
||||||
@refs.listview.set "dragndrop", true
|
@refs.listview.set "dragndrop", true
|
||||||
|
@ -108,11 +108,11 @@ class BaseFileHandle
|
|||||||
return resolve(@info) if @ready
|
return resolve(@info) if @ready
|
||||||
@meta()
|
@meta()
|
||||||
.then (d) =>
|
.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
|
@info = d.result
|
||||||
@ready = true
|
@ready = true
|
||||||
resolve(d.result)
|
resolve(d.result)
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
|
|
||||||
read: (t) ->
|
read: (t) ->
|
||||||
new Promise (resolve, reject) =>
|
new Promise (resolve, reject) =>
|
||||||
@ -122,8 +122,8 @@ class BaseFileHandle
|
|||||||
.then (d) ->
|
.then (d) ->
|
||||||
# Ant.OS.announcer.ostrigger "VFS", { m: "read", file: me }
|
# Ant.OS.announcer.ostrigger "VFS", { m: "read", file: me }
|
||||||
resolve d
|
resolve d
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
|
|
||||||
write: (t) ->
|
write: (t) ->
|
||||||
new Promise (resolve, reject) =>
|
new Promise (resolve, reject) =>
|
||||||
@ -131,7 +131,7 @@ class BaseFileHandle
|
|||||||
.then (r) =>
|
.then (r) =>
|
||||||
Ant.OS.announcer.ostrigger "VFS", { m: "write", file: @ }
|
Ant.OS.announcer.ostrigger "VFS", { m: "write", file: @ }
|
||||||
resolve r
|
resolve r
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
|
|
||||||
mk: (d) ->
|
mk: (d) ->
|
||||||
new Promise (resolve, reject) =>
|
new Promise (resolve, reject) =>
|
||||||
@ -141,8 +141,8 @@ class BaseFileHandle
|
|||||||
.then (d) =>
|
.then (d) =>
|
||||||
Ant.OS.announcer.ostrigger "VFS", { m: "mk", file: @ }
|
Ant.OS.announcer.ostrigger "VFS", { m: "mk", file: @ }
|
||||||
resolve d
|
resolve d
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
|
|
||||||
remove: () ->
|
remove: () ->
|
||||||
new Promise (resolve, reject) =>
|
new Promise (resolve, reject) =>
|
||||||
@ -152,8 +152,8 @@ class BaseFileHandle
|
|||||||
.then (d) =>
|
.then (d) =>
|
||||||
Ant.OS.announcer.ostrigger "VFS", { m: "remove", file: @ }
|
Ant.OS.announcer.ostrigger "VFS", { m: "remove", file: @ }
|
||||||
resolve d
|
resolve d
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
|
|
||||||
upload: () ->
|
upload: () ->
|
||||||
new Promise (resolve, reject) =>
|
new Promise (resolve, reject) =>
|
||||||
@ -163,8 +163,8 @@ class BaseFileHandle
|
|||||||
.then (d) =>
|
.then (d) =>
|
||||||
Ant.OS.announcer.ostrigger "VFS", { m: "upload", file: @ }
|
Ant.OS.announcer.ostrigger "VFS", { m: "upload", file: @ }
|
||||||
resolve d
|
resolve d
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
|
|
||||||
publish: () ->
|
publish: () ->
|
||||||
new Promise (resolve, reject) =>
|
new Promise (resolve, reject) =>
|
||||||
@ -174,8 +174,8 @@ class BaseFileHandle
|
|||||||
.then (d) =>
|
.then (d) =>
|
||||||
Ant.OS.announcer.ostrigger "VFS", { m: "publish", file: @ }
|
Ant.OS.announcer.ostrigger "VFS", { m: "publish", file: @ }
|
||||||
resolve d
|
resolve d
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
|
|
||||||
download: () ->
|
download: () ->
|
||||||
new Promise (resolve, reject) =>
|
new Promise (resolve, reject) =>
|
||||||
@ -185,8 +185,8 @@ class BaseFileHandle
|
|||||||
.then (d) =>
|
.then (d) =>
|
||||||
Ant.OS.announcer.ostrigger "VFS", { m: "download", file: @ }
|
Ant.OS.announcer.ostrigger "VFS", { m: "download", file: @ }
|
||||||
resolve d
|
resolve d
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
|
|
||||||
move: (d) ->
|
move: (d) ->
|
||||||
new Promise (resolve, reject) =>
|
new Promise (resolve, reject) =>
|
||||||
@ -196,8 +196,8 @@ class BaseFileHandle
|
|||||||
.then (data) =>
|
.then (data) =>
|
||||||
Ant.OS.announcer.ostrigger "VFS", { m: "move", file: d.asFileHandle() }
|
Ant.OS.announcer.ostrigger "VFS", { m: "move", file: d.asFileHandle() }
|
||||||
resolve data
|
resolve data
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
|
|
||||||
execute: () ->
|
execute: () ->
|
||||||
new Promise (resolve, reject) =>
|
new Promise (resolve, reject) =>
|
||||||
@ -207,8 +207,8 @@ class BaseFileHandle
|
|||||||
.then (d) =>
|
.then (d) =>
|
||||||
Ant.OS.announcer.ostrigger "VFS", { m: "execute", file: @ }
|
Ant.OS.announcer.ostrigger "VFS", { m: "execute", file: @ }
|
||||||
resolve d
|
resolve d
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
|
|
||||||
getlink: () -> @path
|
getlink: () -> @path
|
||||||
|
|
||||||
@ -238,10 +238,10 @@ class RemoteFileHandle extends Ant.OS.API.VFS.BaseFileHandle
|
|||||||
meta: () ->
|
meta: () ->
|
||||||
new Promise (resolve, reject) =>
|
new Promise (resolve, reject) =>
|
||||||
Ant.OS.API.handle.fileinfo @path
|
Ant.OS.API.handle.fileinfo @path
|
||||||
.then (d) ->
|
.then (d) =>
|
||||||
return reject Ant.OS.API.throwe d.error if d.error
|
return reject Ant.OS.API.throwe __("{0}: {1}", d.error, @path) if d.error
|
||||||
resolve d
|
resolve d
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
|
|
||||||
|
|
||||||
getlink: () ->
|
getlink: () ->
|
||||||
@ -262,19 +262,21 @@ class RemoteFileHandle extends Ant.OS.API.VFS.BaseFileHandle
|
|||||||
# t is base64 or undefined
|
# t is base64 or undefined
|
||||||
new Promise (resolve, reject) =>
|
new Promise (resolve, reject) =>
|
||||||
if t is "base64"
|
if t is "base64"
|
||||||
Ant.OS.API.handle.write(@path, @cache).then (d) ->
|
Ant.OS.API.handle.write(@path, @cache).then (d) =>
|
||||||
return reject Ant.OS.API.throwe d.error if d.error
|
return reject Ant.OS.API.throwe __("{0}: {1}", d.error, @path) if d.error
|
||||||
resolve d
|
resolve d
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
else
|
else
|
||||||
@b64(t)
|
@b64(t)
|
||||||
.then (r) =>
|
.then (r) =>
|
||||||
Ant.OS.API.handle.write @path, r
|
Ant.OS.API.handle.write @path, r
|
||||||
.then (result) ->
|
.then (result) =>
|
||||||
return reject Ant.OS.API.throwe result.error if result.error
|
if result.error
|
||||||
|
return reject Ant.OS.API.throwe __(
|
||||||
|
"{0}: {1}", result.error, @path)
|
||||||
resolve result
|
resolve result
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
|
|
||||||
_mk: (d) ->
|
_mk: (d) ->
|
||||||
new Promise (resolve, reject) =>
|
new Promise (resolve, reject) =>
|
||||||
@ -284,27 +286,27 @@ class RemoteFileHandle extends Ant.OS.API.VFS.BaseFileHandle
|
|||||||
if @info.type is "file"
|
if @info.type is "file"
|
||||||
return reject Ant.OS.API.throwe __("{0} is not a directory", @path)
|
return reject Ant.OS.API.throwe __("{0} is not a directory", @path)
|
||||||
Ant.OS.API.handle.mkdir "#{@path}/#{d}"
|
Ant.OS.API.handle.mkdir "#{@path}/#{d}"
|
||||||
.then (d) ->
|
.then (d) =>
|
||||||
return reject Ant.OS.API.throwe d.error if d.error
|
return reject Ant.OS.API.throwe __("{0}: {1}", d.error, @path) if d.error
|
||||||
resolve d
|
resolve d
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
|
|
||||||
_rm: () ->
|
_rm: () ->
|
||||||
new Promise (resolve, reject) =>
|
new Promise (resolve, reject) =>
|
||||||
Ant.OS.API.handle.delete @path
|
Ant.OS.API.handle.delete @path
|
||||||
.then (d) ->
|
.then (d) =>
|
||||||
return reject Ant.OS.API.throwe d.error if d.error
|
return reject Ant.OS.API.throwe __("{0}: {1}", d.error, @path) if d.error
|
||||||
resolve d
|
resolve d
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
|
|
||||||
|
|
||||||
_mv: (d) ->
|
_mv: (d) ->
|
||||||
new Promise (resolve, reject) =>
|
new Promise (resolve, reject) =>
|
||||||
Ant.OS.API.handle.move @path, d
|
Ant.OS.API.handle.move @path, d
|
||||||
.then (d) ->
|
.then (d) =>
|
||||||
return reject Ant.OS.API.throwe d.error if d.error
|
return reject Ant.OS.API.throwe __("{0}: {1}", d.error, @path) if d.error
|
||||||
resolve d
|
resolve d
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
|
|
||||||
|
|
||||||
_up: () ->
|
_up: () ->
|
||||||
@ -312,10 +314,10 @@ class RemoteFileHandle extends Ant.OS.API.VFS.BaseFileHandle
|
|||||||
if @info.type isnt "dir"
|
if @info.type isnt "dir"
|
||||||
return reject Ant.OS.API.throwe __("{0} is not a file", @path)
|
return reject Ant.OS.API.throwe __("{0} is not a file", @path)
|
||||||
Ant.OS.API.handle.upload @path
|
Ant.OS.API.handle.upload @path
|
||||||
.then (d) ->
|
.then (d) =>
|
||||||
return reject Ant.OS.API.throwe d.error if d.error
|
return reject Ant.OS.API.throwe __("{0}: {1}", d.error, @path) if d.error
|
||||||
resolve d
|
resolve d
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
|
|
||||||
_down: () ->
|
_down: () ->
|
||||||
new Promise (resolve, reject) =>
|
new Promise (resolve, reject) =>
|
||||||
@ -327,15 +329,15 @@ class RemoteFileHandle extends Ant.OS.API.VFS.BaseFileHandle
|
|||||||
Ant.OS.API.saveblob @basename, blob
|
Ant.OS.API.saveblob @basename, blob
|
||||||
resolve()
|
resolve()
|
||||||
.catch (e) ->
|
.catch (e) ->
|
||||||
reject e
|
reject __e e
|
||||||
|
|
||||||
_pub: () ->
|
_pub: () ->
|
||||||
new Promise (resolve, reject) =>
|
new Promise (resolve, reject) =>
|
||||||
Ant.OS.API.handle.sharefile @path, true
|
Ant.OS.API.handle.sharefile @path, true
|
||||||
.then (d) ->
|
.then (d) =>
|
||||||
return reject Ant.OS.API.throwe d.error if d.error
|
return reject Ant.OS.API.throwe __("{0}: {1}", d.error, @path) if d.error
|
||||||
resolve d
|
resolve d
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
|
|
||||||
Ant.OS.API.VFS.register "^(home|desktop|os|Untitled)$", RemoteFileHandle
|
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) ->
|
_wr: (d, t) ->
|
||||||
new Promise (resolve, reject) =>
|
new Promise (resolve, reject) =>
|
||||||
Ant.OS.API.handle.write @path, d
|
Ant.OS.API.handle.write @path, d
|
||||||
.then (d) ->
|
.then (d) =>
|
||||||
return reject Ant.OS.API.throwe d.error if d.error
|
return reject Ant.OS.API.throwe __("{0}: {1}", d.error, @path) if d.error
|
||||||
resolve d
|
resolve d
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
|
|
||||||
_rm: () ->
|
_rm: () ->
|
||||||
new Promise (resolve, reject) =>
|
new Promise (resolve, reject) =>
|
||||||
Ant.OS.API.handle.sharefile @basename, false
|
Ant.OS.API.handle.sharefile @basename, false
|
||||||
.then (d) ->
|
.then (d) =>
|
||||||
return reject Ant.OS.API.throwe d.error if d.error
|
return reject Ant.OS.API.throwe __("{0}: {1}", d.error, @path) if d.error
|
||||||
resolve d
|
resolve d
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
|
|
||||||
_down: () ->
|
_down: () ->
|
||||||
new Promise (resolve, reject) =>
|
new Promise (resolve, reject) =>
|
||||||
@ -437,7 +439,7 @@ class SharedFileHandle extends Ant.OS.API.VFS.BaseFileHandle
|
|||||||
blob = new Blob [data], { type: "octet/stream" }
|
blob = new Blob [data], { type: "octet/stream" }
|
||||||
Ant.OS.API.saveblob @basename, blob
|
Ant.OS.API.saveblob @basename, blob
|
||||||
resolve()
|
resolve()
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
_pub: () ->
|
_pub: () ->
|
||||||
return new Promise (resolve, reject) => resolve { result: @basename }
|
return new Promise (resolve, reject) => resolve { result: @basename }
|
||||||
|
|
||||||
|
@ -5,8 +5,8 @@ class CodePad.BaseExtension
|
|||||||
preload: () ->
|
preload: () ->
|
||||||
Ant.OS.API.require @dependencies()
|
Ant.OS.API.require @dependencies()
|
||||||
|
|
||||||
import: (lib) ->
|
import: (libs) ->
|
||||||
Ant.OS.API.requires lib
|
Ant.OS.API.require libs
|
||||||
|
|
||||||
basedir: () ->
|
basedir: () ->
|
||||||
"#{@app.meta().path}/extensions"
|
"#{@app.meta().path}/extensions"
|
||||||
@ -30,14 +30,34 @@ class CodePad.BaseExtension
|
|||||||
data = data + "\n" + text
|
data = data + "\n" + text
|
||||||
@cat list, data
|
@cat list, data
|
||||||
.then (d) -> resolve d
|
.then (d) -> resolve d
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
|
|
||||||
copy: (files, to) ->
|
copy: (files, to) ->
|
||||||
new Promise (resolve, reject) =>
|
new Promise (resolve, reject) =>
|
||||||
return resolve() if files.length is 0
|
return resolve() if files.length is 0
|
||||||
file = (files.splice 0, 1)[0].asFileHandle()
|
file = (files.splice 0, 1)[0].asFileHandle()
|
||||||
tof = "#{to}/#{file.basename}".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")
|
file.read("binary")
|
||||||
.then (data) =>
|
.then (data) =>
|
||||||
tof.setCache(new Blob [data], { type: file.info.mime })
|
tof.setCache(new Blob [data], { type: file.info.mime })
|
||||||
@ -45,41 +65,61 @@ class CodePad.BaseExtension
|
|||||||
.then (d) =>
|
.then (d) =>
|
||||||
@copy files, to
|
@copy files, to
|
||||||
.then () -> resolve()
|
.then () -> resolve()
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
.catch (e) -> reject 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) ->
|
mkar: (src, dest) ->
|
||||||
@notify __("Preparing for release")
|
@notify __("Preparing for release")
|
||||||
new Promise (resolve, reject) =>
|
new Promise (resolve, reject) =>
|
||||||
new Promise (r, e) =>
|
new Promise (r, e) =>
|
||||||
@import("os://scripts/jszip.min.js").then () ->
|
@import(["os://scripts/jszip.min.js"]).then () ->
|
||||||
src.asFileHandle()
|
src.asFileHandle()
|
||||||
.read().then (d) ->
|
.read().then (d) ->
|
||||||
return e d.error if d.error
|
|
||||||
r d.result
|
r d.result
|
||||||
.catch (ex) -> e ex
|
.catch (ex) -> e __e ex
|
||||||
.catch (ex) -> e ex
|
.catch (ex) -> e __e ex
|
||||||
.then (files) =>
|
.then (files) =>
|
||||||
new Promise (r, e) =>
|
new Promise (r, e) =>
|
||||||
zip = new JSZip()
|
zip = new JSZip()
|
||||||
fn = (list) =>
|
@aradd (v.path for v in files), zip, "/"
|
||||||
return r zip if list.length is 0
|
.then (z) -> r(z)
|
||||||
f = (list.splice 0, 1)[0].path.asFileHandle()
|
.catch (ex) -> e __e ex
|
||||||
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
|
|
||||||
.then (zip) =>
|
.then (zip) =>
|
||||||
zip.generateAsync({ type: "base64" }).then (data) =>
|
zip.generateAsync({ type: "base64" }).then (data) =>
|
||||||
dest.asFileHandle()
|
dest.asFileHandle()
|
||||||
.setCache('data:application/zip;base64,' + data)
|
.setCache('data:application/zip;base64,' + data)
|
||||||
.write("base64").then (r) =>
|
.write("base64").then (r) =>
|
||||||
@notify __("Package is generated in release folder")
|
@notify __("Archive is generated at: {0}", dest)
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
|
|
||||||
mkdirAll: (list) ->
|
mkdirAll: (list) ->
|
||||||
new Promise (resolve, reject) =>
|
new Promise (resolve, reject) =>
|
||||||
@ -90,8 +130,8 @@ class CodePad.BaseExtension
|
|||||||
@app.trigger "filechange", { file: path.parent(), type: "dir" }
|
@app.trigger "filechange", { file: path.parent(), type: "dir" }
|
||||||
@mkdirAll list
|
@mkdirAll list
|
||||||
.then () -> resolve()
|
.then () -> resolve()
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
|
|
||||||
mkfileAll: (list, path, name) ->
|
mkfileAll: (list, path, name) ->
|
||||||
new Promise (resolve, reject) =>
|
new Promise (resolve, reject) =>
|
||||||
@ -109,9 +149,9 @@ class CodePad.BaseExtension
|
|||||||
@app.trigger "filechange", { file: file, type: "file" }
|
@app.trigger "filechange", { file: file, type: "file" }
|
||||||
@mkfileAll list, path, name
|
@mkfileAll list, path, name
|
||||||
.then () -> resolve()
|
.then () -> resolve()
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
|
|
||||||
metadata: (file) ->
|
metadata: (file) ->
|
||||||
new Promise (resolve, reject) =>
|
new Promise (resolve, reject) =>
|
||||||
|
@ -26,7 +26,7 @@ class App.extensions.AntOSDK extends App.BaseExtension
|
|||||||
|
|
||||||
buildnrun: () ->
|
buildnrun: () ->
|
||||||
@metadata("project.json").then (meta) =>
|
@metadata("project.json").then (meta) =>
|
||||||
@build(meta).then () =>
|
@build(meta, true).then () =>
|
||||||
@run(meta).catch (e) => @error __("Unable to run project"), e
|
@run(meta).catch (e) => @error __("Unable to run project"), e
|
||||||
.catch (e) =>
|
.catch (e) =>
|
||||||
@error __("Unable to build project"), e
|
@error __("Unable to build project"), e
|
||||||
@ -34,7 +34,7 @@ class App.extensions.AntOSDK extends App.BaseExtension
|
|||||||
|
|
||||||
release: () ->
|
release: () ->
|
||||||
@metadata("project.json").then (meta) =>
|
@metadata("project.json").then (meta) =>
|
||||||
@build(meta).then () =>
|
@build(meta, false).then () =>
|
||||||
@mkar("#{meta.root}/build/debug", "#{meta.root}/build/release/#{meta.name}.zip")
|
@mkar("#{meta.root}/build/debug", "#{meta.root}/build/release/#{meta.name}.zip")
|
||||||
.then () ->
|
.then () ->
|
||||||
.catch (e) => @error __("Unable to create package archive"), e
|
.catch (e) => @error __("Unable to create package archive"), e
|
||||||
@ -80,25 +80,28 @@ class App.extensions.AntOSDK extends App.BaseExtension
|
|||||||
CoffeeScript.nodes data
|
CoffeeScript.nodes data
|
||||||
@verify list
|
@verify list
|
||||||
.then () -> resolve()
|
.then () -> resolve()
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
catch ex
|
catch ex
|
||||||
reject ex
|
reject __e ex
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
|
|
||||||
compile: (meta) ->
|
compile: (meta) ->
|
||||||
new Promise (resolve, reject) =>
|
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)
|
list = ("#{meta.root}/#{v}" for v in meta.coffees)
|
||||||
@verify((f for f in list)).then () =>
|
@verify((f for f in list)).then () =>
|
||||||
@cat(list).then (code) =>
|
@cat(list).then (code) =>
|
||||||
jsrc = CoffeeScript.compile code
|
jsrc = CoffeeScript.compile code
|
||||||
@notify __("Compiled successful")
|
@notify __("Compiled successful")
|
||||||
resolve jsrc
|
resolve jsrc
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
|
|
||||||
build: (meta) ->
|
build: (meta, debug) ->
|
||||||
dirs = [
|
dirs = [
|
||||||
"#{meta.root}/build",
|
"#{meta.root}/build",
|
||||||
"#{meta.root}/build/debug",
|
"#{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
|
@cat ("#{meta.root}/#{v}" for v in meta.javascripts), src
|
||||||
.then (jsrc) ->
|
.then (jsrc) ->
|
||||||
new Promise (r, e) ->
|
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"
|
"#{meta.root}/build/debug/main.js"
|
||||||
.asFileHandle()
|
.asFileHandle()
|
||||||
.setCache jsrc
|
.setCache code
|
||||||
.write("text/plain")
|
.write("text/plain")
|
||||||
.then (d) ->
|
.then (d) ->
|
||||||
r()
|
r()
|
||||||
.catch (ex) -> e ex
|
.catch (ex) -> e __e ex
|
||||||
.then () =>
|
.then () =>
|
||||||
new Promise (r, e) =>
|
new Promise (r, e) =>
|
||||||
@cat ("#{meta.root}/#{v}" for v in meta.css), ""
|
@cat ("#{meta.root}/#{v}" for v in meta.css), ""
|
||||||
@ -128,13 +150,13 @@ class App.extensions.AntOSDK extends App.BaseExtension
|
|||||||
.write("text/plain")
|
.write("text/plain")
|
||||||
.then (d) ->
|
.then (d) ->
|
||||||
r()
|
r()
|
||||||
.catch (ex) -> e ex
|
.catch (ex) -> e __e ex
|
||||||
.then () =>
|
.then () =>
|
||||||
@copy ("#{meta.root}/#{v}" for v in meta.copies), "#{meta.root}/build/debug"
|
@copy ("#{meta.root}/#{v}" for v in meta.copies), "#{meta.root}/build/debug"
|
||||||
.then () -> resolve()
|
.then () -> resolve()
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
|
|
||||||
run: (meta) ->
|
run: (meta) ->
|
||||||
"#{meta.root}/build/debug/package.json"
|
"#{meta.root}/build/debug/package.json"
|
||||||
|
@ -78,23 +78,23 @@ class App.extensions.ExtensionMaker extends App.BaseExtension
|
|||||||
CoffeeScript.nodes data
|
CoffeeScript.nodes data
|
||||||
@verify list
|
@verify list
|
||||||
.then () -> resolve()
|
.then () -> resolve()
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
catch ex
|
catch ex
|
||||||
reject ex
|
reject __e ex
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
|
|
||||||
compile: (meta) ->
|
compile: (meta) ->
|
||||||
new Promise (resolve, reject) =>
|
new Promise (resolve, reject) =>
|
||||||
@import("#{@basedir()}/coffeescript.js").then () =>
|
@import(["#{@basedir()}/coffeescript.js"]).then () =>
|
||||||
list = ("#{meta.root}/#{v}" for v in meta.coffees)
|
list = ("#{meta.root}/#{v}" for v in meta.coffees)
|
||||||
@verify((f for f in list)).then () =>
|
@verify((f for f in list)).then () =>
|
||||||
@cat(list).then (code) =>
|
@cat(list).then (code) =>
|
||||||
jsrc = CoffeeScript.compile code
|
jsrc = CoffeeScript.compile code
|
||||||
@notify __("Compiled successful")
|
@notify __("Compiled successful")
|
||||||
resolve jsrc
|
resolve jsrc
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
|
|
||||||
build: (meta) ->
|
build: (meta) ->
|
||||||
new Promise (resolve, reject) =>
|
new Promise (resolve, reject) =>
|
||||||
@ -108,7 +108,7 @@ class App.extensions.ExtensionMaker extends App.BaseExtension
|
|||||||
.write("text/plain")
|
.write("text/plain")
|
||||||
.then (d) ->
|
.then (d) ->
|
||||||
r()
|
r()
|
||||||
.catch (ex) -> e ex
|
.catch (ex) -> e __e ex
|
||||||
.then () ->
|
.then () ->
|
||||||
new Promise (r, e) ->
|
new Promise (r, e) ->
|
||||||
"#{meta.root}/build/debug/extension.json"
|
"#{meta.root}/build/debug/extension.json"
|
||||||
@ -117,12 +117,12 @@ class App.extensions.ExtensionMaker extends App.BaseExtension
|
|||||||
.write("object")
|
.write("object")
|
||||||
.then (data) ->
|
.then (data) ->
|
||||||
r data
|
r data
|
||||||
.catch (ex) -> e ex
|
.catch (ex) -> e __e ex
|
||||||
.then () =>
|
.then () =>
|
||||||
@copy ("#{meta.root}/#{v}" for v in meta.copies), "#{meta.root}/build/debug"
|
@copy ("#{meta.root}/#{v}" for v in meta.copies), "#{meta.root}/build/debug"
|
||||||
.then () -> resolve()
|
.then () -> resolve()
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
|
|
||||||
run: (meta) ->
|
run: (meta) ->
|
||||||
new Promise (resolve, reject) =>
|
new Promise (resolve, reject) =>
|
||||||
@ -142,7 +142,7 @@ class App.extensions.ExtensionMaker extends App.BaseExtension
|
|||||||
@app.loadAndRunExtensionAction e.data.item.get "data"
|
@app.loadAndRunExtensionAction e.data.item.get "data"
|
||||||
@app.spotlight.run @app
|
@app.spotlight.run @app
|
||||||
resolve()
|
resolve()
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
|
|
||||||
|
|
||||||
installExtension: (files, zip) ->
|
installExtension: (files, zip) ->
|
||||||
@ -155,8 +155,8 @@ class App.extensions.ExtensionMaker extends App.BaseExtension
|
|||||||
meta = JSON.parse(new TextDecoder("utf-8").decode(d))
|
meta = JSON.parse(new TextDecoder("utf-8").decode(d))
|
||||||
@installFiles files, zip, meta
|
@installFiles files, zip, meta
|
||||||
.then () -> resolve()
|
.then () -> resolve()
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
|
|
||||||
installFiles: (files, zip, meta) ->
|
installFiles: (files, zip, meta) ->
|
||||||
return @installMeta(meta) if files.length is 0
|
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
|
return reject r.error if r.error
|
||||||
@installFiles files, zip, meta
|
@installFiles files, zip, meta
|
||||||
.then () -> resolve()
|
.then () -> resolve()
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
|
|
||||||
installMeta: (meta) ->
|
installMeta: (meta) ->
|
||||||
new Promise (resolve, reject) =>
|
new Promise (resolve, reject) =>
|
||||||
@ -185,12 +185,12 @@ class App.extensions.ExtensionMaker extends App.BaseExtension
|
|||||||
file.setCache data
|
file.setCache data
|
||||||
.write("object")
|
.write("object")
|
||||||
.then () -> resolve()
|
.then () -> resolve()
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
|
|
||||||
installZip: (path) ->
|
installZip: (path) ->
|
||||||
new Promise (resolve, reject) =>
|
new Promise (resolve, reject) =>
|
||||||
@import("os://scripts/jszip.min.js").then () =>
|
@import(["os://scripts/jszip.min.js"]).then () =>
|
||||||
path.asFileHandle().read("binary").then (data) =>
|
path.asFileHandle().read("binary").then (data) =>
|
||||||
JSZip.loadAsync(data).then (zip) =>
|
JSZip.loadAsync(data).then (zip) =>
|
||||||
pth = @basedir()
|
pth = @basedir()
|
||||||
@ -206,12 +206,12 @@ class App.extensions.ExtensionMaker extends App.BaseExtension
|
|||||||
.then () =>
|
.then () =>
|
||||||
@installExtension files, zip
|
@installExtension files, zip
|
||||||
.then () -> resolve()
|
.then () -> resolve()
|
||||||
.catch(e) -> reject(e)
|
.catch(e) -> reject(__e e)
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
else
|
else
|
||||||
@installExtension files, zip
|
@installExtension files, zip
|
||||||
.then () -> resolve()
|
.then () -> resolve()
|
||||||
.catch (e) -> reject(e)
|
.catch (e) -> reject(__e e)
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
2
src/packages/CodePad/coffees/extensions/terser.min.js
vendored
Normal file
2
src/packages/CodePad/coffees/extensions/terser.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -27,7 +27,7 @@ class CodePad extends this.OS.GUI.BaseApplication
|
|||||||
dir.read().then (d) ->
|
dir.read().then (d) ->
|
||||||
return reject d.error if d.error
|
return reject d.error if d.error
|
||||||
resolve d.result
|
resolve d.result
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
@setup()
|
@setup()
|
||||||
|
|
||||||
setup: () ->
|
setup: () ->
|
||||||
|
@ -93,7 +93,7 @@ class Files extends this.OS.GUI.BaseApplication
|
|||||||
@currdir = dir
|
@currdir = dir
|
||||||
($ @navinput).val dir.path
|
($ @navinput).val dir.path
|
||||||
resolve d.result
|
resolve d.result
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
|
|
||||||
@vfs_event_flag = true
|
@vfs_event_flag = true
|
||||||
@view.set "ondragndrop", (e) =>
|
@view.set "ondragndrop", (e) =>
|
||||||
|
@ -211,8 +211,8 @@ class MarketPlace extends this.OS.GUI.BaseApplication
|
|||||||
.then (data) =>
|
.then (data) =>
|
||||||
@install data, app
|
@install data, app
|
||||||
.then (n) -> resolve(n)
|
.then (n) -> resolve(n)
|
||||||
.catch (e) -> reject(e)
|
.catch (e) -> reject(__e e)
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
|
|
||||||
localInstall: () ->
|
localInstall: () ->
|
||||||
new Promise (resolve, reject) =>
|
new Promise (resolve, reject) =>
|
||||||
@ -230,9 +230,9 @@ class MarketPlace extends this.OS.GUI.BaseApplication
|
|||||||
if idx >= 0
|
if idx >= 0
|
||||||
@applist.set "selected", idx
|
@applist.set "selected", idx
|
||||||
resolve(n)
|
resolve(n)
|
||||||
.catch (e) -> reject(e)
|
.catch (e) -> reject(__e e)
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
|
|
||||||
install: (data, meta) ->
|
install: (data, meta) ->
|
||||||
new Promise (resolve, reject) =>
|
new Promise (resolve, reject) =>
|
||||||
@ -271,10 +271,10 @@ class MarketPlace extends this.OS.GUI.BaseApplication
|
|||||||
@systemsetting.system.packages[v.app] = v
|
@systemsetting.system.packages[v.app] = v
|
||||||
@appDetail app_meta
|
@appDetail app_meta
|
||||||
resolve(v.name)
|
resolve(v.name)
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
.catch (err) -> reject err
|
.catch (err) -> reject __e err
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
|
|
||||||
uninstall: () ->
|
uninstall: () ->
|
||||||
new Promise (resolve, reject) =>
|
new Promise (resolve, reject) =>
|
||||||
@ -307,16 +307,16 @@ class MarketPlace extends this.OS.GUI.BaseApplication
|
|||||||
@applist.remove el
|
@applist.remove el
|
||||||
($ @container).css "visibility", "hidden"
|
($ @container).css "visibility", "hidden"
|
||||||
resolve()
|
resolve()
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
|
|
||||||
updatePackage: () ->
|
updatePackage: () ->
|
||||||
new Promise (resolve, reject) =>
|
new Promise (resolve, reject) =>
|
||||||
@uninstall().then () =>
|
@uninstall().then () =>
|
||||||
@remoteInstall()
|
@remoteInstall()
|
||||||
.then () -> resolve()
|
.then () -> resolve()
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
|
|
||||||
mkdirs: (list) ->
|
mkdirs: (list) ->
|
||||||
new Promise (resolve, reject) =>
|
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
|
return reject(@_api.throwe __("Cannot create {0}", "#{path}/#{dir}")) if r.error
|
||||||
@mkdirs list
|
@mkdirs list
|
||||||
.then () -> resolve()
|
.then () -> resolve()
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
|
|
||||||
installFile: (n, zip, files) ->
|
installFile: (n, zip, files) ->
|
||||||
new Promise (resolve, reject) =>
|
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
|
return reject @_api.throwe(__("Cannot install {0}", path)) if r.error
|
||||||
@installFile n, zip, files
|
@installFile n, zip, files
|
||||||
.then () -> resolve()
|
.then () -> resolve()
|
||||||
.catch (e) -> reject()
|
.catch (e) -> reject( __e e)
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
.catch (e) -> reject e
|
.catch (e) -> reject __e e
|
||||||
|
|
||||||
MarketPlace.dependencies = [
|
MarketPlace.dependencies = [
|
||||||
"os://scripts/jszip.min.js",
|
"os://scripts/jszip.min.js",
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
afx-resizer.vertical {
|
afx-resizer.vertical {
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
border-top: 1px solid #868686;
|
border-top: 1px solid #cbcbcb;
|
||||||
}
|
}
|
||||||
afx-resizer.horizontal {
|
afx-resizer.horizontal {
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
border-left: 1px solid #868686;
|
border-left: 1px solid #cbcbcb;
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user