Sha256: d7b3476e059bb1c4b82e75067152faec1ea14b8c292e3ac6d5ccf5d83ea9b988

Contents?: true

Size: 649 Bytes

Versions: 5

Compression:

Stored size: 649 Bytes

Contents

# frozen_string_literal: true

require "dry/monads"

module Gemsmith
  module Tools
    # Edits a gem within default editor.
    class Editor
      include Dry::Monads[:result]

      def initialize container: Container
        @container = container
      end

      def call specification
        executor.capture3(client, specification.source_path.to_s).then do |_stdout, stderr, status|
          status.success? ? Success(specification) : Failure(stderr)
        end
      end

      private

      attr_reader :container

      def executor = container[__method__]

      def client = container[:environment].fetch("EDITOR")
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

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