zrb 0.0.118__py3-none-any.whl → 0.0.119__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
zrb/builtin/__init__.py CHANGED
@@ -12,7 +12,7 @@ from zrb.builtin import devtool
12
12
  from zrb.builtin import generator
13
13
  from zrb.builtin import process
14
14
  from zrb.builtin import say
15
- from zrb.builtin import watch
15
+ from zrb.builtin import watch_changes
16
16
  from zrb.builtin import schedule
17
17
 
18
18
  assert base64
@@ -29,5 +29,5 @@ assert devtool
29
29
  assert generator
30
30
  assert process
31
31
  assert say
32
- assert watch
32
+ assert watch_changes
33
33
  assert schedule
File without changes
@@ -0,0 +1,46 @@
1
+ from zrb.task.task import Task
2
+ from zrb.task.cmd_task import CmdTask
3
+ from zrb.task.notifier import Notifier
4
+ from zrb.task_input.str_input import StrInput
5
+
6
+
7
+ def create_recurring_action(
8
+ title: str,
9
+ default_message: str = '👋'
10
+ ) -> Task:
11
+ # define inputs
12
+ message_input = StrInput(
13
+ name='message',
14
+ default=default_message,
15
+ prompt='Message to be shown',
16
+ )
17
+ command_input = StrInput(
18
+ name='command',
19
+ default='',
20
+ prompt='Command to be executed',
21
+ )
22
+ # define tasks
23
+ run_command = CmdTask(
24
+ name='run-command',
25
+ icon='⚙️',
26
+ color='blue',
27
+ inputs=[command_input],
28
+ should_execute='{{ input.command != "" }}',
29
+ cmd='{{ input.command }}'
30
+ )
31
+ notify = Notifier(
32
+ name='notify',
33
+ icon='📢',
34
+ color='green',
35
+ inputs=[message_input],
36
+ title=title,
37
+ message='{{ input.message }}',
38
+ should_execute='{{ input.message != "" }}',
39
+ )
40
+ # return aggregator task
41
+ return Task(
42
+ name='recurring-action',
43
+ inputs=[message_input, command_input],
44
+ upstreams=[run_command, notify],
45
+ retry=0
46
+ )
zrb/builtin/schedule.py CHANGED
@@ -1,12 +1,14 @@
1
1
  from zrb.task.recurring_task import RecurringTask
2
- from zrb.task.cmd_task import CmdTask
3
2
  from zrb.task.time_watcher import TimeWatcher
4
3
  from zrb.task_input.str_input import StrInput
5
4
  from zrb.runner import runner
5
+ from zrb.builtin.helper.reccuring_action import create_recurring_action
6
6
 
7
7
 
