Index: trunk/extensions/UsabilityInitiative/Makefile |
— | — | @@ -131,6 +131,13 @@ |
132 | 132 | WikiEditor/WikiEditor.hooks.php: $(WIKIEDITOR_HOOKS) |
133 | 133 | Vector/Vector.hooks.php: $(VECTOR_HOOKS) |
134 | 134 | |
| 135 | +# - Metarule for the above three files - |
| 136 | +# For each modified file (make $?): |
| 137 | +# Set $basefile to the path relative to the file being modified (ie. strip the folder). |
| 138 | +# Use sed to replace the line for that file with '+1' appended to the version. |
| 139 | +# Note that $${basefile//\//\\/} expands in the shell to $basefile with all slashes escaped. |
| 140 | +# End for |
| 141 | +# For each group of summing numbers inside the target file, use bc to calculate the sum and replace with sed. |
135 | 142 | %.hooks.php: $(WIKIEDITOR_HOOKS) |
136 | 143 | for file in $?; do basefile="$${file#$(shell echo $* | sed "s/\([^\/]*\/\).*/\\1/")}"; sed -i -e "s/\(.*'src' => '$${basefile//\//\\/}', 'version' => \)\([0-9+]*\)\(.*\)/\\1\\2+1\\3/" $@; \ |
137 | 144 | for i in $$(grep --only-matching -P " ([0-9]+(\+[0-9]))+ " $@); do sed -i -e "s/ $$i / $$(bc <<< $$i) /" $@; done; done |