๐จ Sentinel for Xcode
Because of my last article and after some feedback (thanks @mattie) I decided to start Sentinel for Xcode
Why?? my previous approach was 100% pure shell script, which btw itโs not simple to read, so since this is for Xcode, so letโs do with swift ๐.
The project is public (github.com/ruiaureliano/Sentinel), feel free to try and comment ๐ช. There are two projects, Sentinel itself and a Sample project to test.
1) Download or Build Sentinel
You need to download the release or build the project itself, up to you
2) Installation
- Open terminal and check your path
- Move sentinel to one of those directories, for instance
/usr/local/bin
- Drag sentinel to that folder, you may need to type your password
- Close and reopen terminal and type this command: sentinel if you see the following message, that's all ๐ช.
3) Xcode Integration
Open Xcode project, navigate to Targets โบ Build Phases, create a new Run Script Phase and enter this:
Sentinel uses a JSON file with the rules for show warnings and errors, this particular file we use two separated JSONs, one for debug
and one for release
Each JSON must be like this:
The main key must be debug
or release
and the value is an array of dictionaries, where each one must have these keys: rule
, message
, type
, file
Explaining JSON rules
The difference between .debug.json
and .release.json
is just the way we display messages, warnings, and errors
a) 1st rule is โA = 1โ
and we show a simple message โโ ๏ธ Yes can be an emoji ๐คญโ
b) 2nd rule โb|B = 1โ
will trigger a message if โb=1โ
or โB=1โ
we display this message โโ ๏ธ Because โ\\$1โโ
c) 3rd rule โif .* == true {โ
this rule explain how to use regular expressions, in this case we donโt want to compare a flag with a bool, instead just use โif flagโ
, not if โflag == trueโ
d) 4th rule, same as c)
but for false
Output
Thanks, please share if you think this is awesome ๐ง