8
8
  schedule = RecurringTask(
9
9
  name='schedule',
10
+ icon='📅',
11
+ color='yellow',
10
12
  description='Show message/run command periodically',
11
13
  inputs=[
12
14
  StrInput(
@@ -17,28 +19,16 @@ schedule = RecurringTask(
17
19
  ),
18
20
  ],
19
21
  triggers=[
20
- TimeWatcher(name='watch-schedule', schedule='{{input.schedule}}')
22
+ TimeWatcher(
23
+ name='watch-schedule',
24
+ color='cyan',
25
+ icon='⏰',
26
+ schedule='{{input.schedule}}'
27
+ )
21
28
  ],
22
- task=CmdTask(
23
- name='run-task',
24
- inputs=[
25
- StrInput(
26
- name='message',
27
- default='👋',
28
- prompt='Message to be shown',
29
- description='Message to be shown on schedule'
30
- ),
31
- StrInput(
32
- name='command',
33
- default='',
34
- prompt='Command to be executed',
35
- description='Command to be executed on schedule'
36
- ),
37
- ],
38
- cmd=[
39
- '{% if input.message != "" %}echo {{ input.message }}{% endif %}',
40
- '{% if input.command != "" %}{{ input.command }}{% endif %}',
41
- ]
29
+ task=create_recurring_action(
30
+ title='Schedule',
31
+ default_message='{{datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")}}', # noqa
42
32
  )
43
33
  )
44
34
  runner.register(schedule)
@@ -0,0 +1,31 @@
1
+ from zrb.task.recurring_task import RecurringTask
2
+ from zrb.task.path_watcher import PathWatcher
3
+ from zrb.task_input.str_input import StrInput
4
+ from zrb.runner import runner
5
+ from zrb.builtin.helper.reccuring_action import create_recurring_action
6
+
7
+
8
+ watch_changes = RecurringTask(
9
+ name='watch-changes',
10
+ icon='🕵️',
11
+ color='yellow',
12
+ description='Watch changes and show message/run command',
13
+ inputs=[
14
+ StrInput(
15
+ name='pattern',
16
+ default='*.*',
17
+ prompt='File pattern',
18
+ description='File pattern to be watched'
19
+ ),
20
+ ],
21
+ triggers=[
22
+ PathWatcher(
23
+ name='watch-path',
24
+ color='cyan',
25
+ icon='👀',
26
+ path='{{input.pattern}}'
27
+ )
28
+ ],
29
+ task=create_recurring_action(title='Watch')
30
+ )
31
+ runner.register(watch_changes)
@@ -0,0 +1,16 @@
1
+ param (
2
+ [string]$Title,
3
+ [string]$Message
4
+ )
5
+
6
+ [Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] > $null
7
+ $template = [Windows.UI.Notifications.ToastNotificationManager]::GetTemplateContent([Windows.UI.Notifications.ToastTemplateType]::ToastText02)
8
+ $toastXml = [xml] $template.GetXml()
9
+ $toastTextElements = $toastXml.GetElementsByTagName("text")
10
+ $toastTextElements[0].AppendChild($toastXml.CreateTextNode($Title)) # Title
11
+ $toastTextElements[1].AppendChild($toastXml.CreateTextNode($Message)) # Message
12
+ $xml = New-Object Windows.Data.Xml.Dom.XmlDocument
13
+ $xml.LoadXml($toastXml.OuterXml)
14
+ $newToast = [Windows.UI.Notifications.ToastNotification]::new($xml)
15
+ $toastNotifier = [Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier("Zrb")
16
+ $toastNotifier.Show($newToast)
@@ -262,3 +262,6 @@ class BaseRemoteCmdTask(BaseTask):
262
262
  retry=0,
263
263
  return_upstream_result=True
264
264
  )
265
+
266
+ def __repr__(self) -> str:
267
+ return f'<BaseRemoteCmdTask name={self._name}>'
@@ -245,7 +245,6 @@ class BaseTask(
245
245
  selected_advertisement = get_advertisement(advertisements)
246
246
  selected_advertisement.show()
247
247
  self._show_done_info()
248
- self._play_bell()
249
248
  await self.on_ready()
250
249
  return True
251
250
 
@@ -169,7 +169,7 @@ class BaseTaskModel(CommonTaskModel, PidModel, TimeTracker):
169
169
  print(result)
170
170
 
171
171
  def _play_bell(self):
172
- print('\a', end='', file=sys.stderr)
172
+ print('\a', end='', file=sys.stderr, flush=True)
173
173
 
174
174
  def _show_done_info(self):
175
175
  elapsed_time = self._get_elapsed_time()
zrb/task/checker.py CHANGED
@@ -87,3 +87,6 @@ class Checker(BaseTask):
87
87
  self.print_out_dark(message)
88
88
  return
89
89
  self.log_debug(message)
90
+
91
+ def __repr__(self) -> str:
92
+ return f'<Checker name={self._name}>'
zrb/task/notifier.py ADDED
@@ -0,0 +1,157 @@
1
+ from zrb.helper.typing import Any, Callable, Iterable, Optional, Union
2
+ from zrb.helper.typecheck import typechecked
3
+ from zrb.task.base_task.base_task import BaseTask
4
+ from zrb.task.any_task import AnyTask
5
+ from zrb.task.any_task_event_handler import (
6
+ OnTriggered, OnWaiting, OnSkipped, OnStarted, OnReady, OnRetry, OnFailed
7
+ )
8
+ from zrb.task_env.env import Env
9
+ from zrb.task_env.env_file import EnvFile
10
+ from zrb.task_group.group import Group
11
+ from zrb.task_input.any_input import AnyInput
12
+ from zrb.helper.accessories.icon import get_random_icon
13
+ from zrb.helper.string.modification import double_quote
14
+
15
+ import os
16
+ import subprocess
17
+
18
+ CURRENT_DIR = os.path.dirname(__file__)
19
+ NOTIFY_PS1_PATH = os.path.realpath(os.path.abspath(os.path.join(
20
+ os.path.dirname(CURRENT_DIR), 'shell-scripts', 'notify.ps1'
21
+ )))
22
+
23
+
24
+ @typechecked
25
+ class Notifier(BaseTask):
26
+ def __init__(
27
+ self,
28
+ name: str = 'port-check',
29
+ group: Optional[Group] = None,
30
+ inputs: Iterable[AnyInput] = [],
31
+ envs: Iterable[Env] = [],
32
+ env_files: Iterable[EnvFile] = [],
33
+ icon: Optional[str] = None,
34
+ color: Optional[str] = None,
35
+ description: str = '',
36
+ title: str = '',
37
+ message: str = '',
38
+ show_toast: bool = True,
39
+ show_stdout: bool = True,
40
+ upstreams: Iterable[AnyTask] = [],
41
+ on_triggered: Optional[OnTriggered] = None,
42
+ on_waiting: Optional[OnWaiting] = None,
43
+ on_skipped: Optional[OnSkipped] = None,
44
+ on_started: Optional[OnStarted] = None,
45
+ on_ready: Optional[OnReady] = None,
46
+ on_retry: Optional[OnRetry] = None,
47
+ on_failed: Optional[OnFailed] = None,
48
+ checking_interval: Union[int, float] = 0,
49
+ retry: int = 2,
50
+ retry_interval: Union[float, int] = 1,
51
+ should_execute: Union[bool, str, Callable[..., bool]] = True
52
+ ):
53
+ BaseTask.__init__(
54
+ self,
55
+ name=name,
56
+ group=group,
57
+ inputs=inputs,
58
+ envs=envs,
59
+ env_files=env_files,
60
+ icon=icon,
61
+ color=color,
62
+ description=description,
63
+ upstreams=upstreams,
64
+ on_triggered=on_triggered,
65
+ on_waiting=on_waiting,
66
+ on_skipped=on_skipped,
67
+ on_started=on_started,
68
+ on_ready=on_ready,
69
+ on_retry=on_retry,
70
+ on_failed=on_failed,
71
+ checkers=[],
72
+ checking_interval=checking_interval,
73
+ retry=retry,
74
+ retry_interval=retry_interval,
75
+ should_execute=should_execute,
76
+ )
77
+ self._title = title if title != '' else name
78
+ self._message = message if message != '' else get_random_icon()
79
+ self._show_toast = show_toast
80
+ self._show_stdout = show_stdout
81
+
82
+ async def run(self, *args: Any, **kwargs: Any) -> str:
83
+ title = self.render_str(self._title)
84
+ message = self.render_str(self._message)
85
+ notify_kwargs = {
86
+ key: value
87
+ for key, value in kwargs.items() if key not in ('title', 'message')
88
+ }
89
+ await self.notify(title, message, **notify_kwargs)
90
+ return message
91
+
92
+ async def notify(self, title: str, message: str, **kwargs: Any) -> None:
93
+ task: BaseTask = kwargs.get('_task')
94
+ if self._show_toast and _is_powershell_available():
95
+ cmd = [
96
+ 'powershell.exe',
97
+ '-ExecutionPolicy', 'Bypass',
98
+ '-File', NOTIFY_PS1_PATH,
99
+ '-Title', title,
100
+ '-Message', message
101
+ ]
102
+ subprocess.run(cmd, stdout=subprocess.DEVNULL)
103
+ if self._show_toast and _is_osascript_available():
104
+ q_message = double_quote(message)
105
+ q_title = double_quote(title)
106
+ cmd = [
107
+ 'osascript',
108
+ '-e',
109
+ f'display notification "{q_message}" with title "{q_title}"'
110
+ ]
111
+ if self._show_toast and _is_notify_send_available():
112
+ cmd = ['notify-send', title, message]
113
+ subprocess.run(cmd, stdout=subprocess.DEVNULL)
114
+ if self._show_stdout:
115
+ task.print_out(message)
116
+ task._play_bell()
117
+
118
+ def __repr__(self) -> str:
119
+ return f'<Notifier name={self._name}>'
120
+
121
+
122
+ def _is_powershell_available():
123
+ try:
124
+ subprocess.run(
125
+ ['powershell.exe', '-Command', 'echo "Checking PowerShell"'],
126
+ check=True, stdout=subprocess.DEVNULL,
127
+ stderr=subprocess.DEVNULL
128
+ )
129
+ return True
130
+ except (subprocess.CalledProcessError, FileNotFoundError, PermissionError):
131
+ return False
132
+
133
+
134
+ def _is_notify_send_available():
135
+ try:
136
+ subprocess.run(
137
+ ['notify-send', '--version'],
138
+ check=True,
139
+ stdout=subprocess.DEVNULL,
140
+ stderr=subprocess.DEVNULL
141
+ )
142
+ return True
143
+ except (subprocess.CalledProcessError, FileNotFoundError, PermissionError):
144
+ return False
145
+
146
+
147
+ def _is_osascript_available():
148
+ try:
149
+ subprocess.run(
150
+ ['osascript', '-e', 'return'],
151
+ check=True,
152
+ stdout=subprocess.DEVNULL,
153
+ stderr=subprocess.DEVNULL
154
+ )
155
+ return True
156
+ except (subprocess.CalledProcessError, FileNotFoundError, PermissionError):
157
+ return False
@@ -46,7 +46,7 @@ class RecurringTask(BaseTask):
46
46
  should_execute: Union[bool, str, Callable[..., bool]] = True,
47
47
  return_upstream_result: bool = False
48
48
  ):
49
- inputs = list(inputs) + task._get_inputs()
49
+ inputs = list(inputs) + task._get_combined_inputs()
50
50
  envs = list(envs) + task._get_envs()
51
51
  env_files = list(env_files) + task._get_env_files()
52
52
  BaseTask.__init__(
@@ -97,6 +97,7 @@ class RecurringTask(BaseTask):
97
97
  key: kwargs[key]
98
98
  for key in kwargs if key not in ['_task']
99
99
  }
100
+ is_first_time = True
100
101
  while True:
101
102
  # Create trigger functions
102
103
  trigger_functions = []
@@ -107,8 +108,12 @@ class RecurringTask(BaseTask):
107
108
  trigger_functions.append(asyncio.create_task(
108
109
  trigger_function(*args, **task_kwargs)
109
110
  ))
111
+ self.print_out_dark('Waiting for next trigger')
112
+ # Mark task as done since trigger has been defined.
113
+ if is_first_time:
114
+ await self._mark_done()
115
+ is_first_time = False
110
116
  # Wait for the first task to complete
111
- self.print_out_dark('Waiting for trigger')
112
117
  _, pending = await asyncio.wait(
113
118
  trigger_functions, return_when=asyncio.FIRST_COMPLETED
114
119
  )
@@ -123,5 +128,15 @@ class RecurringTask(BaseTask):
123
128
  is_async=True, raise_error=False, show_done_info=False
124
129
  )
125
130
  self.print_out_dark('Executing the task')
126
- asyncio.create_task(fn(*args, **task_kwargs))
127
- self._play_bell()
131
+ asyncio.create_task(
132
+ self.__run_and_play_bell(fn, *args, **task_kwargs)
133
+ )
134
+
135
+ async def __run_and_play_bell(
136
+ self, fn: Callable[[Any], Any], *args: Any, **kwargs: Any
137
+ ):
138
+ await fn(*args, **kwargs)
139
+ self._play_bell()
140
+
141
+ def __repr__(self) -> str:
142
+ return f'<RecurringTask name={self._name}>'
zrb/task/time_watcher.py CHANGED
@@ -40,7 +40,7 @@ class TimeWatcher(Checker):
40
40
  on_retry: Optional[OnRetry] = None,
41
41
  on_failed: Optional[OnFailed] = None,
42
42
  schedule: str = '',
43
- checking_interval: Union[int, float] = 0.1,
43
+ checking_interval: Union[int, float] = 1,
44
44
  progress_interval: Union[int, float] = 30,
45
45
  should_execute: Union[bool, str, Callable[..., bool]] = True
46
46
  ):
