Module: Rosette::Core::Commands::WithNonMergeRef

Includes:
WithRef
Defined in:
lib/rosette/core/commands/git/with_non_merge_ref.rb

Overview

Mixin that handles configuration and validation of a git ref or commit id. This module is similar to WithRef except that it will fail to validate merge refs. It is meant to be mixed into the classes in Rosette::Core::Commands. Required to be used in combination with WithRepoName.

Examples:

class MyCommand
  include WithRepoName
  include WithNonMergeRef
end

cmd = MyCommand.new
  .set_repo_name('my_repo')
  .set_ref('master')

cmd.commit_str  # => "master"
cmd.commit_id   # => "67f0e9a60dfe39430b346086f965e6c94a8ddd24"

cmd.set_ref('non_existant_ref')
cmd.valid?    # => false
cmd.messages  # => { commit_str: ["Unable to find commit 'non_existent_ref'"] }

See Also:

Instance Attribute Summary

Attributes included from WithRef

#commit_str

Method Summary

Methods included from WithRef

#commit_id, #set_commit_id, #set_ref