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-19.0.0 lib/gemsmith/tools/packager.rb
gemsmith-18.9.0 lib/gemsmith/tools/packager.rb
gemsmith-18.8.0 lib/gemsmith/tools/packager.rb
gemsmith-18.7.0 lib/gemsmith/tools/packager.rb
gemsmith-18.6.0 lib/gemsmith/tools/packager.rb
gemsmith-18.5.0 lib/gemsmith/tools/packager.rb
gemsmith-18.4.0 lib/gemsmith/tools/packager.rb
gemsmith-18.3.0 lib/gemsmith/tools/packager.rb
gemsmith-18.2.0 lib/gemsmith/tools/packager.rb
gemsmith-18.1.1 lib/gemsmith/tools/packager.rb
gemsmith-18.1.0 lib/gemsmith/tools/packager.rb
gemsmith-18.0.2 lib/gemsmith/tools/packager.rb
gemsmith-18.0.1 lib/gemsmith/tools/packager.rb
gemsmith-18.0.0 lib/gemsmith/tools/packager.rb
gemsmith-17.0.1 lib/gemsmith/tools/packager.rb
gemsmith-17.0.0 lib/gemsmith/tools/packager.rb
gemsmith-16.2.0 lib/gemsmith/tools/packager.rb
gemsmith-16.1.0 lib/gemsmith/tools/packager.rb
gemsmith-16.0.0 lib/gemsmith/tools/packager.rb