Class: Jackal::Stacks::Formatter::Github

Inherits:
Formatter
  • Object
show all
Defined in:
lib/jackal-stacks/formatter/github.rb

Overview

Format github data for stacks

Constant Summary collapse

SOURCE =

Source service

:github
DESTINATION =

Destination service

:stacks
VALID_EVENTS =

Valid github events

%w(create delete push)

Instance Method Summary collapse

Instance Method Details

#format(payload) ⇒ Object

Format payload

Parameters:

  • payload (Smash)


20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/jackal-stacks/formatter/github.rb', line 20

def format(payload)
  if(VALID_EVENTS.include?(payload.get(:data, :github, :event)))
    if(payload.get(:data, :github, :query, :template))
      payload.set(:data, :stacks, :template,
        payload.get(:data, :github, :query, :template)
      )
    end
    if(payload.get(:data, :github, :event) == 'delete')
      payload.set(:data, :stacks, :wrecker, true)
    else
      payload.set(:data, :stacks, :builder, true)
    end
  end
end