class Fastlane::Actions::ApplyPatchAction
Public Class Methods
available_options()
click to toggle source
# File lib/fastlane/plugin/patch/actions/apply_patch_action.rb, line 53 def self.available_options [ FastlaneCore::ConfigItem.new(key: :files, description: "Absolute or relative path(s) to one or more files to patch", optional: false, is_string: false), FastlaneCore::ConfigItem.new(key: :regexp, description: "A regular expression to match", optional: true, type: Regexp), FastlaneCore::ConfigItem.new(key: :text, description: "Text used to modify to the match", optional: true, type: String), FastlaneCore::ConfigItem.new(key: :global, description: "If true, patch all occurrences of the pattern", optional: true, default_value: false, is_string: false), FastlaneCore::ConfigItem.new(key: :offset, description: "Offset from which to start matching", optional: true, default_value: 0, type: Integer), FastlaneCore::ConfigItem.new(key: :mode, description: ":append, :prepend or :replace", optional: true, default_value: :append, type: Symbol), FastlaneCore::ConfigItem.new(key: :patch, description: "A YAML file specifying patch data", optional: true, type: String) ] end
category()
click to toggle source
# File lib/fastlane/plugin/patch/actions/apply_patch_action.rb, line 99 def self.category :deprecated end
deprecated_notes()
click to toggle source
# File lib/fastlane/plugin/patch/actions/apply_patch_action.rb, line 93 def self.deprecated_notes <<-EOF Please use the patch action instead. EOF end
description()
click to toggle source
# File lib/fastlane/plugin/patch/actions/apply_patch_action.rb, line 18 def self.description "Apply pattern-based patches to any text file." end
details()
click to toggle source
# File lib/fastlane/plugin/patch/actions/apply_patch_action.rb, line 26 def self.details <<-EOF Append or prepend text to a specified pattern in a list of files or replace it, once or globally. Patches are specified by arguments or YAML files. Revert the same patches with the revert_patch action. EOF end
example_code()
click to toggle source
# File lib/fastlane/plugin/patch/actions/apply_patch_action.rb, line 34 def self.example_code [ <<-EOF apply_patch( files: "examples/PatchTestAndroid/app/src/main/AndroidManifest.xml", regexp: %r{^\s*</application>}, mode: :prepend, text: " <meta-data android:name=\"foo\" android:value=\"bar\" />\n" ) EOF, <<-EOF apply_patch( files: "examples/PatchTestAndroid/app/src/main/AndroidManifest.xml", patch: "patch.yaml" ) EOF ] end
is_supported?(platform)
click to toggle source
# File lib/fastlane/plugin/patch/actions/apply_patch_action.rb, line 89 def self.is_supported?(platform) true end
run(params)
click to toggle source
# File lib/fastlane/plugin/patch/actions/apply_patch_action.rb, line 6 def self.run(params) if params[:patch] patch = PatternPatch::Patch.from_yaml params[:patch] else patch = PatternPatch::Patch.new params end patch.apply params[:files], offset: params[:offset] rescue => e UI.user_error! "Error in ApplyPatchAction: #{e.message}\n#{e.backtrace}" end