Class: Fastlane::Actions::UpdateReleaseVersionToSnapshotAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::UpdateReleaseVersionToSnapshotAction
- Defined in:
- lib/fastlane/plugin/stream_actions/actions/update_release_version_to_snapshot.rb
Documentation collapse
Class Method Summary collapse
Class Method Details
.available_options ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/fastlane/plugin/stream_actions/actions/update_release_version_to_snapshot.rb', line 23 def self. [ FastlaneCore::ConfigItem.new( key: :file_path, description: 'File with a version that needs to be a snapshot' ) ] end |
.description ⇒ Object
19 20 21 |
# File 'lib/fastlane/plugin/stream_actions/actions/update_release_version_to_snapshot.rb', line 19 def self.description 'Bump a release version and add a snapshot postfix' end |
.is_supported?(platform) ⇒ Boolean
32 33 34 |
# File 'lib/fastlane/plugin/stream_actions/actions/update_release_version_to_snapshot.rb', line 32 def self.is_supported?(platform) true end |
.run(params) ⇒ Object
4 5 6 7 8 9 10 11 12 13 |
# File 'lib/fastlane/plugin/stream_actions/actions/update_release_version_to_snapshot.rb', line 4 def self.run(params) content = File.read(params[:file_path]) current_version = content.match(/String\s+=\s+"([\d.]+).*"/)[1] major, minor, _patch = current_version.split('.').map(&:to_i) minor += 1 updated_version = "#{major}.#{minor}.0-SNAPSHOT" new_content = content.sub!(/"[^"]+"/, "\"#{updated_version}\"") File.open(params[:file_path], 'w') { |f| f.puts(new_content) } UI.important("Replaced #{current_version} with #{updated_version} 📝") end |