Sha256: 5f00857f92a0c4bfa662791e940b3c61a13f158b98c19920d302db5aeac876a9
Contents?: true
Size: 1.37 KB
Versions: 1
Compression:
Stored size: 1.37 KB
Contents
# encoding: UTF-8 module Rosette module Core module Commands # Mixin that handles configuration and validation of a git ref or commit id. # This module is similar to {Rosette::Core::Commands::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 # {Rosette::Core::Commands::WithRepoName}. # # @see Rosette::Core::Commands::WithRef # @see Rosette::Core::Commands::WithRepoName # # @example # 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'"] } module WithNonMergeRef include WithRef protected def self.included(base) if base.respond_to?(:validate) base.validate :commit_str, { type: :commit, allow_merge_commit: false } end 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_non_merge_ref.rb |