Skip to content

Commit 0d55403

Browse files
committed
fixes deployer
1 parent ad98bfc commit 0d55403

File tree

2 files changed

+19
-15
lines changed

2 files changed

+19
-15
lines changed

ide/deploy/watch.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,15 @@
2222
import os.path
2323
import signal
2424

25+
2526
from .deploy import deploy
2627
from .client import serve, logs
2728

2829
def check_and_deploy(change):
29-
cur_dir_len = len(os.getcwd())+1
3030
change_type, path = change
31+
path = os.path.abspath(path)
32+
cur_dir_len = len(os.getcwd())+1
3133
src = path[cur_dir_len:]
32-
print(f"{change_type}: {src}")
3334
# only modified
3435
if change_type != watchfiles.Change.modified: return
3536
# no directories
@@ -45,22 +46,21 @@ def check_and_deploy(change):
4546
deploy(src)
4647

4748
async def redeploy():
48-
print("redeploy")
49+
print("> Redeploy:")
4950
iterator = watchfiles.awatch("packages", recursive=True)
50-
try:
51-
async for changes in iterator:
52-
for change in changes:
51+
async for changes in iterator:
52+
for change in changes:
53+
try:
54+
#print(change)
5355
check_and_deploy(change)
54-
except KeyboardInterrupt:
55-
print("Keyboard Interrupt")
56-
except:
57-
print("Exception")
56+
except Exception as e:
57+
print(e)
5858

5959
def watch():
6060
# start web server
61-
serve()
61+
#serve()
6262
# show logs
63-
logs()
63+
#logs()
6464

6565
loop = asyncio.get_event_loop()
6666
task = loop.create_task(redeploy())

ide/nuvfile.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ tasks:
128128

129129
kill:
130130
silent: true
131-
ignore: true
131+
ignore_errors: true
132132
cmds:
133133
- |
134134
if test -e ~/.nuv/tmp/deploy.pgrp
@@ -182,7 +182,7 @@ tasks:
182182
183183
devel:
184184
interactive: true
185-
silent: false
185+
silent: true
186186
desc: start interactive development mode files
187187
cmds:
188188
- task: prereq
@@ -198,6 +198,9 @@ tasks:
198198
then DRY="--dry-run" ; ECHO='echo'
199199
else DRY="" ; ECHO=""
200200
fi
201+
if cat /proc/version | grep -i microsoft
202+
then export WATCHFILES_FORCE_POLLING=1
203+
fi
201204
python3 -m deploy "$NUV_PWD" -w $DRY
202205
#npm-run-all --parallel deploy serve
203206
true
@@ -229,9 +232,10 @@ tasks:
229232
done
230233
231234
clean:
235+
silent: true
232236
cmds:
233237
- test -e "/.nuvolaris" || die "nuv ide commands must be run in the ghrc.io/nuvolaris/devcontainer with VSCode"
234-
- test -e ~/.wskprops || die "please 'nuv ide login' first"
238+
- task: kill
235239
- |
236240
if test -d "$NUV_PWD/packages"
237241
then

0 commit comments

Comments
 (0)