Skip to content

Commit 7e1efc3

Browse files
committed
Add simulation message to doit
Used for --dry-run Improved also skipped detection
1 parent 3bc756c commit 7e1efc3

2 files changed

Lines changed: 18 additions & 4 deletions

File tree

bin/webdevops/command/BaseCommand.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import multiprocessing
2424
from cleo import Command
2525
from webdevops import Configuration
26+
from ..doit.DoitReporter import DoitReporter
2627

2728
class BaseCommand(Command):
2829
configuration = False
@@ -86,6 +87,8 @@ def startup(self):
8687

8788
if 'dryRun' in self.configuration and self.configuration.get('dryRun'):
8889
options.append('dry-run')
90+
DoitReporter.simulation_mode = True
91+
8992

9093
print 'Executing %s (%s)' % (self.name, ', '.join(options))
9194
print ''

bin/webdevops/doit/DoitReporter.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ class DoitReporter(object):
9595
output results after finish
9696
"""
9797

98+
skip_detection = True
99+
simulation_mode = False
100+
98101
desc = 'output after finish'
99102

100103
show_out = False
@@ -160,11 +163,19 @@ def add_success(self, task):
160163
duration = self.duration(durationSeconds)
161164
progress = self.calc_progress()
162165

163-
if durationSeconds >= 2:
164-
self.writeln(colored('. %s finished (%s, %s)' % (BaseTaskLoader.human_task_name(task.title()), duration, progress), 'green'))
166+
if DoitReporter.simulation_mode:
167+
self.writeln(
168+
colored('. %s simulated (%s, %s)' % (BaseTaskLoader.human_task_name(task.title()), duration, progress), 'blue')
169+
)
165170
else:
166-
self.writeln(colored(
167-
'. %s SKIPPED (%s, %s)' % (BaseTaskLoader.human_task_name(task.title()), duration, progress), 'yellow'))
171+
if DoitReporter.skip_detection and durationSeconds < 1:
172+
self.writeln(
173+
colored('. %s SKIPPED (%s, %s)' % (BaseTaskLoader.human_task_name(task.title()), duration, progress), 'yellow')
174+
)
175+
else:
176+
self.writeln(
177+
colored('. %s finished (%s, %s)' % (BaseTaskLoader.human_task_name(task.title()), duration, progress), 'green')
178+
)
168179

169180
def skip_uptodate(self, task):
170181
"""

0 commit comments

Comments
 (0)