Class: DYAutomate::Command::Git::TagAdd

Inherits:
DYAutomate::Command::Git show all
Defined in:
lib/DYAutomate/Command/Git/tagAdd.rb

Instance Attribute Summary

Attributes inherited from DYAutomate::Command::Git

#git_obj, #path

Attributes inherited from DYAutomate::Command

#config, #env_str, #repo_name

Instance Method Summary collapse

Methods inherited from DYAutomate::Command::Git

#existGit?

Methods inherited from DYAutomate::Command

options, #pp

Constructor Details

#initialize(argv) ⇒ TagAdd

#要查询的lib名字attr_accessor :name #查询结果lib信息attr_accessor :info



20
21
22
23
# File 'lib/DYAutomate/Command/Git/tagAdd.rb', line 20

def initialize(argv)
  # @name = argv.shift_argument
  super
end

Instance Method Details

#add_tag(newTag) ⇒ Object



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/DYAutomate/Command/Git/tagAdd.rb', line 41

def add_tag(newTag)

  @git_obj.tags.each{|x|
    if x.name.eql?(newTag)
      puts "Errror git --- #{newTag} has exist!"
    end
  }

  #git操作
    begin
      git.add(:all=>true)
      #提交更改
      git.commit("修改版本号 newTag")
      git.push
      
      #打tag
      git.add_tag(newTag, {:m => "tag更新"})
      #push tag
      git.push('origin','master',{:tags =>newTag})
    rescue
      git.reset_hard()
      puts "Errror git --- newTag"
    end
end

#runObject



36
37
38
39
# File 'lib/DYAutomate/Command/Git/tagAdd.rb', line 36

def run
  pp('tagAdd run ...',1)

end

#validate!Object



25
26
27
28
29
30
31
32
33
34
# File 'lib/DYAutomate/Command/Git/tagAdd.rb', line 25

def validate!
  super
  # unless @name
  #   help! 'need the lib `NAME`.'
  # end

  # unless existAtPools?
  #   help! "the podspec file is not exist at #{Dir.pwd}."
  # end
end