@@ -108,4 +108,4 @@ class TimeWatcher(Checker):
108
108
  return False
109
109
 
110
110
  def __repr__(self) -> str:
111
- return f'<PathWatcher name={self._name}>'
111
+ return f'<TimeWatcher name={self._name}>'
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: zrb
3
- Version: 0.0.118
4
- Summary: Super framework for your super app
3
+ Version: 0.0.119
4
+ Summary: A Framework to Enhance Your Workflow
5
5
  Author-email: Go Frendi Gunawan <gofrendiasgard@gmail.com>
6
6
  Requires-Python: >=3.10.0
7
7
  Description-Content-Type: text/markdown
@@ -4,7 +4,7 @@ zrb/advertisement.py,sha256=e-1tFPlmEuz8IqaIJ_9-2p9x5cuGsxssJGu5F0wHthI,505
4
4
  zrb/runner.py,sha256=MPCNPMCyiYNZeubSxd1eM2Zr6PCIKF-9pkG385AXElw,118
5
5
  zrb/action/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
6
  zrb/action/runner.py,sha256=o16roJSug_c1D9IH2-trtPu1PeS83A3PfiJB2K_VzOs,4478
7
- zrb/builtin/__init__.py,sha256=-mxeQTx6LkMeR6D-5UZu2yDJiVCf1JA4H18P6JAUrH8,711
7
+ zrb/builtin/__init__.py,sha256=NwkM8HYaWHxr8sGE18gNF2qgf00FlhP2TWq1r1uDQAY,727
8
8
  zrb/builtin/base64.py,sha256=nf_qWD2M0aX06zGef61U2nPdGHX_pfYN9E4gZmpBr5g,1346
