30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
# File 'lib/routes/git_push.rb', line 30
def git_push
@git.check_for_same_branch(Brightpearl::Git::SAME_BRANCH_WARNING)
branch_code = @git.current_branch_for_repo(Brightpearl::Config.param(Brightpearl::Config::WORKSTATION_PATH_TO_BP_CODE))
branch_db = @git.current_branch_for_repo(Brightpearl::Config.param(Brightpearl::Config::WORKSTATION_PATH_TO_BP_DB))
if Brightpearl::Terminal::prompt_yes_no("#{Brightpearl::Terminal::format_action('push')} the following repos:", [
"#{Brightpearl::Terminal::format_directory(@git.get_repo_shorthand(Brightpearl::Config.param(Brightpearl::Config::WORKSTATION_PATH_TO_BP_CODE)))} will push #{Brightpearl::Terminal::format_branch(branch_code)} \xe2\x86\x92 #{Brightpearl::Terminal::format_branch("origin/#{branch_code}")}",
"#{Brightpearl::Terminal::format_directory(@git.get_repo_shorthand(Brightpearl::Config.param(Brightpearl::Config::WORKSTATION_PATH_TO_BP_DB)))} will push #{Brightpearl::Terminal::format_branch(branch_db)} \xe2\x86\x92 #{Brightpearl::Terminal::format_branch("origin/#{branch_db}")}"
])
@git.check_for_uncommitted_files(true)
@git.repo_loop.each do |repo_dir|
unless Brightpearl::Terminal::command_capture("git push origin #{@git.current_branch_for_repo(repo_dir)}", repo_dir)
Brightpearl::Terminal::warning('Something went wrong', "Not sure what the reason was, but doing a #{Brightpearl::Terminal::format_command('git push')} on #{Brightpearl::Terminal::format_directory(@git.get_repo_shorthand(repo_dir))} was unsuccessful.")
end
end
@git.check_for_stash(true)
end
end
|