File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -69,6 +69,14 @@ def initialize(path, files)
6969class NoTasksDefinedError < StandardError
7070end
7171
72+ class DirAttributeError < StandardError
73+ def initialize ( base )
74+ @base = base
75+ end
76+
77+ attr_reader :base
78+ end
79+
7280class TaskManager
7381 def initialize
7482 @tasks = { }
@@ -153,6 +161,8 @@ def dir(base, relative = '.')
153161 Dir . pwd
154162 when :root
155163 @root_dir
164+ else
165+ raise DirAttributeError . new ( base )
156166 end
157167 @task_dir = File . absolute_path ( File . join ( path , relative . to_s ) )
158168 end
@@ -290,6 +300,9 @@ def find_runfile
290300rescue DirNotFoundError => e
291301 $stderr. puts "[runx] Error: Task #{ e . task . name } : Directory not found: #{ e . dir } ."
292302 exit 1
303+ rescue DirAttributeError => e
304+ $stderr. puts "[runx] Error: Invalid attribute 'dir :#{ e . base } '. Expected :root or :pwd."
305+ exit 1
293306rescue Interrupt => e
294307 # Ignore interrupt and exit.
295308end
You can’t perform that action at this time.
0 commit comments