Class: Autoproj::CLI::Manifest

Inherits:
Base
  • Object
show all
Defined in:
lib/autoproj/cli/manifest.rb

Instance Attribute Summary

Attributes inherited from Base

#ws

Instance Method Summary collapse

Methods inherited from Base

#export_env_sh, #initialize, #normalize_command_line_package_selection, #resolve_selection, #resolve_user_selection, validate_options, #validate_user_selection

Methods included from Ops::Tools

#common_options, #create_autobuild_package, #load_autoprojrc, #load_main_initrb

Constructor Details

This class inherits a constructor from Autoproj::CLI::Base

Instance Method Details

#notify_env_sh_updatedObject



46
47
# File 'lib/autoproj/cli/manifest.rb', line 46

def notify_env_sh_updated
end

#run(name, options = Hash.new) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/autoproj/cli/manifest.rb', line 10

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

        unless File.file?(full_path)
            alternative_full_path = File.join(ws.config_dir, "manifest.#{name}")
            unless 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

#validate_options(args, options) ⇒ Object



6
7
8
# File 'lib/autoproj/cli/manifest.rb', line 6

def validate_options(args, options)
    [args, options]
end