class LearnTest::Dependency

Attributes

options[R]

Public Class Methods

new(options = {}) click to toggle source
# File lib/learn_test/dependency.rb, line 7
def initialize(options = {})
  @options = options
end

Public Instance Methods

die(message) click to toggle source
# File lib/learn_test/dependency.rb, line 21
def die(message); end
execute() click to toggle source
# File lib/learn_test/dependency.rb, line 11
def execute
  install if missing?
end
install() click to toggle source
# File lib/learn_test/dependency.rb, line 19
def install; end
mac?() click to toggle source
# File lib/learn_test/dependency.rb, line 23
def mac?
  !!RUBY_PLATFORM.match(/darwin/)
end
missing?() click to toggle source
# File lib/learn_test/dependency.rb, line 15
def missing?
  false
end
print_installing(name) click to toggle source
run_install(command) click to toggle source
# File lib/learn_test/dependency.rb, line 35
def run_install(command)
  Open3.popen3(command) do |stdin, stdout, stderr, wait_thr|
    while out = stdout.gets do
      puts out
    end

    while err = stderr.gets do
      puts err
    end

    if wait_thr.value.exitstatus != 0
      die("There was an error running #{command}")
    end
  end
end
win?() click to toggle source
# File lib/learn_test/dependency.rb, line 27
def win?
  !!RUBY_PLATFORM.match(/mswin|mingw|cygwin/)
end