Sha256: dac65df1dee9e4cf625c7fe3636ce606a438c89f9121a62623b276ada2b92939

Contents?: true

Size: 1.25 KB

Versions: 2

Compression:

Stored size: 1.25 KB

Contents

# frozen_string_literal: true

require "forwardable"
require "pathname"
require "refinements/arrays"
require "versionaire"

module Gemsmith
  module Gems
    # Provides a gem specification that is more useful than what is provided Ruby Gems.
    class Presenter
      extend Forwardable

      using Refinements::Arrays
      using Versionaire::Cast

      delegate %i[metadata name summary] => :record

      def initialize record
        warn "[DEPRECATION]: Presenter is deprecated, use Spek gem instead."

        @record = record
      end

      def allowed_push_key = metadata.fetch "allowed_push_key", "rubygems_api_key"

      def allowed_push_host = metadata.fetch "allowed_push_host", ::Gem::DEFAULT_HOST

      def homepage_url = String record.homepage

      def label = metadata.fetch "label", "Undefined"

      def labeled_summary(delimiter: " - ") = [label, summary].compress.join delimiter

      def labeled_version = "#{label} #{version}"

      def named_version = "#{name} #{version}"

      def package_path = Pathname("tmp").join package_name

      def package_name = "#{name}-#{version}.gem"

      def source_path = Pathname record.full_gem_path

      def version = Version record.version.to_s

      private

      attr_reader :record
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gemsmith-16.2.0 lib/gemsmith/gems/presenter.rb
gemsmith-16.1.0 lib/gemsmith/gems/presenter.rb