Class: Fastlane::Actions::AddSnapshotToCurrentVersionAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::AddSnapshotToCurrentVersionAction
- Defined in:
- lib/fastlane/plugin/stream_actions/actions/add_snapshot_to_current_version.rb
Documentation collapse
Class Method Summary collapse
Class Method Details
.available_options ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/fastlane/plugin/stream_actions/actions/add_snapshot_to_current_version.rb', line 21 def self. [ FastlaneCore::ConfigItem.new( key: :file_path, description: 'File with a version that needs to be a snapshot' ) ] end |
.description ⇒ Object
17 18 19 |
# File 'lib/fastlane/plugin/stream_actions/actions/add_snapshot_to_current_version.rb', line 17 def self.description 'Add snapshot postfix to the current release version' end |
.is_supported?(platform) ⇒ Boolean
30 31 32 |
# File 'lib/fastlane/plugin/stream_actions/actions/add_snapshot_to_current_version.rb', line 30 def self.is_supported?(platform) true end |
.run(params) ⇒ Object
4 5 6 7 8 9 10 11 |
# File 'lib/fastlane/plugin/stream_actions/actions/add_snapshot_to_current_version.rb', line 4 def self.run(params) content = File.read(params[:file_path]) current_version = content.match(/String\s+=\s+"([\d.]+).*"/)[1] updated_version = "#{current_version}-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 |