Sha256: b9758fe5233edda4a0a1d02ec7f259ab0286032c35d198cf653216bbd8fa4be7

Contents?: true

Size: 768 Bytes

Versions: 39

Compression:

Stored size: 768 Bytes

Contents

# frozen_string_literal: true

require "dry/monads"
require "refinements/pathnames"
require "rubygems/command_manager"

module Gemsmith
  module Tools
    # Builds a gem package for distribution.
    class Packager
      include Dry::Monads[:result]

      using Refinements::Pathnames

      def initialize command: Gem::CommandManager.new
        @command = command
      end

      # :reek:TooManyStatements
      def call specification
        command.run ["build", "#{specification.name}.gemspec"]
        specification.package_path.then { |path| path.make_ancestors.basename.copy path.parent }
        Success specification
      rescue Gem::Exception => error
        Failure error.message
      end

      private

      attr_reader :command
    end
  end
end

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
gemsmith-20.7.0 lib/gemsmith/tools/packager.rb
gemsmith-20.6.1 lib/gemsmith/tools/packager.rb
gemsmith-20.6.0 lib/gemsmith/tools/packager.rb
gemsmith-20.5.0 lib/gemsmith/tools/packager.rb
gemsmith-20.4.0 lib/gemsmith/tools/packager.rb
gemsmith-20.3.0 lib/gemsmith/tools/packager.rb
gemsmith-20.2.1 lib/gemsmith/tools/packager.rb
gemsmith-20.2.0 lib/gemsmith/tools/packager.rb
gemsmith-20.1.0 lib/gemsmith/tools/packager.rb
gemsmith-20.0.0 lib/gemsmith/tools/packager.rb
gemsmith-19.8.0 lib/gemsmith/tools/packager.rb
gemsmith-19.7.0 lib/gemsmith/tools/packager.rb
gemsmith-19.6.0 lib/gemsmith/tools/packager.rb
gemsmith-19.5.2 lib/gemsmith/tools/packager.rb
gemsmith-19.5.1 lib/gemsmith/tools/packager.rb
gemsmith-19.5.0 lib/gemsmith/tools/packager.rb
gemsmith-19.4.0 lib/gemsmith/tools/packager.rb
gemsmith-19.3.0 lib/gemsmith/tools/packager.rb
gemsmith-19.2.0 lib/gemsmith/tools/packager.rb
gemsmith-19.1.0 lib/gemsmith/tools/packager.rb