class Startling::Commands::CreatePullRequest

Public Instance Methods

create_branch() click to toggle source
# File lib/startling/commands/create_pull_request.rb, line 12
def create_branch
  @branch_name ||= CreateBranch.run(args: args, git: git)
end
execute() click to toggle source
# File lib/startling/commands/create_pull_request.rb, line 7
def execute
  create_branch
  open_pull_request
end
open_pull_request() click to toggle source
# File lib/startling/commands/create_pull_request.rb, line 16
def open_pull_request
  logger.info "Opening pull request..."

  if git.current_branch_has_no_commits?
    git.create_empty_commit(pull_request_handler.commit_message)
  end

  git.push_origin_head

  pull_request = repo.open_pull_request title: pull_request_handler.title,
    body: pull_request_handler.body, branch: @branch_name

  logger.info pull_request.url if pull_request

  pull_request
end
pull_request_handler() click to toggle source
# File lib/startling/commands/create_pull_request.rb, line 37
def pull_request_handler
  handler_name = Startling.pull_request_handler || :default_pull_request_handler
  handler_class(handler_name).new(cli_options)
end
repo() click to toggle source
# File lib/startling/commands/create_pull_request.rb, line 33
def repo
  @repo ||= Github.repo(git.repo_name)
end