noflo = require 'noflo'

exports.getComponent = ->
  c = new noflo.Component
  c.inPorts.add 'in',
    datatype: 'string'
  c.inPorts.add 'repo',
    datatype: 'string'
  c.inPorts.add 'path',
    datatype: 'string'
    
  c.outPorts.add 'out',
    datatype: 'object'
  
  noflo.helpers.WirePattern c,
    in: ['in', 'repo', 'path']
    out: 'out'
    async: true
    forwardGroups: true
  , (data, groups, out, callback) ->
    job =
      operation: 'push'
      path: data.path
      repo: data.repo
      branch: 'master'
      content: data.in
      message: 'Latest import'
    out.send job
    do callback
    
  c