9
9
  zrb/builtin/env.py,sha256=hEjQios0i-3DantczxQnZnolzwZAGIQOE0Ygka330EU,1146
10
10
  zrb/builtin/eval.py,sha256=FjAeWuD6KdvSKwsoUo8qbSO9qgc0rQVmRNib-XKOfVc,745
@@ -15,11 +15,11 @@ zrb/builtin/md5.py,sha256=IWN0uroXRiuyF0wD05BzGqAkMA3p6q9EbtWmJOPdOc0,1376
15
15
  zrb/builtin/process.py,sha256=h7uMfEIqbOaNe8aTINZYYbHWw7mmUF8DkeiylPeWzSE,1281
16
16
  zrb/builtin/project.py,sha256=XWz32OYBRox18fMe8xPrblPULytKDAd6O2E6aWw8PPI,1207
17
17
  zrb/builtin/say.py,sha256=_NEAYZULtNg-WZvNXy0U_8T632Bbd2atJ1kjIu8-UHo,3973
18
- zrb/builtin/schedule.py,sha256=NYe5zPUo-y1qCSEjuer0OO0NJN4ByQgZnMgQD8WURfg,1385
18
+ zrb/builtin/schedule.py,sha256=_i5LdDrRzeWayiGZVqftirnqMAf1Twd8WgKDd7ARpGk,1025
19
19
  zrb/builtin/ubuntu.py,sha256=f1s2H8xK3xrb3X99RER9BvB8Wwx5wGxoxEJRhnumMm8,3042
