Class: DYAutomate::Command::Pod::Version

Inherits:
DYAutomate::Command::Pod show all
Defined in:
lib/DYAutomate/Command/Pod/version.rb

Instance Attribute Summary

Attributes inherited from DYAutomate::Command::Pod

#name, #path, #spec_name, #spec_path

Attributes inherited from DYAutomate::Command

#config, #env_str, #repo_name

Instance Method Summary collapse

Methods inherited from DYAutomate::Command::Pod

#dy_update_repo, #existPodspec?, #file_line_match, #file_line_match_replace, #get_spec_version, #get_version_big_new, #get_version_new, #validate!

Methods inherited from DYAutomate::Command

#pp

Constructor Details

#initialize(argv) ⇒ Version

def self.options

[
  ['--add', '增加一个小版本'],
  # ['-minus', ' 减少一个小版本'],
  ['--addBig', '增加一个大版本'],
  # ['-minusBig', ' 减少一个大版本'],
].concat(super)

end



28
29
30
31
32
# File 'lib/DYAutomate/Command/Pod/version.rb', line 28

def initialize(argv)
  @add = argv.shift_argument
  @addBig = argv.shift_argument
  super
end

Instance Method Details

#fix_pod_version(new_version) ⇒ Object



48
49
50
51
52
53
54
55
56
57
58
# File 'lib/DYAutomate/Command/Pod/version.rb', line 48

def fix_pod_version(new_version)
  if new_version
    #查找内容
    targetLine = file_line_match(@spec_path,/s.version *=/)
    newLine = "  s.version          = '#{new_version}' \n"
    file_line_match_replace(@spec_path,/s.version *=/,newLine)
    pp(get_spec_version,1)
  else
    pp('fix_pod_version error,new_version is nil',1)
  end
end

#runObject



34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/DYAutomate/Command/Pod/version.rb', line 34

def run
  if @add.to_i > 0
    pp('增加一个小版本',1)
    new_v = get_version_new
    fix_pod_version(new_v)
  end
  if @addBig.to_i > 0
    pp('增加一个大版本',1)
    new_v = get_version_big_new

    fix_pod_version(new_v)
  end
end