Sha256: 83a5f84de04f8f61e49937d0ed8a22041ca8f9a2b1b2d2eeb547ad54255e9843

Contents?: true

Size: 835 Bytes

Versions: 4

Compression:

Stored size: 835 Bytes

Contents

module GitCompound
  module Worker
    # Worker that prints dependency tree
    #
    class PrettyPrint < Worker
      def visit_component(component)
        pretty_print(component, " `#{component.name}` component, #{component.version}")
      end

      def visit_manifest(manifest)
        details = []
        details << "Component: #{manifest.name}" unless manifest.name.empty?
        details << "Maintainer: #{manifest.maintainer.join(', ')}" unless
          manifest.maintainer.empty?
        details << 'Dependencies:' unless manifest.components.empty?

        pretty_print(manifest, *details)
      end

      private

      def pretty_print(element, *messages)
        messages.each do |message|
          Logger.inline '    ' * element.ancestors.count
          Logger.info message
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
git_compound-0.2.2 lib/git_compound/worker/pretty_print.rb
git_compound-0.2.1 lib/git_compound/worker/pretty_print.rb
git_compound-0.2.0 lib/git_compound/worker/pretty_print.rb
git_compound-0.1.2 lib/git_compound/worker/pretty_print.rb