Sha256: 5ffe87a9c66b5e86c5bc8030a02c4d2015159b8eb639fee721bcf914ebc746ca

Contents?: true

Size: 707 Bytes

Versions: 2

Compression:

Stored size: 707 Bytes

Contents

module YSI
  class PublishedGem < Assertion
    needs "built_gem"

    def display_name
      "published gem"
    end

    def gem_file
      "#{@engine.project_name}-#{@engine.version}.gem"
    end

    def check
      begin
        json = RestClient.get("https://rubygems.org/api/v1/versions/#{engine.project_name}.json")
      rescue RestClient::ResourceNotFound
        return nil
      end
      versions = JSON.parse(json)
      versions.each do |version|
        if version["number"] == @engine.version
          return @engine.version
        end
      end
      nil
    end

    def assert(dry_run: false)
      if !dry_run
        `gem push #{gem_file}`
      end
      gem_file
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
yes_ship_it-0.0.4 assertions/published_gem.rb
yes_ship_it-0.0.3 assertions/published_gem.rb