Sha256: 5f0f78673ab68e7f07c46d7d76f78a02a4bc66c81239550fb53d58a5f9fc7f90
Contents?: true
Size: 1.63 KB
Versions: 1
Compression:
Stored size: 1.63 KB
Contents
# encoding: UTF-8 module Rosette module Core module Commands # Mixin capable of taking snapshots of git repositories. Meant to be mixed # into the classes in {Rosette::Core::Commands}. # # @see Rosette::Core::SnapshotFactory # # @example # class MyCommand < Rosette::Core::Commands::Command # include WithSnapshots # end # # cmd = MyCommand.new # snap = cmd.take_snapshot(repo_config, commit_id, paths) # snap # => { 'path/to/file.rb' => '67f0e9a60dfe39430b346086f965e6c94a8ddd24', ... } module WithSnapshots # Takes and returns a snapshot hash for the given repo and commit id. Limits # the paths returned via the +paths+ argument. If no paths are passed, # {#take_snapshot} returns a snapshot containing all the paths in the repository. # # @param [Rosette::Core::RepoConfig] repo_config The repository configuration # to take the snapshot from. # @param [String] commit_id The git commit id to take the snapshot of. # @param [Array] paths The list of paths to consider when taking the snapshot. # Only those paths included in this list will appear in the snapshot hash. # @return [Hash] the snapshot hash (path to commit id pairs). def take_snapshot(repo_config, commit_id, paths = []) __snapshot_factory__.take_snapshot(repo_config, commit_id, paths) end private def __snapshot_factory__ @@__snapshot_factory__ ||= CachedSnapshotFactory.new(configuration.cache) 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/with_snapshots.rb |