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
65
66
67
68
69
70
71
72
73
74
|
# File 'lib/yard/cli/diff.rb', line 28
def run(*args)
registry = optparse(*args).map do |gemfile|
if @use_git
load_git_commit(gemfile)
all_objects
elsif load_gem_data(gemfile)
log.info "Found #{gemfile}"
all_objects
else
log.error "Cannot find gem #{gemfile}"
nil
end
end.compact
return if registry.size != 2
first_object = nil
[["Added objects", "A", added_objects(*registry)],
["Modified objects", "M", modified_objects(*registry)],
["Removed objects", "D", removed_objects(*registry)]].each do |name, short, objects|
next if short == "M" && @modified == false
next if objects.empty?
last_object = nil
all_objects_notice = false
log.puts name + ":" unless @compact
objects.sort_by(&:path).each do |object|
if !@list_all && last_object && object.parent == last_object
log.print " (...)" unless all_objects_notice
all_objects_notice = true
next
elsif @compact
log.puts if first_object
else
log.puts
end
all_objects_notice = false
log.print "" + (@compact ? "#{short} " : " ") +
object.path + " (#{object.file}:#{object.line})"
last_object = object
first_object = true
end
unless @compact
log.puts; log.puts
end
end
log.puts if @compact
end
|