20
20
  zrb/builtin/update.py,sha256=JyLL_4AB__9viYKg5IP-s5kezLh37gyDqD0Fe42zIM8,396
21
21
  zrb/builtin/version.py,sha256=i7NsuSl_MtyufEKrR42p0qHGVMpsPqkxZsewEHnM-QQ,492
22
- zrb/builtin/watch.py,sha256=lVU39OWj6q4U6t-ckrEVi2Yskd7HhZTEc-sYgpjTqcg,1313
22
+ zrb/builtin/watch_changes.py,sha256=kH1TGgyP1EYwxKOoIQ4EdIOTuuVFUd9T2lVitE9ks3Y,850
23
23
  zrb/builtin/devtool/__init__.py,sha256=fVBAYBSJgPoy_r_CGaY__1pQDca7ucrHxxfVUVHlU2o,568
24
24
  zrb/builtin/devtool/devtool_install.py,sha256=WQ5JGVolriqbKZ6TYIVY-Yc08wkkPgDyI0Ixa8ehyqU,13270
25
25
  zrb/builtin/devtool/aws/install.sh,sha256=C7jJP4LaB5lBehyNEUFaBtk1MmTvv6jdaP_lnXq0kao,1638
@@ -1089,6 +1089,8 @@ zrb/builtin/generator/simple_python_app/template/src/kebab-zrb-app-name/src/Dock
1089
1089
  zrb/builtin/generator/simple_python_app/template/src/kebab-zrb-app-name/src/main.py,sha256=UpJoBSo4zNKFSa8-0pdJwCymjJDxVZicdoENshogtjE,447
