hybridgroup/artoo

View on GitHub
bin/robi

Summary

Maintainability
Test Coverage
#!/usr/bin/env ruby
require 'pry'

Pry.config.prompt = proc { "robi> " }

command_set = Pry::CommandSet.new do
  block_command "start", "Start all robots working" do
    if defined?(Artoo::MainRobot)
      output.puts "Starting main robot..."
      Artoo::MainRobot.work! unless Artoo::MainRobot.is_running?
    else
      output.puts "Starting robots..."
    end

    Artoo::Master.start_work
  end

  block_command "pause", "Pause all robots" do
    output.puts "Pausing robots..."
    Artoo::Master.pause_work
  end

  block_command "continue", "Continue all robots" do
    output.puts "Continuing robots..."
    Artoo::Master.continue_work
  end

  block_command "stop", "Stop all robots" do
    output.puts "Stopping robots..."
    Artoo::Master.stop_work
  end

  block_command "list", "List all robots" do
    output.puts Artoo::Master.robots
  end
end

Pry::Commands.import command_set

ENV["ARTOO_CLI"] = 'true'
require ARGV[0]
Pry.start