Class: Nutella::Start

Inherits:
RunCommand show all
Defined in:
lib/commands/start.rb

Instance Method Summary collapse

Methods inherited from RunCommand

#compile_and_dependencies, #parse_cli_parameters, #parse_run_id_from, #print_success_message

Instance Method Details

#run(args = nil) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/commands/start.rb', line 8

def run(args=nil)

  # If the current directory is not a nutella application, return
  unless Nutella.current_app.exist?
    console.warn 'The current directory is not a nutella application'
    return
  end

  begin
    run_id, params = parse_cli_arguments args
  rescue StandardError => e
    console.error e.message
    return
  end

  app_id, app_path = fetch_app_details

  if no_app_bot_to_start app_id, app_path, params
    console.warn "Run #{run} not created: your application bots are already started and you specified no regular bots exclusively for this run"
    return
  end

  return if run_exist?( app_id, run_id)

  return unless start_all_components(app_id, app_path, run_id, params)

  return unless Nutella.runlist.add?(app_id, run_id, app_path)

  print_confirmation(run_id, params, app_id, app_path)
end