Sha256: 201ed909473e1f485860e21b634426aafad5a0e998e15a1bacd4071262e29be9

Contents?: true

Size: 1.91 KB

Versions: 27

Compression:

Stored size: 1.91 KB

Contents

require 'autoproj'
require 'autoproj/cli/base'
module Autoproj
    module CLI
        class Manifest < Base
            def validate_options(args, options)
                return args, options
            end

            def run(name, options = Hash.new)
                ws.load_config
                if name.empty?
                    Autoproj.message "current manifest is #{ws.manifest_file_path}"
                elsif name.size == 1
                    name = name.first
                    if File.file?(full_path = File.expand_path(name))
                        if File.dirname(full_path) != ws.config_dir
                            raise CLIInvalidArguments, "#{full_path} is not part of #{ws.config_dir}"
                        end
                    else
                        full_path = File.join(ws.config_dir, name)
                    end

                    if !File.file?(full_path)
                        alternative_full_path = File.join(ws.config_dir, "manifest.#{name}")
                        if !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.save_config
                    Autoproj.message "set manifest to #{full_path}"
                else
                    raise CLIInvalidArguments, "expected zero or one argument, but got #{name.size}"
                end
            end

            def notify_env_sh_updated
            end
        end
    end
end

Version data entries

27 entries across 27 versions & 1 rubygems

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