Class: Pod::TagUtil

Inherits:
Object
  • Object
show all
Defined in:
lib/cocoapods-hd/tag_util.rb

Class Method Summary collapse

Class Method Details

.check_branch_include_tag(tag) ⇒ Object



40
41
42
43
44
45
46
47
48
49
# File 'lib/cocoapods-hd/tag_util.rb', line 40

def self.check_branch_include_tag(tag)
  branch_name = `git symbolic-ref --short -q HEAD`
  if branch_name.to_s.strip == "master"
    return true
  end
  if branch_name.include?(tag.to_s)
    return true
  end
  false
end

.check_release_branchObject

tag 是否存在符合格式的分支



23
24
25
26
27
28
29
30
# File 'lib/cocoapods-hd/tag_util.rb', line 23

def self.check_release_branch
  branch_name = `git symbolic-ref --short -q HEAD`
  UI.puts("current branch: #{branch_name}")
  if branch_name =~ /release_[0-9].[0-9].[0-9]/ || branch_name.to_s.strip == "master"
    return true
  end
  false
end

.exist_tag(tag) ⇒ Object

tag 是否存在



11
12
13
14
15
# File 'lib/cocoapods-hd/tag_util.rb', line 11

def self.exist_tag(tag)
  tag_string = `git tag -l`
  tag_list = tag_string.to_s.split("\n")
  tag_list.include?(tag)
end

.git_delete_tag(tag) ⇒ Object



17
18
19
20
# File 'lib/cocoapods-hd/tag_util.rb', line 17

def self.git_delete_tag(tag)
  `git tag -d #{tag}`
  `git push origin :refs/tags/#{tag}`
end

.upload_origin_sources(commit_desc) ⇒ Object

上传Sources



33
34
35
36
37
38
# File 'lib/cocoapods-hd/tag_util.rb', line 33

def self.upload_origin_sources(commit_desc)
  `git status -s`
  `git add .`
  `git commit -m '#{commit_desc}'`
  `git push origin master`
end