1090
1090
  zrb/builtin/generator/simple_python_app/template/src/kebab-zrb-app-name/src/requirements.txt,sha256=HX56Al9bOoM8Mq1Yc44UE2cfT3XrTZGmHI6T3q7xn50,15
1091
1091
  zrb/builtin/generator/simple_python_app/template/src/kebab-zrb-app-name/src/template.env,sha256=vtoZ0LV8OKAU1EUWBiB8PIKbf1FaNfm-49j7aXvKsgs,87
1092
+ zrb/builtin/helper/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
1093
+ zrb/builtin/helper/reccuring_action.py,sha256=Tojb_lk5qVjDyxfZjBvOw4vc_pVX5HhqFz9XJUH0dGA,1190
1092
1094
  zrb/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
1093
1095
  zrb/config/config.py,sha256=emFGBfcbfg7N7N-Q6XBQlEaCiJpdRfhEgl3zmQ8gbuQ,1168
1094
1096
  zrb/helper/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -1140,31 +1142,33 @@ zrb/shell-scripts/_common-util.sh,sha256=6WPPOp_NBUgIMd1K2qlVZ6iYzZ-Xl3lUTzi4Rqr
1140
1142
  zrb/shell-scripts/ensure-docker-is-installed.sh,sha256=CpfGjfoXFXoTWXsONIGZCMnmtFrk6ZamvO_8Fqp_WJ0,2893
1141
1143
  zrb/shell-scripts/ensure-rsync-is-installed.sh,sha256=vHJWNEidemIrM2tQ17r5qwSUjz9hVKcjYbUEMo3pPJI,987
1142
1144
  zrb/shell-scripts/ensure-ssh-is-installed.sh,sha256=TM0PLXT2vNfgv2ffcW_l-IqtMqHI1Z9nGdJvlToUlyM,2092
1145
+ zrb/shell-scripts/notify.ps1,sha256=6_xPoIwuxARpYljcjVV-iRJS3gJqGfx-B6kj719cJ9o,843
1143
1146
  zrb/shell-scripts/rsync-util.sh,sha256=QzdhSBvUNMxB4U2B4m0Dxg9czGckRjB7Vk4A1ObG0-k,353
1144
1147
  zrb/shell-scripts/ssh-util.sh,sha256=9lXDzw6oO8HuA4vdbfps_uQMMwKyNYX9fZkZgpK52g8,401
1145
1148
  zrb/task/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
1146
1149
  zrb/task/any_task.py,sha256=2fD9_8ezytn4L37gyk9Qtawsmu60gGXBwuJVkYloqsw,6396
1147
1150
  zrb/task/any_task_event_handler.py,sha256=vpO9t0fck8-oFu1KYptfcg2hXKRsk6V5je4Dg-Bl21o,359
