lib/autoproj/cli/cache.rb in autoproj-2.0.0.b7 vs lib/autoproj/cli/cache.rb in autoproj-2.0.0.rc1

- old
+ new

@@ -6,12 +6,17 @@ class Cache < InspectionTool def validate_options(argv, options = Hash.new) argv, options = super if argv.empty? - raise ArgumentError, "expected one cache directory as argument" + default_cache_dirs = Autobuild::Importer.default_cache_dirs + if !default_cache_dirs || default_cache_dirs.empty? + raise ArgumentError, "no cache directory defined with e.g. the AUTOBUILD_CACHE_DIR environment variable, expected one cache directory as argument" + end + Autoproj.warn "using cache directory #{default_cache_dirs.first} from the autoproj configuration" + argv << default_cache_dirs.first elsif argv.size > 1 - raise ArgumentError, "expected one cache directory as argument" + raise ArgumentError, "expected only one cache directory as argument" end return File.expand_path(argv.first, ws.root_dir), options end