Sha256: ffc5fefea3e44f48c4950c0d02aa70d39e4fa98050a6ee8457645fdac158b48e

Contents?: true

Size: 1.36 KB

Versions: 51

Compression:

Stored size: 1.36 KB

Contents

# Copyright (C) the Rugged contributors.  All rights reserved.
#
# This file is part of Rugged, distributed under the MIT license.
# For full terms see the included LICENSE file.

module Rugged
  class Tag < Rugged::Reference
    GPG_SIGNATURE_PREFIX = "-----BEGIN PGP SIGNATURE-----".freeze

    def self.extract_signature(repo, oid, prefix=GPG_SIGNATURE_PREFIX)
      object = repo.read(oid)

      unless object.type == :tag
        raise GitRPC::InvalidObject, "Invalid object type #{object.type}, expected tag"
      end

      if index = object.data.index(prefix)
        [
          object.data.byteslice(index..-1),
          object.data.byteslice(0...index)
        ]
      else
        nil
      end
    end

    def name
      canonical_name.sub(%r{^refs/tags/}, "")
    end

    class Annotation
      def self.prettify_message(msg, strip_comments = true)
        Rugged::prettify_message(msg, strip_comments)
      end

      def inspect
        "#<Rugged::Tag::Annotation:#{object_id} {name: #{name.inspect}, message: #{message.inspect}, target: #{target.inspect}>"
      end

      def to_hash
        {
          :message => message,
          :name => name,
          :target => target,
          :tagger => tagger,
        }
      end

      def modify(new_args, force=True)
        args = self.to_hash.merge(new_args)
        Tag.create(args, force)
      end
    end
  end
end

Version data entries

51 entries across 51 versions & 1 rubygems

Version Path
rugged-1.7.2 lib/rugged/tag.rb
rugged-1.6.5 lib/rugged/tag.rb
rugged-1.7.1 lib/rugged/tag.rb
rugged-1.6.3 lib/rugged/tag.rb
rugged-1.6.2 lib/rugged/tag.rb
rugged-1.5.1 lib/rugged/tag.rb
rugged-1.4.5 lib/rugged/tag.rb
rugged-1.5.0.1 lib/rugged/tag.rb
rugged-1.5.0 lib/rugged/tag.rb
rugged-1.3.2.3 lib/rugged/tag.rb
rugged-1.4.4 lib/rugged/tag.rb
rugged-1.3.2.1 lib/rugged/tag.rb
rugged-1.4.3 lib/rugged/tag.rb
rugged-1.3.2 lib/rugged/tag.rb
rugged-1.4.2 lib/rugged/tag.rb
rugged-1.3.1 lib/rugged/tag.rb
rugged-1.3.0 lib/rugged/tag.rb
rugged-1.2.0 lib/rugged/tag.rb
rugged-1.1.1 lib/rugged/tag.rb
rugged-1.1.0 lib/rugged/tag.rb