Command
CLI command to return the objects that were added/removed from 2 versions of a project (library, gem, working copy). @since 0.6.0
# File lib/yard/cli/diff.rb, line 23 def description 'Returns the object diff of two gems or .yardoc files' end
# File lib/yard/cli/diff.rb, line 27 def run(*args) registry = optparse(*args).map do |gemfile| if @use_git load_git_commit(gemfile) all_objects else if load_gem_data(gemfile) log.info "Found #{gemfile}" all_objects else log.error "Cannot find gem #{gemfile}" nil end 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 {|o| o.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
Generated with the Darkfish Rdoc Generator 2.