Sha256: fa5778f4f664247458d98d8f9c5b73c25814c2020ec5e5a7cb27ecc38b11c19c

Contents?: true

Size: 587 Bytes

Versions: 31

Compression:

Stored size: 587 Bytes

Contents

# frozen_string_literal: true

module Groundskeeper
  # Class to execute commands for other classes
  class Executable
    attr_reader :command

    @verbose = false

    class << self
      attr_writer :verbose
    end

    class << self
      attr_reader :verbose
    end

    def initialize(command)
      if `which #{command}`.empty?
        raise "#{command} not found, is it installed on your PATH?"
      end

      @command = command
    end

    def execute(arguments)
      puts "#{command} #{arguments}" if self.class.verbose
      `#{command} #{arguments}`
    end
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
groundskeeper-bitcore-0.35.0 lib/groundskeeper/executable.rb
groundskeeper-bitcore-0.34.0 lib/groundskeeper/executable.rb
groundskeeper-bitcore-0.33.0 lib/groundskeeper/executable.rb
groundskeeper-bitcore-0.32.0 lib/groundskeeper/executable.rb
groundskeeper-bitcore-0.31.0 lib/groundskeeper/executable.rb
groundskeeper-bitcore-0.29.0 lib/groundskeeper/executable.rb
groundskeeper-bitcore-0.28.0 lib/groundskeeper/executable.rb
groundskeeper-bitcore-0.27.0 lib/groundskeeper/executable.rb
groundskeeper-bitcore-0.26.0 lib/groundskeeper/executable.rb
groundskeeper-bitcore-0.24.0 lib/groundskeeper/executable.rb
groundskeeper-bitcore-0.23.0 lib/groundskeeper/executable.rb
groundskeeper-bitcore-0.22.0 lib/groundskeeper/executable.rb
groundskeeper-bitcore-0.21.0 lib/groundskeeper/executable.rb
groundskeeper-bitcore-0.20.1 lib/groundskeeper/executable.rb
groundskeeper-bitcore-0.19.0 lib/groundskeeper/executable.rb
groundskeeper-bitcore-0.18.0 lib/groundskeeper/executable.rb
groundskeeper-bitcore-0.17.0 lib/groundskeeper/executable.rb
groundskeeper-bitcore-0.16.0 lib/groundskeeper/executable.rb
groundskeeper-bitcore-0.15.0 lib/groundskeeper/executable.rb
groundskeeper-bitcore-0.14.0 lib/groundskeeper/executable.rb