@@ -14,13 +14,21 @@ fastlane add_plugin patch
1414
1515Apply and revert pattern-based patches to any text file.
1616
17+ This is a very preliminary plugin to apply and revert patches to text files. One
18+ of the main intended use cases for this plugin is source-code modification, e.g.
19+ when automatically integrating an SDK.
20+
21+ Please provide any feedback via issues in this repo.
22+
1723### apply_patch action
1824
1925``` Ruby
20- apply_patch files: " examples/PatchTestAndroid/app/src/main/AndroidManifest.xml" ,
21- regexp: %r{^\s *</application>} ,
22- mode: :prepend ,
23- text: " <meta-data android:name=\" foo\" android:value=\" bar\" />\n "
26+ apply_patch(
27+ files: " examples/PatchTestAndroid/app/src/main/AndroidManifest.xml" ,
28+ regexp: %r{^\s *</application>} ,
29+ mode: :prepend ,
30+ text: " <meta-data android:name=\" foo\" android:value=\" bar\" />\n "
31+ )
2432```
2533
2634This action matches one or all occurrences of a specified regular expression and
@@ -42,24 +50,30 @@ global: false
4250
4351**Fastfile**:
4452` ` ` Ruby
45- apply_patch files : " examples/PatchTestAndroid/app/src/main/AndroidManifest.xml" ,
46- patch : " patch.yaml"
53+ apply_patch(
54+ files : " examples/PatchTestAndroid/app/src/main/AndroidManifest.xml" ,
55+ patch : " patch.yaml"
56+ )
4757```
4858
4959### revert_patch action
5060
5161Revert patches by passing the same arguments to the ` revert_patch ` action:
5262
5363``` Ruby
54- revert_patch files: "examples/PatchTestAndroid/app/src/main/AndroidManifest.xml",
55- regexp: %r{^\s *</application>},
56- mode: :prepend,
57- text: " <meta-data android:name=\" foo\" android:value=\" bar\" />\n "
64+ revert_patch(
65+ files: " examples/PatchTestAndroid/app/src/main/AndroidManifest.xml" ,
66+ regexp: %r{^\s *</application>} ,
67+ mode: :prepend ,
68+ text: " <meta-data android:name=\" foo\" android:value=\" bar\" />\n "
69+ )
5870```
5971
6072``` Ruby
61- revert_patch files: "examples/PatchTestAndroid/app/src/main/AndroidManifest.xml",
62- patch: "patch.yaml"
73+ revert_patch(
74+ files: " examples/PatchTestAndroid/app/src/main/AndroidManifest.xml" ,
75+ patch: " patch.yaml"
76+ )
6377```
6478
6579Patches using the ` :replace ` mode cannot be reverted.
0 commit comments