Method: Mono::Tool.status

Defined in:
lib/mono/commands/status.rb

.statusObject



5
6
7
8
9
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/mono/commands/status.rb', line 5

def self.status
  repos = Mono.monofile

  changes =  []   ## track changes


  count_orgs  = 0
  count_repos = 0

  total_repos = repos.size

  repos.each do |org,names|

    org_path = "#{Mono.root}/#{org}"

    names.each do |name|
        puts "[#{count_repos+1}/#{total_repos}] #{org}@#{name}..."

        repo = GitHubRepo.new( org, name )  ## owner, name e.g. rubylibs/webservice


        Dir.chdir( org_path ) do
          if Dir.exist?( repo.name )
            GitProject.open( repo.name ) do |proj|
              output = proj.changes
              if output.empty?
                 puts "   - no changes -"
              else
                changes << ["#{org}@#{name}", :CHANGES, output]
              end
            end
          else
            puts "!!  repo not found / missing"
            changes << ["#{org}@#{name}", :NOT_FOUND]
          end
        end

        count_repos += 1
    end
    count_orgs += 1
  end


  ## print stats & changes summary

  puts
  print "#{changes.size} change(s) in "
  print "#{count_repos} repo(s) @ #{count_orgs} org(s)"
  print "\n"

  changes.each do |item|
    puts
    print "== #{item[0]} - #{item[1]}"
    case item[1]
    when :CHANGES
      print ":\n"
      print item[2]
    when :NOT_FOUND
      print "\n"
    end
  end

end