Sha256: 33497da955d66d7eb6a1d6ef80046906bc61b66253e738e0ac3c0e2d43919a84

Contents?: true

Size: 1.12 KB

Versions: 1

Compression:

Stored size: 1.12 KB

Contents

# encoding: UTF-8

module Rosette
  module Core
    module Commands

      # Takes a snapshot of a repository and returns the snapshot hash. Snapshots
      # are simple hashes that map file paths to git commit ids. The commit ids
      # indicate in which commit the corresponding file last changed.
      #
      # @!attribute [Array] paths
      #   @return [Array] the paths to consider when taking the snapshot. Any paths
      #     that do not exist in this array will not appear in the snapshot.
      class RepoSnapshotCommand < GitCommand
        attr_reader :paths

        include WithSnapshots
        include WithRepoName
        include WithRef

        # Set the paths that will be included in the snapshot.
        #
        # @param [Array] paths The paths to include in the snapshot.
        # @return [self]
        def set_paths(paths)
          @paths = paths
          self
        end

        # Take the snapshot.
        #
        # @return [Hash] the snapshot hash (file path to commit id pairs).
        def execute
          take_snapshot(get_repo(repo_name), commit_id, paths)
        end
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rosette-core-1.0.1 lib/rosette/core/commands/git/repo_snapshot_command.rb