Class: GithubIssuesCli::Command::Open

Inherits:
GithubIssuesCli::Command show all
Defined in:
lib/github_issues_cli/command/open.rb

Instance Attribute Summary

Attributes inherited from GithubIssuesCli::Command

#git_repo, #username

Instance Method Summary collapse

Methods inherited from GithubIssuesCli::Command

#authenticate, #get_git_repo, #get_github_repo, #get_issue_number, #get_source, #initialize, #run

Constructor Details

This class inherits a constructor from GithubIssuesCli::Command

Instance Method Details

#executeObject


6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/github_issues_cli/command/open.rb', line 6

def execute
  github_repo = get_github_repo
  issue = Github::Issues.new.create :user => github_repo[:user], :repo => github_repo[:name], :title => summary
  issue_number = issue[:number].to_s

  get_github_repo
  git_repo = get_git_repo
  git_repo.remote('upstream').fetch
  git_repo.lib.checkout 'upstream/master', :new_branch => 'issue-' + issue_number
  print on_green ' '
  print ' Checked out '
  puts bold '#' + issue_number
end