Sha256: dc883cbe2732272c251ff3dcfe6c61a0aebfe8fa8d4cd7dc703b80bd6dbf3fcd

Contents?: true

Size: 1.08 KB

Versions: 5

Compression:

Stored size: 1.08 KB

Contents

require 'autoproj'
require 'autoproj/cli/base'
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)
                    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
                switcher = Ops::MainConfigSwitcher.new(ws)
                if switcher.switch_config(*args)
                    manifest = Manifest.load(File.join(ws.config_dir, 'manifest'))
                    update = Ops::Configuration.new(ws, ws.loader)
                    update.update_configuration
                    ws.config.save
                end
            end
        end
    end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
autoproj-2.0.0.b5 lib/autoproj/cli/switch_config.rb
autoproj-2.0.0.b4 lib/autoproj/cli/switch_config.rb
autoproj-2.0.0.b3 lib/autoproj/cli/switch_config.rb
autoproj-2.0.0.b2 lib/autoproj/cli/switch_config.rb
autoproj-2.0.0.b1 lib/autoproj/cli/switch_config.rb