class Cp8Cli::Story

Public Instance Methods

start() click to toggle source
# File lib/cp8_cli/story.rb, line 5
def start
  checkout_branch
  create_empty_commit
  push_branch
  create_draft_pull_request
  assign
  Command.title "Created draft PR, run `cp8 open` to view."
end

Private Instance Methods

branch() click to toggle source
# File lib/cp8_cli/story.rb, line 44
def branch
  @_branch ||= Branch.new(branch_name)
end
branch_name() click to toggle source
# File lib/cp8_cli/story.rb, line 48
def branch_name
  BranchName.new(user: user, story: self).to_s
end
checkout_branch() click to toggle source
# File lib/cp8_cli/story.rb, line 16
def checkout_branch
  branch.checkout
end
commit_message() click to toggle source
# File lib/cp8_cli/story.rb, line 24
def commit_message
  escaped_title
end
create_draft_pull_request() click to toggle source
# File lib/cp8_cli/story.rb, line 36
def create_draft_pull_request
  Github::PullRequest.create(
    from: branch.name,
    title: PullRequestTitle.new(title).run,
    body: PullRequestBody.new(self).run
  )
end
create_empty_commit() click to toggle source
# File lib/cp8_cli/story.rb, line 20
def create_empty_commit
  Command.run "git commit --allow-empty -m#{commit_message}", title: "Creating initial commit"
end
escaped_title() click to toggle source
# File lib/cp8_cli/story.rb, line 28
def escaped_title
  Shellwords.escape(title)
end
push_branch() click to toggle source
# File lib/cp8_cli/story.rb, line 32
def push_branch
  branch.push
end
user() click to toggle source
# File lib/cp8_cli/story.rb, line 52
def user
  @_user ||= CurrentUser.new
end