Sha256: fbf851c3af0568b4efbe8f08fe606bc5792007a5863ed70755d59610a617e961

Contents?: true

Size: 857 Bytes

Versions: 2

Compression:

Stored size: 857 Bytes

Contents

require 'contracts'
require 'concourse-fuselage'
require 'concourse-resource/rubygems/core'
require 'concourse-resource/rubygems/gem_not_found'

module RubyGems
  # Check Step
  class Check < Fuselage::Check
    include Core

    Contract None => ArrayOf[HashOf[String, String]]
    def versions
      Gems
        .versions(gem)
        .tap { |response| raise GemNotFound, response if response.is_a? String }
        .sort_by { |version| version['created_at'] }
        .map { |version| { 'version' => version.fetch('number') } }
    rescue GemNotFound => message
      STDERR.puts message
      abort
    end

    Contract None => HashOf[String, String]
    def latest
      versions.last
    end

    Contract HashOf[String, String] => ArrayOf[HashOf[String, String]]
    def since(version)
      versions[versions.index(version)..-1]
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
concourse-resource-rubygems-0.1.4 lib/concourse-resource/rubygems/check.rb
concourse-resource-rubygems-0.1.3 lib/concourse-resource/rubygems/check.rb