Sha256: 6c9149aedc52922f050650fa6e45c4ca2e757065df0bc58fc4524141e3862020

Contents?: true

Size: 627 Bytes

Versions: 5

Compression:

Stored size: 627 Bytes

Contents

# frozen_string_literal: true

require "dry/monads"

module Gemsmith
  module Tools
    # Validates whether a gem can be published or not.
    class Validator
      include Dry::Monads[:result]

      def initialize container: Container
        @container = container
      end

      def call specification
        executor.capture3("git", "status", "--porcelain").then do |_stdout, _stderr, status|
          status.success? ? Success(specification) : Failure("Project has uncommitted changes.")
        end
      end

      private

      attr_reader :container

      def executor = container[__method__]
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
gemsmith-17.0.1 lib/gemsmith/tools/validator.rb
gemsmith-17.0.0 lib/gemsmith/tools/validator.rb
gemsmith-16.2.0 lib/gemsmith/tools/validator.rb
gemsmith-16.1.0 lib/gemsmith/tools/validator.rb
gemsmith-16.0.0 lib/gemsmith/tools/validator.rb