Sha256: b56233fb131cf19ad94c914078c886fb7bdbfebe8ed97baeff1fc2fa1b0514a1

Contents?: true

Size: 1019 Bytes

Versions: 3

Compression:

Stored size: 1019 Bytes

Contents

# frozen_string_literal: true

module Rake
  module Funnel
    module Support
      module AssemblyVersion
        class FromVersionFiles
          include Rake::Funnel::Support
          include Enumerable

          attr_reader :search_pattern, :metadata

          def initialize(args = {})
            @search_pattern = args[:search_pattern] || %w(**/VERSION)
            @metadata = args[:metadata]
          end

          def each
            block_given? || (return enum_for(__method__))

            files.each do |file|
              $stderr.print("Reading #{file}\n")

              version_info = VersionInfo.parse(
                version: VersionInfo.read_version_from(file),
                metadata: metadata
              )

              yield({ source: file, version_info: version_info })
            end
          end

          private

          def files
            Finder.new(search_pattern, self, 'No version files found.').all_or_default
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rake-funnel-0.24.0 lib/rake/funnel/support/assembly_version/from_version_files.rb
rake-funnel-0.23.0 lib/rake/funnel/support/assembly_version/from_version_files.rb
rake-funnel-0.22.3 lib/rake/funnel/support/assembly_version/from_version_files.rb