Sha256: 244f8b2ceb54bb9f32aa1b952b1f3c8554601b68aee86e01766d4b6d3ae0803e

Contents?: true

Size: 889 Bytes

Versions: 11

Compression:

Stored size: 889 Bytes

Contents

# frozen_string_literal: true

module Milestoner
  module CLI
    module Actions
      # Handles listing project status of untagged commit history.
      class Status
        include Milestoner::Import[:logger]

        def initialize presenter: Presenters::Commit,
                       categorizer: Commits::Categorizer.new,
                       **dependencies
          super(**dependencies)
          @presenter = presenter
          @categorizer = categorizer
        end

        def call
          categorizer.call
                     .tap { |records| info "All is quiet." if records.empty? }
                     .map { |record| presenter.new(record).line_item }
                     .each { |line_item| info line_item }
        end

        private

        attr_reader :presenter, :categorizer

        def info(message) = logger.info { message }
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
milestoner-15.2.0 lib/milestoner/cli/actions/status.rb
milestoner-15.1.0 lib/milestoner/cli/actions/status.rb
milestoner-15.0.0 lib/milestoner/cli/actions/status.rb
milestoner-14.5.0 lib/milestoner/cli/actions/status.rb
milestoner-14.4.0 lib/milestoner/cli/actions/status.rb
milestoner-14.3.0 lib/milestoner/cli/actions/status.rb
milestoner-14.2.0 lib/milestoner/cli/actions/status.rb
milestoner-14.1.0 lib/milestoner/cli/actions/status.rb
milestoner-14.0.2 lib/milestoner/cli/actions/status.rb
milestoner-14.0.1 lib/milestoner/cli/actions/status.rb
milestoner-14.0.0 lib/milestoner/cli/actions/status.rb