Module: Avm::Git::Issue::Complete::Push
- Defined in:
- lib/avm/git/issue/complete/push.rb
Instance Method Summary collapse
- #dry_push_args ⇒ Object
- #dry_push_result ⇒ Object
- #master_push ⇒ Object
- #push ⇒ Object
- #pushs_uncached ⇒ Object
- #remove_branch_push ⇒ Object
- #tag_push ⇒ Object
Instance Method Details
#dry_push_args ⇒ Object
8 9 10 |
# File 'lib/avm/git/issue/complete/push.rb', line 8 def dry_push_args %w[push --dry-run] + [remote_name] + pushs end |
#dry_push_result ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/avm/git/issue/complete/push.rb', line 12 def dry_push_result return ::Avm::Result.error('Nothing to push') if pushs.empty? r = @git.execute(dry_push_args) = if r.fetch(:exit_code).zero? 'ok' else r.fetch(:stderr) + "\n#{::Shellwords.join(dry_push_args)}" end ::Avm::Result.success_or_error(r.fetch(:exit_code).zero?, ) end |
#master_push ⇒ Object
37 38 39 |
# File 'lib/avm/git/issue/complete/push.rb', line 37 def master_push remote_master_hash != branch_hash ? "#{branch_hash}:refs/heads/master" : nil end |
#push ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/avm/git/issue/complete/push.rb', line 24 def push if pushs.empty? info 'PUSH: Nada a enviar' else info "PUSH: enviando \"#{pushs}\"..." git(%w[push origin] + pushs) end end |
#pushs_uncached ⇒ Object
33 34 35 |
# File 'lib/avm/git/issue/complete/push.rb', line 33 def pushs_uncached [master_push, remove_branch_push, tag_push].reject(&:nil?) end |
#remove_branch_push ⇒ Object
41 42 43 |
# File 'lib/avm/git/issue/complete/push.rb', line 41 def remove_branch_push remote_branch_hash ? ":refs/heads/#{branch}" : nil end |
#tag_push ⇒ Object
45 46 47 48 49 |
# File 'lib/avm/git/issue/complete/push.rb', line 45 def tag_push return nil unless !remote_tag_hash || remote_tag_hash != branch_hash "#{branch_hash}:#{tag}" end |