1148
- zrb/task/base_remote_cmd_task.py,sha256=I2rKry7hEqNihQE7bqbLsmOGOyiItlkLDSD2CqXFGUA,8940
1149
- zrb/task/checker.py,sha256=Iad_oa-X5i3p7xisF-MPACcAYFHGXSAJVSoGa2VrI-c,3097
1151
+ zrb/task/base_remote_cmd_task.py,sha256=QgXkhHabvm5jqCCjjKHtjbG4snjvyyNG0Vw7oo9q3Bk,9028
1152
+ zrb/task/checker.py,sha256=IOPD6LZ_mZeSoNTzE335mXmeA7oobkkA4GxIDvLkL-I,3175
1150
1153
  zrb/task/cmd_task.py,sha256=RwhMQ24Mw6qbsOMDQwjbZ2YnlHI_8XfyMSVkRIkRi9g,13976
1151
1154
  zrb/task/decorator.py,sha256=6mJuDhmyHnVwx8SzBf8el5KwYJdA06VTeb1BABgLmTc,2399
1152
1155
  zrb/task/docker_compose_task.py,sha256=clbq1OOKC_zAz7IL3iBpNnCGR96JCF056r4o0v0E75k,13282
1153
1156
  zrb/task/flow_task.py,sha256=l0xCb6mlaaNK5NVZxhKWE1qKXUI2akzC6CZfciGh7P8,3939
1154
1157
  zrb/task/http_checker.py,sha256=PoneoC9S7bTw41IP7hB9ewaWO-lF3ZWT75MXEPyThYA,5244
1158
+ zrb/task/notifier.py,sha256=UVhx1fLORhqyXprzqQqdoVYIFGrirwnTk-Ak18ZyucQ,5332
1155
1159
  zrb/task/path_checker.py,sha256=BSBf8ZXEcTwVI3UskSgdXXWrCLWggnwk6sHHbEI0z5g,3382
1156
1160
  zrb/task/path_watcher.py,sha256=9r36cMc7EaLehQVw0149TN-qOZitucR9mRW3S-w7SQw,4695
1157
1161
  zrb/task/port_checker.py,sha256=IvOUhefkpYcKZJ9zGr0RNUZju5yLvXoNJlLlODpLZZ8,4111
1158
- zrb/task/recurring_task.py,sha256=K8ECIrVSkhaaVv5dwEu2xfAuufr2PHCOrzoCQJr6G9k,4597
1162
+ zrb/task/recurring_task.py,sha256=oBtuU5HXiCM6Nfsmb70kpebf7v_rVqpOYThwPCWGXOM,5091
1159
1163
  zrb/task/remote_cmd_task.py,sha256=LYWmnZ4mPsU-RIdAUyhui7mlIunx4vY8upwjhctnkEs,3778
1160
1164
  zrb/task/resource_maker.py,sha256=2DiyR57srjO7lOzASH-gqHqbmJjtRppU4SG_H-evPqU,6522
1161
1165
  zrb/task/rsync_task.py,sha256=3vxENH-unD1VLgZI09Ts_lAQRMi2i1UiJpsaI1dltzI,3966
1162
1166
  zrb/task/task.py,sha256=l1jzJil7AqnsFn9e8WyO-rgCIG1JSvB6DaRBQZQo00I,246
1163
- zrb/task/time_watcher.py,sha256=506dhQ0cLN696euFB264Sv1bcV2XctBRgdmW18O7FZc,3730
1167
+ zrb/task/time_watcher.py,sha256=cbmmKtbeMrkRwpRZi_-jyJ_hC4KnsOPHUIpzvns2hPQ,3728
1164
1168
  zrb/task/base_task/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
1165
- zrb/task/base_task/base_task.py,sha256=n7TcuP0wvWSkqSgDQ9bigprNBm8EAYQD_9wHllrOOlQ,16134
1169
+ zrb/task/base_task/base_task.py,sha256=dVfXxYOSZHkePOGWrSrt94r1ZKh6b74z5jvAhZqcuf0,16104
1166
1170
  zrb/task/base_task/component/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
1167
- zrb/task/base_task/component/base_task_model.py,sha256=N_whXLyE5Tve3zeXjcSuR2i-zd8ww2l7VWq09o0p7tg,9833
1171
+ zrb/task/base_task/component/base_task_model.py,sha256=mi7v0ScvVlqkXSM6N0GUEWomVd3wwzL492LU60u2jZQ,9845
1168
1172
  zrb/task/base_task/component/common_task_model.py,sha256=9qwrnVARWafGm8PNpZtPmxlgVSD_3ZNt3hZxiOJO2m4,10478
