Sha256: ec05c49e4b9fb3ad7a0bdeeee4950bed8130b1161fd72586ed0167f99cd137fd

Contents?: true

Size: 1.16 KB

Versions: 1

Compression:

Stored size: 1.16 KB

Contents

require 'cocoapods'

module Pod
  class TagUtil
    # attr_accessor :test
    # def initialize(test)
    #   @test = test
    # end

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

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

    # tag 是否存在符合格式的分支
    def self.exist_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

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

    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

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cocoapods-hd-0.0.5 lib/cocoapods-hd/tag_util.rb