Sha256: 9c5a3c04892a1917fdaf4de99fc726f4f9da03c5e33dc6830cc6b55079661470

Contents?: true

Size: 1.42 KB

Versions: 19

Compression:

Stored size: 1.42 KB

Contents

module Autoproj
    module CLI
        class MainGlobal < Thor
            namespace 'global'

            desc 'register', 'register the current workspace'
            def register
                require 'autoproj'
                ws = Workspace.default
                ws.load_config
                ws.register_workspace
            end

            desc 'status', 'display information about the known workspaces'
            def status
                require 'autoproj'
                ws = Workspace.registered_workspaces
                fields = Workspace::RegisteredWorkspace.members.map(&:to_s)
                format_w = fields.map(&:length).max + 1
                format = "%-#{format_w}s %s (%s)"
                blocks = ws.map do |w|
                    %w[root_dir prefix_dir build_dir].map do |name|
                        dir = w.public_send(name)
                        if dir.start_with?('/')
                            status = if File.directory?(dir)
                                         Autobuild.color('present', :green)
                                     else
                                         Autobuild.color('absent', :yellow)
                                     end

                            format(format, "#{name}:", dir, status)
                        end
                    end.compact.join("\n")
                end
                puts blocks.join("---\n")
            end
        end
    end
end

Version data entries

19 entries across 19 versions & 1 rubygems

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