Method: CollinsShell::Util#asset_exec

Defined in:
lib/collins_shell/util.rb

#asset_exec(asset, execs, confirm = true, threads = 1) ⇒ Object



54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/collins_shell/util.rb', line 54

def asset_exec asset, execs, confirm = true, threads = 1
  return unless execs
  mustache = CollinsShell::Util::AssetStache.new asset
  rendered = mustache.render "/bin/bash -c '#{execs}'"
  say_status("exec", rendered, :red)
  require_yes("Running on #{asset.tag}. ARE YOU SURE?", :red) if confirm
  if threads < 2 then
    system(rendered)
  else
    run_command_in_thread(rendered, threads)
  end
end