class OctoMerge::Strategy::Base

Attributes

pull_requests[R]
working_directory[R]

Public Class Methods

new(working_directory:, pull_requests:) click to toggle source
# File lib/octo_merge/strategy/base.rb, line 10
def initialize(working_directory:, pull_requests:)
  @working_directory = working_directory
  @pull_requests = pull_requests
end
run(*args) click to toggle source
# File lib/octo_merge/strategy/base.rb, line 15
def self.run(*args)
  new(*args).tap { |strategy| strategy.run }
end

Public Instance Methods

run() click to toggle source
# File lib/octo_merge/strategy/base.rb, line 19
def run
  fail NotImplementedError
end

Private Instance Methods

fetch(pull_request) click to toggle source

Fetch the read-only branch for the corresponding pull request and create a local branch to rebase the current master on.

Read more: [Checking out pull requests locally](help.github.com/articles/checking-out-pull-requests-locally/)

# File lib/octo_merge/strategy/base.rb, line 33
def fetch(pull_request)
  git.fetch "#{upstream} #{pull_request.number_branch}/head:#{pull_request.number_branch} --force"
end
fetch_master() click to toggle source
# File lib/octo_merge/strategy/base.rb, line 37
def fetch_master
  git.checkout(master)
  git.fetch(upstream)
  git.reset_hard("#{upstream}/#{master}")
end
git() click to toggle source
# File lib/octo_merge/strategy/base.rb, line 25
def git
  @git ||= Git.new(working_directory)
end
master() click to toggle source
# File lib/octo_merge/strategy/base.rb, line 48
def master
  :master
end
upstream() click to toggle source
# File lib/octo_merge/strategy/base.rb, line 44
def upstream
  :upstream
end