Sha256: 0a23248af5975921f5155865ab1ad955875eb9e731b51e343a3b04092f2776c6

Contents?: true

Size: 918 Bytes

Versions: 18

Compression:

Stored size: 918 Bytes

Contents

require "rubygems/version"

module PantographCore
  # Utility class to construct a Gem::Version from a tag.
  # Accepts vX.Y.Z and X.Y.Z.
  class TagVersion < Gem::Version
    class << self
      def correct?(tag)
        result = superclass.correct?(version_number_from_tag(tag))

        # It seems like depending on the Ruby env, the result is
        # slightly different. We actually just want `true` and `false`
        # values here
        return false if result.nil?
        return true if result == 0
        return result
      end

      # Gem::Version.new barfs on things like "v0.1.0", which is the style
      # generated by the rake release task. Just strip off any initial v
      # to generate a Gem::Version from a tag.
      def version_number_from_tag(tag)
        tag.sub(/^v/, "")
      end
    end

    def initialize(tag)
      super(self.class.version_number_from_tag(tag))
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
pantograph-0.1.22 pantograph_core/lib/pantograph_core/tag_version.rb
pantograph-0.1.21 pantograph_core/lib/pantograph_core/tag_version.rb
pantograph-0.1.20 pantograph_core/lib/pantograph_core/tag_version.rb
pantograph-0.1.19 pantograph_core/lib/pantograph_core/tag_version.rb
pantograph-0.1.17 pantograph_core/lib/pantograph_core/tag_version.rb
pantograph-0.1.16 pantograph_core/lib/pantograph_core/tag_version.rb
pantograph-0.1.15 pantograph_core/lib/pantograph_core/tag_version.rb
pantograph-0.1.14 pantograph_core/lib/pantograph_core/tag_version.rb
pantograph-0.1.13 pantograph_core/lib/pantograph_core/tag_version.rb
pantograph-0.1.12 pantograph_core/lib/pantograph_core/tag_version.rb
pantograph-0.1.10 pantograph_core/lib/pantograph_core/tag_version.rb
pantograph-0.1.8 pantograph_core/lib/pantograph_core/tag_version.rb
pantograph-0.1.7 pantograph_core/lib/pantograph_core/tag_version.rb
pantograph-0.1.6 pantograph_core/lib/pantograph_core/tag_version.rb
pantograph-0.1.4 pantograph_core/lib/pantograph_core/tag_version.rb
pantograph-0.1.3 pantograph_core/lib/pantograph_core/tag_version.rb
pantograph-0.1.1 pantograph_core/lib/pantograph_core/tag_version.rb
pantograph-0.1.0 pantograph_core/lib/pantograph_core/tag_version.rb