lib/autoproj/cli/manifest.rb in autoproj-2.14.0 vs lib/autoproj/cli/manifest.rb in autoproj-2.15.0

- old
+ new

@@ -1,12 +1,12 @@ -require 'autoproj' -require 'autoproj/cli/base' +require "autoproj" +require "autoproj/cli/base" module Autoproj module CLI class Manifest < Base def validate_options(args, options) - return args, options + [args, options] end def run(name, options = Hash.new) ws.load_config if name.empty? @@ -19,24 +19,25 @@ end else full_path = File.join(ws.config_dir, name) end - if !File.file?(full_path) + unless File.file?(full_path) alternative_full_path = File.join(ws.config_dir, "manifest.#{name}") - if !File.file?(alternative_full_path) + unless File.file?(alternative_full_path) raise CLIInvalidArguments, "neither #{full_path} nor #{alternative_full_path} exist" end + full_path = alternative_full_path end begin Autoproj::Manifest.new(ws).load(full_path) rescue Exception Autoproj.error "failed to load #{full_path}" raise end - ws.config.set 'manifest_name', File.basename(full_path) + ws.config.set "manifest_name", File.basename(full_path) ws.save_config Autoproj.message "set manifest to #{full_path}" else raise CLIInvalidArguments, "expected zero or one argument, but got #{name.size}" end @@ -45,6 +46,5 @@ def notify_env_sh_updated end end end end -