Method: Negroku::Modes::App#select_repo

Defined in:
lib/negroku/modes/app.rb

#select_repoObject

Get git remotes from current git and ask to select one



93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/negroku/modes/app.rb', line 93

def select_repo
  remote_urls = %x(git remote -v 2> /dev/null | awk '{print $2}' | uniq).split("\n")
  remote_urls << (I18n.t :other, scope: :negroku)

  question = I18n.t :choose_repo_url, scope: :negroku
  selected_idx = Ask.list question, remote_urls

  if selected_idx == remote_urls.length - 1
    question = I18n.t :type_repo_url, scope: :negroku
    Ask.input question
  else remote_urls[selected_idx] end
end