class SafePusher::Client::Github

Public Instance Methods

open() click to toggle source
# File lib/safe_pusher/client/github.rb, line 20
def open
  system(
    "open '#{SafePusher.configuration.repo_url}/pull/new/#{branch}'",
  )
end
push() click to toggle source
# File lib/safe_pusher/client/github.rb, line 4
def push
  system('git push origin')

  exit_status = $CHILD_STATUS.exitstatus

  if exit_status == 128
    puts 'Syncing with github...'.green

    push_and_set_upstream

    exit_status = $CHILD_STATUS.exitstatus
  end

  exit_status
end

Private Instance Methods

branch() click to toggle source
# File lib/safe_pusher/client/github.rb, line 32
def branch
  `git rev-parse --symbolic-full-name --abbrev-ref HEAD`.delete("\n")
end
push_and_set_upstream() click to toggle source
# File lib/safe_pusher/client/github.rb, line 28
def push_and_set_upstream
  system("git push --set-upstream origin #{branch}")
end