Method: Flutter::Upload#update_version
- Defined in:
- lib/upload.rb
#update_version(version) ⇒ Object
更新版本
197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 |
# File 'lib/upload.rb', line 197 def update_version(version) # 读取文件内容 file_content = File.read(@spec_path) # 提取版本号 version_match = file_content.match(/s\.version\s+=\s+'(.+)'/) current_version = version_match&.captures&.first return unless current_version # 替换版本号 new_file_content = file_content.gsub(/s\.version\s+=\s+'#{current_version}'/, "s.version = '#{version}'") # 将替换后的内容写回文件 File.write(@spec_path, new_file_content) end |