Sha256: 40130d1e0b284b248933ef441536e1feeda1b2c879e438c9fd10edd61aaa628a

Contents?: true

Size: 936 Bytes

Versions: 2

Compression:

Stored size: 936 Bytes

Contents

require 'contracts'
require 'concourse-fuselage'
require 'concourse-resource/rubygems/core'
require 'concourse-resource/rubygems/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| { '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
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
concourse-resource-rubygems-0.1.6 lib/concourse-resource/rubygems/check.rb
concourse-resource-rubygems-0.1.5 lib/concourse-resource/rubygems/check.rb