Sha256: 7e419b90e3591566e26a35629690caea8b43572b2bbd71afbb66e371d6829dca

Contents?: true

Size: 761 Bytes

Versions: 15

Compression:

Stored size: 761 Bytes

Contents

module Mutant
  class Reporter
    class CLI
      # Interface to the optionally present tput binary
      class Tput
        include Adamantium, Concord::Public.new(:available, :prepare, :restore)

        private_class_method :new

        capture = lambda do |command|
          stdout, _stderr, exitstatus = Open3.capture3(command)
          stdout if exitstatus.success?
        end

        reset   = capture.('tput reset')
        save    = capture.('tput sc') if reset
        restore = capture.('tput rc') if save
        clean   = capture.('tput ed') if restore

        UNAVAILABLE = new(false, nil, nil)

        INSTANCE = clean ? new(true, reset + save, restore + clean) : UNAVAILABLE

      end # TPUT
    end # CLI
  end # Reporter
end # Mutant

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
mutant-0.7.8 lib/mutant/reporter/cli/tput.rb
mutant-0.7.7 lib/mutant/reporter/cli/tput.rb
mutant-0.7.6 lib/mutant/reporter/cli/tput.rb
mutant-0.7.5 lib/mutant/reporter/cli/tput.rb
mutant-0.7.4 lib/mutant/reporter/cli/tput.rb
mutant-0.7.3 lib/mutant/reporter/cli/tput.rb
mutant-0.7.2 lib/mutant/reporter/cli/tput.rb
mutant-0.7.1 lib/mutant/reporter/cli/tput.rb
mutant-0.6.7 lib/mutant/reporter/cli/tput.rb
mutant-0.6.6 lib/mutant/reporter/cli/tput.rb
mutant-0.6.5 lib/mutant/reporter/cli/tput.rb
mutant-0.6.4 lib/mutant/reporter/cli/tput.rb
mutant-0.6.3 lib/mutant/reporter/cli/tput.rb
mutant-0.6.2 lib/mutant/reporter/cli/tput.rb
mutant-0.6.0 lib/mutant/reporter/cli/tput.rb