lib/autoproj/cli/switch_config.rb in autoproj-2.0.0.rc5 vs lib/autoproj/cli/switch_config.rb in autoproj-2.0.0.rc6
- old
+ new
@@ -1,25 +1,30 @@
require 'autoproj'
require 'autoproj/cli/base'
+require 'autoproj/cli/update'
require 'autoproj/ops/main_config_switcher'
require 'autoproj/ops/configuration'
module Autoproj
module CLI
class SwitchConfig < Base
def run(args, options = Hash.new)
- if Dir.pwd.start_with?(ws.remotes_dir) || Dir.pwd.start_with?(ws.config_dir)
+ if !File.directory?(ws.config_dir)
+ raise ConfigError, "there's no autoproj/ directory in this workspace, use autoproj bootstrap to check out one"
+ elsif Dir.pwd.start_with?(ws.remotes_dir) || Dir.pwd.start_with?(ws.config_dir)
raise ConfigError, "you cannot run autoproj switch-config from autoproj's configuration directory or one of its subdirectories"
end
ws.load_config
+ ws.setup_os_package_installer
# 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
switcher = Ops::MainConfigSwitcher.new(ws)
if switcher.switch_config(*args)
- CLI::Main.start(['update', '--config'])
+ updater = Update.new(ws)
+ updater.run([], config: true)
end
end
end
end
end