class Replr::Boot

Starts up REPL creation & wires up rest of the pieces

Attributes

argument_processor[R]
process_runner[R]

Public Instance Methods

start() click to toggle source
# File lib/replr/boot.rb, line 13
def start
  @argument_processor = Replr::ArgumentProcessor.new
  @process_runner = Replr::ProcessRunner.new

  check_docker!
  execute_processsed_arguments!
end

Private Instance Methods

check_docker!() click to toggle source
# File lib/replr/boot.rb, line 23
def check_docker!
  unless process_runner.process_exists?('docker')
    puts_error 'Needs docker installed & in path to work.'
    exit
  end
end
execute_processsed_arguments!() click to toggle source
# File lib/replr/boot.rb, line 30
def execute_processsed_arguments!
  if argument_processor.command == 'prune'
    execute_prune_command
  elsif argument_processor.stack
    Replr::Stack::REPLMaker.load(stack: argument_processor.stack,
                                 libraries: argument_processor.libraries)
  end
end
execute_prune_command() click to toggle source
# File lib/replr/boot.rb, line 39
def execute_prune_command
  prune_command = %q(docker images -a |  grep "replr/" | awk '{print $3}' | xargs docker rmi)
  process_runner.execute_command(prune_command)
end
puts_error(string) click to toggle source
# File lib/replr/boot.rb, line 44
def puts_error(string)
  STDERR.puts(string)
end