     textVal t, loading
 )
 
+#adds new instances of cls to the array until index X is valid
+fillArray = (arr, index, cls) ->
+  num_insert = arr.length - index - 1
+  for i in [0..(num_insert - 1)]
+    arr.push(new cls({}))
+
+window.fillArray = fillArray
 
 # Make the buttons disabled when clicked
 $.ajaxSetup

      @build_num

  pusherChannel: () =>
    "private-#{@project_name()}/#{@build_num}"

  update: (json) =>
    @status(json.status)

  updateNode: (json) =>
    switch json.type
      when "add" then @nodes[json.index].addLog(json)
      when "update" then @nodes[json.index].updateLog(json)


class Project extends HasUrl
  constructor: (json) ->

    $.getJSON "/api/v1/project/#{project_name}/#{build_num}", (data) =>
      start_time = Date.now()
      @build(new Build data)

      window.time_taken_build = Date.now() - start_time

