Class: Stool::Command::Lib::VersionAdd

Inherits:
Stool::Command::Lib show all
Defined in:
lib/stool/Command/Lib/VersionAdd.rb

Instance Attribute Summary

Attributes inherited from Stool::Command::Lib

#info, #name

Instance Method Summary collapse

Methods inherited from Stool::Command::Lib

#existAtPools?, #initialize, #validate!

Methods inherited from Stool::Command

#checkConfigFile, #initialize, options, #pp

Constructor Details

This class inherits a constructor from Stool::Command::Lib

Instance Method Details

#runObject



16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/stool/Command/Lib/VersionAdd.rb', line 16

def run
  @info.info_tos
  puts '版本增加 1'
  newVersion = StringUtile::versionUpdate(@info.version,'1')
  file = File.open(@info.path + "/#{@info.name}" + ".podspec", "r+")
    file.each_line do |line|
      if line[/#{@info.version}/]
        file.seek(-line.length, IO::SEEK_CUR)
        file.write(line.sub(/#{@info.version}/, newVersion))
      end
    end
  file.close
end