class GithubTools::CLI

Public Instance Methods

open_pull_request(id) click to toggle source
# File lib/github_tools/cli.rb, line 10
def open_pull_request(id)
  status = silent_run 'git status --porcelain 2>/dev/null'
  raise Thor::Error.new('You have uncommitted changes') unless status.empty?
  ENV['EDITOR'] = ask("Enter your text editor command:\n") if ENV['EDITOR'].nil?

  pull_files = GithubTools.client.pull_files(Configuration.remote, id)
  filenames = pull_files.collect(&:filename)
  silent_run "git fetch origin pull/#{id}/head:"
  run 'git checkout FETCH_HEAD', :verbose => false
  silent_run "#{ENV['EDITOR']} #{filenames.join(' ')}"
end

Private Instance Methods

silent_run(cmd) click to toggle source
# File lib/github_tools/cli.rb, line 24
def silent_run(cmd)
  run(cmd, :verbose => false, :capture => true)
end