Sha256: 45bdbe96cede10a7cec1f47e35d3bdd06a2b82d4252e782195a7d6507b1753ec

Contents?: true

Size: 766 Bytes

Versions: 21

Compression:

Stored size: 766 Bytes

Contents

# frozen_string_literal: true

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

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

      using Refinements::Pathname

      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

21 entries across 21 versions & 1 rubygems

Version Path
gemsmith-22.10.0 lib/gemsmith/tools/packager.rb
gemsmith-22.9.0 lib/gemsmith/tools/packager.rb
gemsmith-22.8.0 lib/gemsmith/tools/packager.rb
gemsmith-22.7.0 lib/gemsmith/tools/packager.rb
gemsmith-22.6.0 lib/gemsmith/tools/packager.rb
gemsmith-22.5.0 lib/gemsmith/tools/packager.rb
gemsmith-22.4.0 lib/gemsmith/tools/packager.rb
gemsmith-22.3.0 lib/gemsmith/tools/packager.rb
gemsmith-22.2.0 lib/gemsmith/tools/packager.rb
gemsmith-22.1.0 lib/gemsmith/tools/packager.rb
gemsmith-22.0.0 lib/gemsmith/tools/packager.rb
gemsmith-21.10.0 lib/gemsmith/tools/packager.rb
gemsmith-21.9.0 lib/gemsmith/tools/packager.rb
gemsmith-21.6.0 lib/gemsmith/tools/packager.rb
gemsmith-21.5.1 lib/gemsmith/tools/packager.rb
gemsmith-21.5.0 lib/gemsmith/tools/packager.rb
gemsmith-21.4.0 lib/gemsmith/tools/packager.rb
gemsmith-21.3.0 lib/gemsmith/tools/packager.rb
gemsmith-21.2.0 lib/gemsmith/tools/packager.rb
gemsmith-21.1.0 lib/gemsmith/tools/packager.rb