Class: Git::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/vcpkg_pipeline/extension/git_vpl.rb

Overview

Git::Base

Instance Method Summary collapse

Instance Method Details

#current_branchObject



10
11
12
# File 'lib/vcpkg_pipeline/extension/git_vpl.rb', line 10

def current_branch
  branches.current.first
end

#quick_push(new_tag = nil) ⇒ Object



22
23
24
25
26
27
28
29
30
31
# File 'lib/vcpkg_pipeline/extension/git_vpl.rb', line 22

def quick_push(new_tag = nil)
  has_tag = !new_tag.nil?
  if has_tag
    tags.each { |tag| VPL.error("当前版本 #{new_tag} 已发布, 请尝试其他版本号") if tag.name.eql? new_tag }

    add_tag(new_tag)
    VPL.info("Git提交Tag: #{new_tag}")
  end
  quick_push_tag(new_tag)
end

#quick_push_tag(new_tag = nil) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/vcpkg_pipeline/extension/git_vpl.rb', line 14

def quick_push_tag(new_tag = nil)
  unless ENV['Debug']
    has_tag = !new_tag.nil?
    push(remote, current_branch, has_tag)
  end
  VPL.info("Git上传 #{remote} #{current_branch} #{new_tag}")
end

#quick_stash(msg) ⇒ Object



33
34
35
36
# File 'lib/vcpkg_pipeline/extension/git_vpl.rb', line 33

def quick_stash(msg)
  add('.')
  branch.stashes.save(msg)
end

#to_sObject



38
39
40
# File 'lib/vcpkg_pipeline/extension/git_vpl.rb', line 38

def to_s
  "#{remote}-#{branches.current.first}"
end