Class: FightClub::Arena

Inherits:
Object
  • Object
show all
Defined in:
lib/fight_club/arena.rb

Instance Method Summary collapse

Constructor Details

#initialize(base_pull, config = FightClub.config) ⇒ Arena

Returns a new instance of Arena.



13
14
15
# File 'lib/fight_club/arena.rb', line 13

def initialize(base_pull, config = FightClub.config)
  @base_pull = base_pull
end

Instance Method Details

#startObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/fight_club/arena.rb', line 17

def start
  Repository.new.update(FightClub.config.uri, FightClub.config.repo_name)

  git.checkout("origin/#{base_pull["head"]["ref"]}")

  return unless base_pull["base"]["ref"] == FightClub.config.master_branch

  return unless Rebaser.attempt_rebase(base_pull)

  git.reset_hard("origin/#{base_pull["head"]["ref"]}")

  pull_requests = client.pull_requests(FightClub.config.repo, :per_page => 200)

  pull_requests.each do |pr|
    Merger.new(base_pull, pr, git).execute
  end

  true
end