class YJCocoa::GitTag
Attributes
addTag[RW]
property
deleteTags[RW]
Public Class Methods
new(argv)
click to toggle source
初始化
Calls superclass method
# File lib/yjcocoa/git/git_tag.rb, line 37 def initialize(argv) super self.addTag = argv.option('add') self.deleteTags = argv.option('delete') self.deleteTags = self.deleteTags.split(",").reject {|i| i.empty? } if self.deleteTags end
options()
click to toggle source
Calls superclass method
YJCocoa::Command::options
# File lib/yjcocoa/git/git_tag.rb, line 23 def self.options if self == YJCocoa::GitTag [['--add', '增加 tag, 多 tag 用 "," 分隔'], ['--delete', '删除 tag, 多 tag 用 "," 分隔']] + super else super end end
Public Instance Methods
gitTagAdd()
click to toggle source
# File lib/yjcocoa/git/git_tag.rb, line 61 def gitTagAdd puts "YJCocoa git add tag #{self.addTag}".green system("git push origin #{self.addTag}") if system("git tag #{self.addTag}") end
gitTagDelete()
click to toggle source
# File lib/yjcocoa/git/git_tag.rb, line 66 def gitTagDelete puts "YJCocoa git delete tags #{self.deleteTags}".green self.deleteTags.each { |tag| system("git push origin :refs/tags/#{tag}") if system("git tag -d #{tag}") } end
run()
click to toggle source
# File lib/yjcocoa/git/git_tag.rb, line 53 def run if self.deleteTags && !self.deleteTags.empty? self.gitTagDelete puts end self.gitTagAdd if self.addTag end
validate!()
click to toggle source
businrss
Calls superclass method
# File lib/yjcocoa/git/git_tag.rb, line 45 def validate! super exit 0 unless self.gitExist? if self.class == YJCocoa::GitTag self.banner! unless self.addTag || self.deleteTags end end