Sha256: d361ca08d8078e67d77e8f65f1e6781692e0b43f115d234e6d1dcf5807f9dea2

Contents?: true

Size: 1.25 KB

Versions: 27

Compression:

Stored size: 1.25 KB

Contents

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 !File.directory?(ws.config_dir)
                    raise CLIInvalidArguments, "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 CLIInvalidArguments, "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)
                    updater = Update.new(ws)
                    updater.run([], config: true)
                end
            end
        end
    end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
autoproj-2.14.0 lib/autoproj/cli/switch_config.rb
autoproj-2.13.0 lib/autoproj/cli/switch_config.rb
autoproj-2.12.1 lib/autoproj/cli/switch_config.rb
autoproj-2.12.0 lib/autoproj/cli/switch_config.rb
autoproj-2.11.0 lib/autoproj/cli/switch_config.rb
autoproj-2.10.2 lib/autoproj/cli/switch_config.rb
autoproj-2.10.1 lib/autoproj/cli/switch_config.rb
autoproj-2.10.0 lib/autoproj/cli/switch_config.rb
autoproj-2.9.0 lib/autoproj/cli/switch_config.rb
autoproj-2.8.8 lib/autoproj/cli/switch_config.rb
autoproj-2.8.7 lib/autoproj/cli/switch_config.rb
autoproj-2.8.6 lib/autoproj/cli/switch_config.rb
autoproj-2.8.5 lib/autoproj/cli/switch_config.rb
autoproj-2.8.5.b1 lib/autoproj/cli/switch_config.rb
autoproj-2.8.4 lib/autoproj/cli/switch_config.rb
autoproj-2.8.3 lib/autoproj/cli/switch_config.rb
autoproj-2.8.2 lib/autoproj/cli/switch_config.rb
autoproj-2.8.1 lib/autoproj/cli/switch_config.rb
autoproj-2.8.0 lib/autoproj/cli/switch_config.rb
autoproj-2.7.1 lib/autoproj/cli/switch_config.rb