class Semverve::PublishedVersion
Checks whether the current gem version already exists on a RubyGems-compatible host.
Attributes
Callable used to fetch RubyGems-compatible API responses.
@return [#call]
Public Class Methods
Source
# File lib/semverve/published_version.rb, line 26 def http_getter @http_getter ||= ->(uri) { Net::HTTP.get_response(uri) } end
Returns the HTTP response fetcher.
@return [#call]
# File lib/semverve/published_version.rb, line 38 def initialize(configuration, current_version) @configuration = configuration @current_version = current_version end
Initializes a published-version check.
@param [Semverve::ResolvedConfiguration] configuration @param [Semverve::SemanticVersion] current_version
@return [Semverve::PublishedVersion]
Public Instance Methods
Source
# File lib/semverve/published_version.rb, line 55 def check if published? raise Error, "#{configuration.gem_name} #{current_version} already exists on #{configuration.rubygems_host}." end end
Raises if the current version already exists.
@return [void]
Source
# File lib/semverve/published_version.rb, line 47 def published? versions.any? { |version| version.fetch("number", nil).to_s == current_version.to_s } end
Whether the current version already exists on the configured host.
@return [Boolean]