class YJCocoa::GitTagAdd

Usage

Public Instance Methods

current_branch() click to toggle source
# File lib/yjcocoa/git/git_tag_add.rb, line 37
def current_branch
    list = (`git branch`).split("\n")
    for item in list
        if item =~ /\* /
            return item.gsub(/\* /, "")
        end
    end
end
run() click to toggle source
# File lib/yjcocoa/git/git_tag_add.rb, line 22
def run
    if File.exist?(".git")
        current_branch = self.current_branch
        tag = File.basename(Dir.pwd)
        tag << "-#{current_branch}" unless current_branch == "master"
        tag << "-#{Time.now.strftime('%Y%m%d%H%M')}"
        puts "YJCocoa build tag #{tag}".green
        system("yjcocoa git tag --add=#{tag}")
    else
        Dir.chdir("..") {
            self.run
        }
    end
end