Sha256: 8a68e8db3400650748383f59bf9248a788d47e8958e73302bd38afa120f07f34
Contents?: true
Size: 847 Bytes
Versions: 7
Compression:
Stored size: 847 Bytes
Contents
require_relative 'container/fake' require 'open3' module LintTrap # Wraps the execution of linter commands class Command attr_reader :binary def initialize(binary, flags, files) @binary = binary @flags = flags @files = files end def run(container) Bundler.with_clean_env do Open3.popen2e(command(container)) do |_, stdout, thread| yield stdout if block_given? thread.value.success? end end end def command(container = LintTrap::Container::Fake.new) container.wrap("#{binary} #{flags} #{files(container)}") end alias_method :to_s, :command def files(container = LintTrap::Container::Fake.new) Shellwords.join(@files.map{|file| container.container_path(file)}) end def flags @flags.join(' ') end end end
Version data entries
7 entries across 7 versions & 1 rubygems