Module: CLI::Start

Defined in:
lib/robot_sweatshop/cli/start.rb

Overview

Methods for starting Robot Sweatshop

Class Method Summary collapse

Class Method Details

.generate_eye_configObject



23
24
25
26
27
28
29
30
31
32
# File 'lib/robot_sweatshop/cli/start.rb', line 23

def self.generate_eye_config
  template = File.read "#{__dir__}/robot_sweatshop.eye.erb"
  eruby = Erubis::Eruby.new template
  compiled_config = eruby.result worker_count: configatron.worker_count
  compiled_config_file = File.expand_path '~/.robot_sweatshop/robot_sweatshop.eye'
  File.open compiled_config_file, 'w' do |file|
    file.write compiled_config
    file.path
  end
end

.load_eye_configObject



15
16
17
18
19
20
21
# File 'lib/robot_sweatshop/cli/start.rb', line 15

def self.load_eye_config
  Config.compile_to_file
  output = `eye load #{generate_eye_config}`
  fail output if $?.exitstatus != 0
  Announce.success "Robot Sweatshop loaded"
  Announce.info 'Run \'eye --help\' for more info on debugging'
end

.sweatshopObject



9
10
11
12
13
# File 'lib/robot_sweatshop/cli/start.rb', line 9

def self.sweatshop
  Announce.info `eye stop robot_sweatshop:workers`
  load_eye_config
  Announce.info `eye restart robot_sweatshop`
end