Sha256: 6830a5d441ee31eba41d223df126b2137c3be5c1825a16d26fd011ec04edfc07

Contents?: true

Size: 828 Bytes

Versions: 3

Compression:

Stored size: 828 Bytes

Contents

require 'contracts'
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

3 entries across 3 versions & 1 rubygems

Version Path
concourse-resource-rubygems-0.1.2 lib/concourse-resource/rubygems/check.rb
concourse-resource-rubygems-0.1.1 lib/concourse-resource/rubygems/check.rb
concourse-resource-rubygems-0.1.0 lib/concourse-resource/rubygems/check.rb