Class: RIM::InfoHelper

Inherits:
CommandHelper show all
Defined in:
lib/rim/info_helper.rb

Constant Summary

Constants inherited from Processor

Processor::GerritServer, Processor::MaxThreads

Instance Method Summary collapse

Methods inherited from CommandHelper

#add_unique_module_info, #all_module_paths_from_path, #check_arguments, #check_ready, #create_module_info, #find_file_dir_in_workspace, #get_remote_branch_format, #module_from_path, #module_paths, #modules_from_manifest, #modules_from_paths

Methods included from Manifest

#parse_manifest, #read_manifest

Methods inherited from Processor

#clone_or_fetch_repository, #commit, #each_module_parallel, #get_absolute_remote_url, #get_relative_path, #local_changes?, #module_git_path, #module_tmp_git_path, #remote_path, shorten_path

Constructor Details

#initialize(workspace_root, logger) ⇒ InfoHelper

Returns a new instance of InfoHelper.



8
9
10
11
# File 'lib/rim/info_helper.rb', line 8

def initialize(workspace_root, logger)
  @module_helpers = []
  super(workspace_root, logger)
end

Instance Method Details

#add_module_info(module_info) ⇒ Object



13
14
15
# File 'lib/rim/info_helper.rb', line 13

def add_module_info(module_info)
  @module_helpers.push(InfoModuleHelper.new(@ws_root, module_info, @logger))
end

#upstream_infoObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/rim/info_helper.rb', line 17

def upstream_info
  each_module_parallel("gather info", @module_helpers) do |m|
    print "."
    m.gather_info
  end
  puts
  @module_helpers.each do |h|
    path = h.module_info.local_path.split(/[\\\/]/).last.ljust(40)
    info = "#{path}: ->#{h.target_rev.ljust(10)} @#{h.current_sha1[0..6]}"
    if h.upstream_revs
      if h.upstream_revs.size > 0
        info += " [#{h.upstream_revs.size} commits behind]"
      else
        info += " [UP TO DATE]"
      end
      @logger.info(info)
      h.upstream_revs.each do |r|
        @logger.info("  #{r.strip}")
      end
    else
      @logger.info(info)
    end
  end
end