Class: GithubIssuesCli::Command::Open
- Inherits:
-
GithubIssuesCli::Command
- Object
- Clamp::Command
- GithubIssuesCli::Command
- GithubIssuesCli::Command::Open
- Defined in:
- lib/github_issues_cli/command/open.rb
Instance Attribute Summary
Attributes inherited from GithubIssuesCli::Command
Instance Method Summary collapse
Methods inherited from GithubIssuesCli::Command
#authenticate, #get_git_push_target, #get_git_repo, #get_issue_number, #get_pullrequest, #get_source_branch, #get_upstream_repo, #initialize, #run
Constructor Details
This class inherits a constructor from GithubIssuesCli::Command
Instance Method Details
#execute ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/github_issues_cli/command/open.rb', line 6 def execute github_repo = get_upstream_repo issue = Github::Issues.new.create :user => github_repo[:user], :repo => github_repo[:name], :title => summary issue_number = issue[:number].to_s get_upstream_repo git_repo = get_git_repo git_repo.remote('upstream').fetch remote_name = 'origin' branch_name = 'issue-' + issue_number git_repo.lib.command_proxy('checkout', ['-b', branch_name, 'upstream/master']) git_repo.lib.command_proxy('config', ["branch.#{branch_name}.remote", remote_name]) git_repo.lib.command_proxy('config', ["branch.#{branch_name}.merge", "refs/heads/#{branch_name}"]) print on_green ' ' print ' Checked out ' puts bold '#' + issue_number end |