Module: Integrity::Project::Push

Included in:
Integrity::Project
Defined in:
lib/integrity/project/push.rb

Instance Method Summary collapse

Instance Method Details

#push(payload) ⇒ Object

Raises:

  • (ArgumentError)


4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/integrity/project/push.rb', line 4

def push(payload)
  payload = parse_payload(payload)
  raise ArgumentError unless valid_payload?(payload)

  commits =
    if Integrity.config[:build_all_commits]
      payload["commits"]
    else
      [ payload["commits"].first ]
    end

  commits.each { |commit_data|
    commit = commit_from(commit_data)
    commit.create
    build(commit.identifier)
  }
end