#! /usr/bin/env ruby require 'autoproj' require 'autoproj/ops/main_config_switcher' Autoproj::CmdLine.report do Autoproj::CmdLine.initialize if Dir.pwd.start_with?(Autoproj.remotes_dir) || Dir.pwd.start_with?(Autoproj.config_dir) raise ConfigError, "you cannot run autoproj switch-config from autoproj's configuration directory or one of its subdirectories" end # We must switch to the root dir first, as it is required by the # configuration switch code. This is acceptable as long as we # quit just after the switch Dir.chdir(Autoproj.root_dir) switcher = Autoproj::Ops::MainConfigSwitcher.new(Autoproj.root_dir) if switcher.switch_config(*ARGV) manifest = Autoproj::Manifest.load(File.join(Autoproj.config_dir, 'manifest')) update = Autoproj::Ops::Configuration.new(manifest, Autoproj::Ops.loader) update.update_configuration Autoproj.save_config end end