Sha256: ef8fe5f19e5f5d2c1ffb05633ad5eea26b8d362282d0e75101aa6855c0c79a91

Contents?: true

Size: 914 Bytes

Versions: 3

Compression:

Stored size: 914 Bytes

Contents

require 'concourse-fuselage'
require 'contracts'
require 'gems'
require_relative 'core'
require_relative 'gem_not_found'

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

3 entries across 3 versions & 1 rubygems

Version Path
concourse-resource-rubygems-0.4.6 lib/concourse-resource/rubygems/check.rb
concourse-resource-rubygems-0.4.5 lib/concourse-resource/rubygems/check.rb
concourse-resource-rubygems-0.3.4 lib/concourse-resource/rubygems/check.rb