File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed
Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -56,6 +56,9 @@ def initialize(path, files)
5656 attr_reader :path , :files
5757end
5858
59+ class NoTasksDefinedError < StandardError
60+ end
61+
5962class TaskManager
6063 def initialize
6164 @tasks = { }
@@ -66,6 +69,7 @@ def load(file)
6669 context = TaskContext . new ( dir , self )
6770 context . instance_eval ( File . read ( file ) , file )
6871 @tasks . merge! ( context . tasks )
72+ raise NoTasksDefinedError if @tasks . empty?
6973 end
7074
7175 def show_help
@@ -234,6 +238,9 @@ def find_runfile
234238rescue MultipleRunfileError => e
235239 $stderr. puts "[runx] Error: Multiple Runfiles found in #{ e . path } : #{ e . files . join ( ', ' ) } ."
236240 exit 1
241+ rescue NoTasksDefinedError => e
242+ $stderr. puts '[runx] Error: No tasks defined. See https://github.com/schmich/runx#usage.'
243+ exit 1
237244rescue TaskNotFoundError => e
238245 $stderr. puts "[runx] Error: Task '#{ e . name } ' not found."
239246 exit 1
You can’t perform that action at this time.
0 commit comments