Class: Autoproj::CLI::MainGlobal

Inherits:
Thor
  • Object
show all
Defined in:
lib/autoproj/cli/main_global.rb

Defined Under Namespace

Classes: WorkspaceDir

Instance Method Summary collapse

Instance Method Details

#registerObject



28
29
30
31
32
33
# File 'lib/autoproj/cli/main_global.rb', line 28

def register
    require "autoproj"
    ws = Workspace.default
    ws.load_config
    ws.register_workspace
end

#statusObject



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/autoproj/cli/main_global.rb', line 36

def status
    require "autoproj"
    ws = Workspace.registered_workspaces
    fields = Workspace::RegisteredWorkspace.members.map(&:to_s)

    dirs = gather_workspaces_dirs(ws)
    filter_removed_workspaces(dirs)
    Workspace.save_registered_workspaces(dirs.keys)

    format_w = fields.map(&:length).max + 1
    format = "%-#{format_w}s %s (%s)"
    blocks = dirs.map do |w, w_dirs|
        lines = w_dirs.map do |d|
            status =
                if d.present
                    Autobuild.color("present", :green)
                else
                    Autobuild.color("absent", :yellow)
                end

            format(format, "#{d.name}:", d.path, status)
        end
        lines.join("\n")
    end
    puts blocks.join("\n---\n")
end