1169
1173
  zrb/task/base_task/component/pid_model.py,sha256=pWCjgD3J2Jimjq1Y9pkVczZMeFEIcy7Hm9eFGrHGUZE,296
1170
1174
  zrb/task/base_task/component/renderer.py,sha256=RGq9UNOKi8sWSIOlxNrIlXgT8q-ia-pwKgRiCFrgVwU,4119
@@ -1185,8 +1189,8 @@ zrb/task_input/int_input.py,sha256=VYduGcAE0m7eDItRQboTFDCW5whMur_uH1Y9qtBIwV4,1
1185
1189
  zrb/task_input/password_input.py,sha256=i6U-smP6zFo8Ts9x14YXVgx7PKkRWr4U_EzPFp9nucw,1687
1186
1190
  zrb/task_input/str_input.py,sha256=w9TTUMlMQtlOXh2ahHPbRnFyTiV94lXizucCc8SuWoo,1668
1187
1191
  zrb/task_input/task_input.py,sha256=HotqM1iYSzwE4PIj8grnEUsvJqjx1dS6Ek7i6ZJLq2Y,83
1188
- zrb-0.0.118.dist-info/entry_points.txt,sha256=xTgXc1kBKYhJHEujdaSPHUcJT3-hbyP1mLgwkv-5sSk,40
1189
- zrb-0.0.118.dist-info/LICENSE,sha256=WfnGCl8G60EYOPAEkuc8C9m9pdXWDe08NsKj3TBbxsM,728
1190
- zrb-0.0.118.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
1191
- zrb-0.0.118.dist-info/METADATA,sha256=v0WjAqkJMgE8ZUnNMlAtybAKW4-0S3InzncD5dj3Ees,14174
1192
- zrb-0.0.118.dist-info/RECORD,,
1192
+ zrb-0.0.119.dist-info/entry_points.txt,sha256=xTgXc1kBKYhJHEujdaSPHUcJT3-hbyP1mLgwkv-5sSk,40
1193
+ zrb-0.0.119.dist-info/LICENSE,sha256=WfnGCl8G60EYOPAEkuc8C9m9pdXWDe08NsKj3TBbxsM,728
1194
+ zrb-0.0.119.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
1195
+ zrb-0.0.119.dist-info/METADATA,sha256=DMV_f07FDRI-bO9zguDjmZxq3mN5kxOQzLBmNgVF3mQ,14176
1196
+ zrb-0.0.119.dist-info/RECORD,,
zrb/builtin/watch.py DELETED
@@ -1,44 +0,0 @@
1
- from zrb.task.recurring_task import RecurringTask
2
- from zrb.task.cmd_task import CmdTask
3
- from zrb.task.path_watcher import PathWatcher
4
- from zrb.task_input.str_input import StrInput
5
- from zrb.runner import runner
6
-
7
-
8
- watch = RecurringTask(
9
- name='watch',
10
- description='Watch changes and show message/run command',
11
- inputs=[
12
- StrInput(
13
- name='pattern',
14
- default='*.*',
15
- prompt='File pattern',
16
- description='File pattern to be watched'
17
- ),
18
- ],
19
- triggers=[
20
- PathWatcher(name='watch-path', path='{{input.pattern}}')
21
- ],
22
- task=CmdTask(
23
- name='run-task',
24
- inputs=[
25
- StrInput(
26
- name='message',
27
- default='👋',
28
- prompt='Message to be shown',
29
- description='Message to be shown when changes detected'
30
- ),
31
- StrInput(
32
- name='command',
33
- default='',
34
- prompt='Command to be executed',
35
- description='Command to be executed when changes detected'
36
- ),
37
- ],
38
- cmd=[
39
- '{% if input.message != "" %}echo {{ input.message }}{% endif %}',
40
- '{% if input.command != "" %}{{ input.command }}{% endif %}',
41
- ]
42
- )
43
- )
44
- runner.register(watch)
File without changes
File without changes