Class: Rosette::Core::Commands::RepoSnapshotCommand
- Inherits:
-
GitCommand
- Object
- Command
- GitCommand
- Rosette::Core::Commands::RepoSnapshotCommand
- Includes:
- WithRef, WithRepoName, WithSnapshots
- Defined in:
- lib/rosette/core/commands/git/repo_snapshot_command.rb
Overview
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.
Instance Attribute Summary collapse
-
#paths ⇒ Array
readonly
The paths to consider when taking the snapshot.
Attributes included from WithRef
Attributes included from WithRepoName
Attributes inherited from Command
Instance Method Summary collapse
-
#execute ⇒ Hash
Take the snapshot.
-
#set_paths(paths) ⇒ self
Set the paths that will be included in the snapshot.
Methods included from WithRef
#commit_id, #set_commit_id, #set_ref
Methods included from WithRepoName
Methods included from WithSnapshots
Methods inherited from GitCommand
Methods inherited from Command
#initialize, #messages, #valid?, validate, validators
Constructor Details
This class inherits a constructor from Rosette::Core::Commands::Command
Instance Attribute Details
#paths ⇒ Array (readonly)
Returns the paths to consider when taking the snapshot. Any paths that do not exist in this array will not appear in the snapshot.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/rosette/core/commands/git/repo_snapshot_command.rb', line 14 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 |
Instance Method Details
#execute ⇒ Hash
Take the snapshot.
33 34 35 |
# File 'lib/rosette/core/commands/git/repo_snapshot_command.rb', line 33 def execute take_snapshot(get_repo(repo_name), commit_id, paths) end |
#set_paths(paths) ⇒ self
Set the paths that will be included in the snapshot.
25 26 27 28 |
# File 'lib/rosette/core/commands/git/repo_snapshot_command.rb', line 25 def set_paths(paths) @paths = paths self end |