Sha256: 21bcf3d5fc79b3beb8f203cb695204695b8734fde62f199bbc265868e971f5ba

Contents?: true

Size: 952 Bytes

Versions: 2

Compression:

Stored size: 952 Bytes

Contents

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

module ConcourseResource
  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| { 'number' => 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
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
concourse-resource-rubygems-0.3.3 lib/concourse-resource/rubygems/check.rb
concourse-resource-rubygems-0.3.2 lib/concourse-resource/rubygems/check.rb